AT&T IoT hackster.io contest entry: Carpal2

Dependencies:   FXOS8700CQ Pubnub_mbed2_sync WNCInterface mbed-rtos mbed

Committer:
cswiger
Date:
Sat Dec 24 17:31:00 2016 +0000
Revision:
2:fe8e935b9342
Parent:
0:d2425a595807
added Ignition awareness so Carpal2 will resume working after car has been turned off and back on.

Who changed what in which revision?

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