The Hiking Pal tracking device firmware. See full description on the detail page: https://www.hackster.io/bowenfeng/hiking-pal-v1-07c02d

Dependencies:   FXOS8700CQ MODSERIAL mbed

Fork of Avnet_ATT_Cellular_IOT by Avnet

Committer:
bowenfeng
Date:
Thu Dec 22 09:32:33 2016 +0000
Revision:
87:ca75c5e785a7
Parent:
69:5a3414cc7531
Join latest hiking activity instead.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
stefanrousseau 69:5a3414cc7531 1 /* ===================================================================
stefanrousseau 69:5a3414cc7531 2 Copyright © 2016, AVNET Inc.
stefanrousseau 69:5a3414cc7531 3
stefanrousseau 69:5a3414cc7531 4 Licensed under the Apache License, Version 2.0 (the "License");
stefanrousseau 69:5a3414cc7531 5 you may not use this file except in compliance with the License.
stefanrousseau 69:5a3414cc7531 6 You may obtain a copy of the License at
stefanrousseau 69:5a3414cc7531 7
stefanrousseau 69:5a3414cc7531 8 http://www.apache.org/licenses/LICENSE-2.0
stefanrousseau 69:5a3414cc7531 9
stefanrousseau 69:5a3414cc7531 10 Unless required by applicable law or agreed to in writing,
stefanrousseau 69:5a3414cc7531 11 software distributed under the License is distributed on an
stefanrousseau 69:5a3414cc7531 12 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
stefanrousseau 69:5a3414cc7531 13 either express or implied. See the License for the specific
stefanrousseau 69:5a3414cc7531 14 language governing permissions and limitations under the License.
stefanrousseau 69:5a3414cc7531 15
stefanrousseau 69:5a3414cc7531 16 ======================================================================== */
stefanrousseau 69:5a3414cc7531 17
stefanrousseau 69:5a3414cc7531 18 #ifndef __XADOW_GPS_H_
stefanrousseau 69:5a3414cc7531 19 #define __XADOW_GPS_H_
stefanrousseau 69:5a3414cc7531 20
stefanrousseau 69:5a3414cc7531 21 /*!
stefanrousseau 69:5a3414cc7531 22 \def GPS_DEVICE_ADDR
stefanrousseau 69:5a3414cc7531 23 The I2C address GPS
stefanrousseau 69:5a3414cc7531 24
stefanrousseau 69:5a3414cc7531 25 \def GPS_SCAN_ID
stefanrousseau 69:5a3414cc7531 26 The id of scan data, the format is 0,0,0,Device address
stefanrousseau 69:5a3414cc7531 27 \def GPS_SCAN_SIZE
stefanrousseau 69:5a3414cc7531 28 The length of scan data
stefanrousseau 69:5a3414cc7531 29
stefanrousseau 69:5a3414cc7531 30 \def GPS_UTC_DATE_TIME_ID
stefanrousseau 69:5a3414cc7531 31 The id of utc date and time, the format is YMDHMS
stefanrousseau 69:5a3414cc7531 32 \def GPS_UTC_DATE_TIME_SIZE
stefanrousseau 69:5a3414cc7531 33 The length of utc date and time data
stefanrousseau 69:5a3414cc7531 34
stefanrousseau 69:5a3414cc7531 35 \def GPS_STATUS_ID
stefanrousseau 69:5a3414cc7531 36 The id of GPS status, the format is A/V
stefanrousseau 69:5a3414cc7531 37 \def GPS_STATUS_SIZE
stefanrousseau 69:5a3414cc7531 38 The length of GPS status data
stefanrousseau 69:5a3414cc7531 39
stefanrousseau 69:5a3414cc7531 40 \def GPS_LATITUDE_ID
stefanrousseau 69:5a3414cc7531 41 The id of latitude, the format is dd.dddddd
stefanrousseau 69:5a3414cc7531 42 \def GPS_LATITUDE_SIZE
stefanrousseau 69:5a3414cc7531 43 The length of latitude data
stefanrousseau 69:5a3414cc7531 44
stefanrousseau 69:5a3414cc7531 45 \def GPS_NS_ID
stefanrousseau 69:5a3414cc7531 46 The id of latitude direction, the format is N/S
stefanrousseau 69:5a3414cc7531 47 \def GPS_NS_SIZE
stefanrousseau 69:5a3414cc7531 48 The length of latitude direction data
stefanrousseau 69:5a3414cc7531 49
stefanrousseau 69:5a3414cc7531 50 \def GPS_LONGITUDE_ID
stefanrousseau 69:5a3414cc7531 51 The id of longitude, the format is ddd.dddddd
stefanrousseau 69:5a3414cc7531 52 \def GPS_LONGITUDE_SIZE
stefanrousseau 69:5a3414cc7531 53 The length of longitude data
stefanrousseau 69:5a3414cc7531 54
stefanrousseau 69:5a3414cc7531 55 \def GPS_EW_ID
stefanrousseau 69:5a3414cc7531 56 The id of longitude direction, the format is E/W
stefanrousseau 69:5a3414cc7531 57 \def GPS_EW_SIZE
stefanrousseau 69:5a3414cc7531 58 The length of longitude direction data
stefanrousseau 69:5a3414cc7531 59
stefanrousseau 69:5a3414cc7531 60 \def GPS_SPEED_ID
stefanrousseau 69:5a3414cc7531 61 The id of speed, the format is 000.0~999.9 Knots
stefanrousseau 69:5a3414cc7531 62 \def GPS_SPEED_SIZE
stefanrousseau 69:5a3414cc7531 63 The length of speed data
stefanrousseau 69:5a3414cc7531 64
stefanrousseau 69:5a3414cc7531 65 \def GPS_COURSE_ID
stefanrousseau 69:5a3414cc7531 66 The id of course, the format is 000.0~359.9
stefanrousseau 69:5a3414cc7531 67 \def GPS_COURSE_SIZE
stefanrousseau 69:5a3414cc7531 68 The length of course data
stefanrousseau 69:5a3414cc7531 69
stefanrousseau 69:5a3414cc7531 70 \def GPS_POSITION_FIX_ID
stefanrousseau 69:5a3414cc7531 71 The id of position fix status, the format is 0,1,2,6
stefanrousseau 69:5a3414cc7531 72 \def GPS_POSITION_FIX_SIZE
stefanrousseau 69:5a3414cc7531 73 The length of position fix status data
stefanrousseau 69:5a3414cc7531 74
stefanrousseau 69:5a3414cc7531 75 \def GPS_SATE_USED_ID
stefanrousseau 69:5a3414cc7531 76 The id of state used, the format is 00~12
stefanrousseau 69:5a3414cc7531 77 \def GPS_SATE_USED_SIZE
stefanrousseau 69:5a3414cc7531 78 The length of sate used data
stefanrousseau 69:5a3414cc7531 79
stefanrousseau 69:5a3414cc7531 80 \def GPS_ALTITUDE_ID
stefanrousseau 69:5a3414cc7531 81 The id of altitude, the format is -9999.9~99999.9
stefanrousseau 69:5a3414cc7531 82 \def GPS_ALTITUDE_SIZE
stefanrousseau 69:5a3414cc7531 83 The length of altitude data
stefanrousseau 69:5a3414cc7531 84
stefanrousseau 69:5a3414cc7531 85 \def GPS_MODE_ID
stefanrousseau 69:5a3414cc7531 86 The id of locate mode, the format is A/M
stefanrousseau 69:5a3414cc7531 87 \def GPS_MODE_SIZE
stefanrousseau 69:5a3414cc7531 88 The length of locate mode data
stefanrousseau 69:5a3414cc7531 89
stefanrousseau 69:5a3414cc7531 90 \def GPS_MODE2_ID
stefanrousseau 69:5a3414cc7531 91 The id of current status, the format is 1,2,3
stefanrousseau 69:5a3414cc7531 92 \def GPS_MODE2_SIZE
stefanrousseau 69:5a3414cc7531 93 The length of current status data
stefanrousseau 69:5a3414cc7531 94
stefanrousseau 69:5a3414cc7531 95 \def GPS_SATE_IN_VIEW_ID
stefanrousseau 69:5a3414cc7531 96 The id of sate in view
stefanrousseau 69:5a3414cc7531 97 \def GPS_SATE_IN_VIEW_SIZE
stefanrousseau 69:5a3414cc7531 98 The length of sate in view data
stefanrousseau 69:5a3414cc7531 99 */
stefanrousseau 69:5a3414cc7531 100
stefanrousseau 69:5a3414cc7531 101 /* Data format:
stefanrousseau 69:5a3414cc7531 102 * ID(1 byte), Data length(1 byte), Data 1, Data 2, ... Data n (n bytes, n = data length)
stefanrousseau 69:5a3414cc7531 103 * For example, get the scan data.
stefanrousseau 69:5a3414cc7531 104 * First, Send GPS_SCAN_ID(1 byte) to device.
stefanrousseau 69:5a3414cc7531 105 * Second, Receive scan data(ID + Data length + GPS_SCAN_SIZE = 6 bytes).
stefanrousseau 69:5a3414cc7531 106 * Third, The scan data begin from the third data of received.
stefanrousseau 69:5a3414cc7531 107 * End
stefanrousseau 69:5a3414cc7531 108 */
stefanrousseau 69:5a3414cc7531 109
stefanrousseau 69:5a3414cc7531 110 #define GPS_DEVICE_ID 0x05
stefanrousseau 69:5a3414cc7531 111 //#define GPS_DEVICE_ADDR 0x05
stefanrousseau 69:5a3414cc7531 112 #define GPS_DEVICE_ADDR 0x0A //For mbed, the address has to be << 1
stefanrousseau 69:5a3414cc7531 113
stefanrousseau 69:5a3414cc7531 114 #define GPS_SCAN_ID 0 // 4 bytes
stefanrousseau 69:5a3414cc7531 115 #define GPS_SCAN_SIZE 4 // 0,0,0,Device address
stefanrousseau 69:5a3414cc7531 116
stefanrousseau 69:5a3414cc7531 117 #define GPS_UTC_DATE_TIME_ID 1 // YMDHMS
stefanrousseau 69:5a3414cc7531 118 #define GPS_UTC_DATE_TIME_SIZE 6 // 6 bytes
stefanrousseau 69:5a3414cc7531 119
stefanrousseau 69:5a3414cc7531 120 #define GPS_STATUS_ID 2 // A/V
stefanrousseau 69:5a3414cc7531 121 #define GPS_STATUS_SIZE 1 // 1 byte
stefanrousseau 69:5a3414cc7531 122
stefanrousseau 69:5a3414cc7531 123 #define GPS_LATITUDE_ID 3 // dd.dddddd
stefanrousseau 69:5a3414cc7531 124 #define GPS_LATITUDE_SIZE 9 // 9 bytes
stefanrousseau 69:5a3414cc7531 125
stefanrousseau 69:5a3414cc7531 126 #define GPS_NS_ID 4 // N/S
stefanrousseau 69:5a3414cc7531 127 #define GPS_NS_SIZE 1 // 1 byte
stefanrousseau 69:5a3414cc7531 128
stefanrousseau 69:5a3414cc7531 129 #define GPS_LONGITUDE_ID 5 // ddd.dddddd
stefanrousseau 69:5a3414cc7531 130 #define GPS_LONGITUDE_SIZE 10 // 10 bytes
stefanrousseau 69:5a3414cc7531 131
stefanrousseau 69:5a3414cc7531 132 #define GPS_EW_ID 6 // E/W
stefanrousseau 69:5a3414cc7531 133 #define GPS_EW_SIZE 1 // 1 byte
stefanrousseau 69:5a3414cc7531 134
stefanrousseau 69:5a3414cc7531 135 #define GPS_SPEED_ID 7 // 000.0~999.9 Knots
stefanrousseau 69:5a3414cc7531 136 #define GPS_SPEED_SIZE 5 // 5 bytes
stefanrousseau 69:5a3414cc7531 137
stefanrousseau 69:5a3414cc7531 138 #define GPS_COURSE_ID 8 // 000.0~359.9
stefanrousseau 69:5a3414cc7531 139 #define GPS_COURSE_SIZE 5 // 5 bytes
stefanrousseau 69:5a3414cc7531 140
stefanrousseau 69:5a3414cc7531 141 #define GPS_POSITION_FIX_ID 9 // 0,1,2,6
stefanrousseau 69:5a3414cc7531 142 #define GPS_POSITION_FIX_SIZE 1 // 1 byte
stefanrousseau 69:5a3414cc7531 143
stefanrousseau 69:5a3414cc7531 144 #define GPS_SATE_USED_ID 10 // 00~12
stefanrousseau 69:5a3414cc7531 145 #define GPS_SATE_USED_SIZE 2 // 2 bytes
stefanrousseau 69:5a3414cc7531 146
stefanrousseau 69:5a3414cc7531 147 #define GPS_ALTITUDE_ID 11 // -9999.9~99999.9
stefanrousseau 69:5a3414cc7531 148 #define GPS_ALTITUDE_SIZE 7 // 7 bytes
stefanrousseau 69:5a3414cc7531 149
stefanrousseau 69:5a3414cc7531 150 #define GPS_MODE_ID 12 // A/M
stefanrousseau 69:5a3414cc7531 151 #define GPS_MODE_SIZE 1 // 1 byte
stefanrousseau 69:5a3414cc7531 152
stefanrousseau 69:5a3414cc7531 153 #define GPS_MODE2_ID 13 // 1,2,3
stefanrousseau 69:5a3414cc7531 154 #define GPS_MODE2_SIZE 1 // 1 byte
stefanrousseau 69:5a3414cc7531 155
stefanrousseau 69:5a3414cc7531 156 #define GPS_SATE_IN_VIEW_ID 14 // 0~12
stefanrousseau 69:5a3414cc7531 157 #define GPS_SATE_IN_VIEW_SIZE 1 // 1 byte
stefanrousseau 69:5a3414cc7531 158
stefanrousseau 69:5a3414cc7531 159
stefanrousseau 69:5a3414cc7531 160 /**
stefanrousseau 69:5a3414cc7531 161 * \brief Get the status of the device.
stefanrousseau 69:5a3414cc7531 162 *
stefanrousseau 69:5a3414cc7531 163 * \return Return TRUE or FALSE. TRUE is on line, FALSE is off line.
stefanrousseau 69:5a3414cc7531 164 *
stefanrousseau 69:5a3414cc7531 165 */
stefanrousseau 69:5a3414cc7531 166 unsigned char gps_check_online(void);
stefanrousseau 69:5a3414cc7531 167
stefanrousseau 69:5a3414cc7531 168 /**
stefanrousseau 69:5a3414cc7531 169 * \brief Get the utc date and time.
stefanrousseau 69:5a3414cc7531 170 *
stefanrousseau 69:5a3414cc7531 171 * \return Return the pointer of utc date sand time, the format is YMDHMS.
stefanrousseau 69:5a3414cc7531 172 *
stefanrousseau 69:5a3414cc7531 173 */
stefanrousseau 69:5a3414cc7531 174 unsigned char* gps_get_utc_date_time(void);
stefanrousseau 69:5a3414cc7531 175
stefanrousseau 69:5a3414cc7531 176 /**
stefanrousseau 69:5a3414cc7531 177 * \brief Get the status of GPS.
stefanrousseau 69:5a3414cc7531 178 *
stefanrousseau 69:5a3414cc7531 179 * \return Return A or V. A is orientation, V is navigation.
stefanrousseau 69:5a3414cc7531 180 *
stefanrousseau 69:5a3414cc7531 181 */
stefanrousseau 69:5a3414cc7531 182 unsigned char gps_get_status(void);
stefanrousseau 69:5a3414cc7531 183
stefanrousseau 69:5a3414cc7531 184 /**
stefanrousseau 69:5a3414cc7531 185 * \brief Get the altitude.
stefanrousseau 69:5a3414cc7531 186 *
stefanrousseau 69:5a3414cc7531 187 * \return Return altitude data. The format is dd.dddddd.
stefanrousseau 69:5a3414cc7531 188 *
stefanrousseau 69:5a3414cc7531 189 */
stefanrousseau 69:5a3414cc7531 190 float gps_get_latitude(void);
stefanrousseau 69:5a3414cc7531 191
stefanrousseau 69:5a3414cc7531 192 /**
stefanrousseau 69:5a3414cc7531 193 * \brief Get the lattitude direction.
stefanrousseau 69:5a3414cc7531 194 *
stefanrousseau 69:5a3414cc7531 195 * \return Return lattitude direction data. The format is N/S. N is north, S is south.
stefanrousseau 69:5a3414cc7531 196 *
stefanrousseau 69:5a3414cc7531 197 */
stefanrousseau 69:5a3414cc7531 198 unsigned char gps_get_ns(void);
stefanrousseau 69:5a3414cc7531 199
stefanrousseau 69:5a3414cc7531 200 /**
stefanrousseau 69:5a3414cc7531 201 * \brief Get the longitude.
stefanrousseau 69:5a3414cc7531 202 *
stefanrousseau 69:5a3414cc7531 203 * \return Return longitude data. The format is ddd.dddddd.
stefanrousseau 69:5a3414cc7531 204 *
stefanrousseau 69:5a3414cc7531 205 */
stefanrousseau 69:5a3414cc7531 206 float gps_get_longitude(void);
stefanrousseau 69:5a3414cc7531 207
stefanrousseau 69:5a3414cc7531 208 /**
stefanrousseau 69:5a3414cc7531 209 * \brief Get the longitude direction.
stefanrousseau 69:5a3414cc7531 210 *
stefanrousseau 69:5a3414cc7531 211 * \return Return longitude direction data. The format is E/W. E is east, W is west.
stefanrousseau 69:5a3414cc7531 212 *
stefanrousseau 69:5a3414cc7531 213 */
stefanrousseau 69:5a3414cc7531 214 unsigned char gps_get_ew(void);
stefanrousseau 69:5a3414cc7531 215
stefanrousseau 69:5a3414cc7531 216 /**
stefanrousseau 69:5a3414cc7531 217 * \brief Get the speed.
stefanrousseau 69:5a3414cc7531 218 *
stefanrousseau 69:5a3414cc7531 219 * \return Return speed data. The format is 000.0~999.9 Knots.
stefanrousseau 69:5a3414cc7531 220 *
stefanrousseau 69:5a3414cc7531 221 */
stefanrousseau 69:5a3414cc7531 222 float gps_get_speed(void);
stefanrousseau 69:5a3414cc7531 223
stefanrousseau 69:5a3414cc7531 224 /**
stefanrousseau 69:5a3414cc7531 225 * \brief Get the course.
stefanrousseau 69:5a3414cc7531 226 *
stefanrousseau 69:5a3414cc7531 227 * \return Return course data. The format is 000.0~359.9.
stefanrousseau 69:5a3414cc7531 228 *
stefanrousseau 69:5a3414cc7531 229 */
stefanrousseau 69:5a3414cc7531 230 float gps_get_course(void);
stefanrousseau 69:5a3414cc7531 231
stefanrousseau 69:5a3414cc7531 232 /**
stefanrousseau 69:5a3414cc7531 233 * \brief Get the status of position fix.
stefanrousseau 69:5a3414cc7531 234 *
stefanrousseau 69:5a3414cc7531 235 * \return Return position fix data. The format is 0,1,2,6.
stefanrousseau 69:5a3414cc7531 236 *
stefanrousseau 69:5a3414cc7531 237 */
stefanrousseau 69:5a3414cc7531 238 unsigned char gps_get_position_fix(void);
stefanrousseau 69:5a3414cc7531 239
stefanrousseau 69:5a3414cc7531 240 /**
stefanrousseau 69:5a3414cc7531 241 * \brief Get the number of state used¡£
stefanrousseau 69:5a3414cc7531 242 *
stefanrousseau 69:5a3414cc7531 243 * \return Return number of state used. The format is 0-12.
stefanrousseau 69:5a3414cc7531 244 *
stefanrousseau 69:5a3414cc7531 245 */
stefanrousseau 69:5a3414cc7531 246 unsigned char gps_get_sate_used(void);
stefanrousseau 69:5a3414cc7531 247
stefanrousseau 69:5a3414cc7531 248 /**
stefanrousseau 69:5a3414cc7531 249 * \brief Get the altitude¡£ the format is -9999.9~99999.9
stefanrousseau 69:5a3414cc7531 250 *
stefanrousseau 69:5a3414cc7531 251 * \return Return altitude data. The format is -9999.9~99999.9.
stefanrousseau 69:5a3414cc7531 252 *
stefanrousseau 69:5a3414cc7531 253 */
stefanrousseau 69:5a3414cc7531 254 float gps_get_altitude(void);
stefanrousseau 69:5a3414cc7531 255
stefanrousseau 69:5a3414cc7531 256 /**
stefanrousseau 69:5a3414cc7531 257 * \brief Get the mode of location.
stefanrousseau 69:5a3414cc7531 258 *
stefanrousseau 69:5a3414cc7531 259 * \return Return mode of location. The format is A/M. A:automatic, M:manual.
stefanrousseau 69:5a3414cc7531 260 *
stefanrousseau 69:5a3414cc7531 261 */
stefanrousseau 69:5a3414cc7531 262 unsigned char gps_get_mode(void);
stefanrousseau 69:5a3414cc7531 263
stefanrousseau 69:5a3414cc7531 264 /**
stefanrousseau 69:5a3414cc7531 265 * \brief Get the current status of GPS.
stefanrousseau 69:5a3414cc7531 266 *
stefanrousseau 69:5a3414cc7531 267 * \return Return current status. The format is 1,2,3. 1:null, 2:2D, 3:3D.
stefanrousseau 69:5a3414cc7531 268 *
stefanrousseau 69:5a3414cc7531 269 */
stefanrousseau 69:5a3414cc7531 270 unsigned char gps_get_mode2(void);
stefanrousseau 69:5a3414cc7531 271
stefanrousseau 69:5a3414cc7531 272 /**
stefanrousseau 69:5a3414cc7531 273 * \brief Get the number of sate in view.
stefanrousseau 69:5a3414cc7531 274 *
stefanrousseau 69:5a3414cc7531 275 * \return Return the number of sate in view.
stefanrousseau 69:5a3414cc7531 276 *
stefanrousseau 69:5a3414cc7531 277 */
stefanrousseau 69:5a3414cc7531 278 unsigned char gps_get_sate_in_veiw(void);
stefanrousseau 69:5a3414cc7531 279
stefanrousseau 69:5a3414cc7531 280 #endif