SensorDataParser library that supports Sensor Data Streamer binary packets and Sensor Monitor csv packets

Committer:
screamer
Date:
Thu Oct 24 17:02:02 2013 +0000
Revision:
1:e9d3bb2384a9
Parent:
0:145141a10e18
* fixed - Updated docs etc

Who changed what in which revision?

UserRevisionLine numberNew contents of line
screamer 1:e9d3bb2384a9 1 /**
screamer 1:e9d3bb2384a9 2 * @file SensorDataParser.h
screamer 1:e9d3bb2384a9 3 * @brief Parser for Sensor Data Streamer (binary) and Sensor Monitor (cvs) iPhone/Android apps
screamer 1:e9d3bb2384a9 4 * @author Bogdan Marinescu & Mihail Stoyanov
screamer 1:e9d3bb2384a9 5 * @version 1.0
screamer 1:e9d3bb2384a9 6 * @see
screamer 1:e9d3bb2384a9 7 *
screamer 1:e9d3bb2384a9 8 * Copyright (c) 2013
screamer 1:e9d3bb2384a9 9 *
screamer 1:e9d3bb2384a9 10 * Licensed under the Apache License, Version 2.0 (the "License");
screamer 1:e9d3bb2384a9 11 * you may not use this file except in compliance with the License.
screamer 1:e9d3bb2384a9 12 * You may obtain a copy of the License at
screamer 1:e9d3bb2384a9 13 *
screamer 1:e9d3bb2384a9 14 * http://www.apache.org/licenses/LICENSE-2.0
screamer 1:e9d3bb2384a9 15 *
screamer 1:e9d3bb2384a9 16 * Unless required by applicable law or agreed to in writing, software
screamer 1:e9d3bb2384a9 17 * distributed under the License is distributed on an "AS IS" BASIS,
screamer 1:e9d3bb2384a9 18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
screamer 1:e9d3bb2384a9 19 * See the License for the specific language governing permissions and
screamer 1:e9d3bb2384a9 20 * limitations under the License.
screamer 1:e9d3bb2384a9 21 */
screamer 1:e9d3bb2384a9 22
screamer 0:145141a10e18 23
screamer 0:145141a10e18 24 /**
screamer 0:145141a10e18 25 * Maximum number of processed CSV values
screamer 0:145141a10e18 26 */
screamer 0:145141a10e18 27 #define MAX_CSV_VALS 40
screamer 0:145141a10e18 28
screamer 0:145141a10e18 29 /**
screamer 0:145141a10e18 30 * Processed data by parse_sensor_packet()
screamer 0:145141a10e18 31 */
screamer 0:145141a10e18 32 typedef struct {
screamer 0:145141a10e18 33 float ax; /**< Accelerometer X coordinate */
screamer 0:145141a10e18 34 float ay; /**< Accelerometer Y coordinate */
screamer 0:145141a10e18 35 float az; /**< Accelerometer Z coordinate */
screamer 0:145141a10e18 36
screamer 0:145141a10e18 37 float gx; /**< Gyroscope X coordinate */
screamer 0:145141a10e18 38 float gy; /**< Gyroscope Y coordinate */
screamer 0:145141a10e18 39 float gz; /**< Gyroscope Z coordinate */
screamer 0:145141a10e18 40
screamer 0:145141a10e18 41 double tx; /**< Teslameter X coordinate */
screamer 0:145141a10e18 42 double ty; /**< Teslameter Y coordinate */
screamer 0:145141a10e18 43 double tz; /**< Teslameter Z coordinate */
screamer 0:145141a10e18 44
screamer 0:145141a10e18 45 double hm; /**< Magnetic heading */
screamer 0:145141a10e18 46 double ht; /**< True heading */
screamer 0:145141a10e18 47
screamer 0:145141a10e18 48 double latitude; /**< Latitude */
screamer 0:145141a10e18 49 double longitude; /**< Longitude */
screamer 0:145141a10e18 50 double altitude; /**< Altitude */
screamer 0:145141a10e18 51
screamer 0:145141a10e18 52 int proximity; /**< Proximity sensor */
screamer 0:145141a10e18 53
screamer 0:145141a10e18 54 int touch1; /**< Touch point 1 present */
screamer 0:145141a10e18 55 int touch1x; /**< Touch point 1 X coordinate */
screamer 0:145141a10e18 56 int touch1y; /**< Touch point 1 Y coordinate */
screamer 0:145141a10e18 57
screamer 0:145141a10e18 58 int touch2; /**< Touch point 1 present */
screamer 0:145141a10e18 59 int touch2x; /**< Touch point 1 X coordinate */
screamer 0:145141a10e18 60 int touch2y; /**< Touch point 1 Y coordinate */
screamer 0:145141a10e18 61 } SENSOR_DATA;
screamer 0:145141a10e18 62
screamer 0:145141a10e18 63 /**
screamer 1:e9d3bb2384a9 64 * Parses a packet with sensor data.
screamer 1:e9d3bb2384a9 65 *
screamer 0:145141a10e18 66 * Currently supported packet formats:
screamer 0:145141a10e18 67 * - Sensor Data Streamer (binary)
screamer 0:145141a10e18 68 * - Sensor Monitor (csv)
screamer 0:145141a10e18 69 *
screamer 0:145141a10e18 70 * @param buf The packet contents
screamer 0:145141a10e18 71 * @param pd processed data
screamer 0:145141a10e18 72 *
screamer 0:145141a10e18 73 * @return 0 - Invalid packet type
screamer 0:145141a10e18 74 * @return 1 - Sensor Data Streamer packet
screamer 0:145141a10e18 75 * @return 2 - Sensor Monitor packet
screamer 0:145141a10e18 76 */
screamer 0:145141a10e18 77 int parse_sensor_packet(char *buf, SENSOR_DATA *pd);