Mihail Stoyanov / SensorDataParser
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers SensorDataParser.h Source File

SensorDataParser.h

Go to the documentation of this file.
00001 /**
00002  * @file    SensorDataParser.h
00003  * @brief   Parser for Sensor Data Streamer (binary) and Sensor Monitor (cvs) iPhone/Android apps
00004  * @author  Bogdan Marinescu & Mihail Stoyanov
00005  * @version 1.0
00006  * @see     
00007  *
00008  * Copyright (c) 2013
00009  *
00010  * Licensed under the Apache License, Version 2.0 (the "License");
00011  * you may not use this file except in compliance with the License.
00012  * You may obtain a copy of the License at
00013  *
00014  *     http://www.apache.org/licenses/LICENSE-2.0
00015  *
00016  * Unless required by applicable law or agreed to in writing, software
00017  * distributed under the License is distributed on an "AS IS" BASIS,
00018  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00019  * See the License for the specific language governing permissions and
00020  * limitations under the License.
00021  */
00022 
00023 
00024 /**
00025  * Maximum number of processed CSV values
00026  */
00027 #define MAX_CSV_VALS        40
00028 
00029 /**
00030  * Processed data by parse_sensor_packet()
00031  */
00032 typedef struct {
00033     float ax;       /**< Accelerometer X coordinate */
00034     float ay;       /**< Accelerometer Y coordinate */
00035     float az;       /**< Accelerometer Z coordinate */
00036 
00037     float gx;       /**< Gyroscope X coordinate */
00038     float gy;       /**< Gyroscope Y coordinate */
00039     float gz;       /**< Gyroscope Z coordinate */
00040 
00041     double tx;      /**< Teslameter X coordinate */
00042     double ty;      /**< Teslameter Y coordinate */
00043     double tz;      /**< Teslameter Z coordinate */
00044     
00045     double hm;      /**< Magnetic heading */
00046     double ht;      /**< True heading */
00047 
00048     double latitude;    /**< Latitude */
00049     double longitude;   /**< Longitude */
00050     double altitude;    /**< Altitude */
00051     
00052     int proximity;  /**< Proximity sensor */
00053     
00054     int touch1;     /**< Touch point 1 present */
00055     int touch1x;    /**< Touch point 1 X coordinate */
00056     int touch1y;    /**< Touch point 1 Y coordinate */
00057 
00058     int touch2;     /**< Touch point 1 present */
00059     int touch2x;    /**< Touch point 1 X coordinate */
00060     int touch2y;    /**< Touch point 1 Y coordinate */
00061 } SENSOR_DATA;
00062 
00063 /**
00064  * Parses a packet with sensor data.
00065  *
00066  * Currently supported packet formats:
00067  * - Sensor Data Streamer (binary)
00068  * - Sensor Monitor (csv)
00069  *
00070  * @param buf The packet contents
00071  * @param pd processed data
00072  *
00073  * @return 0 - Invalid packet type
00074  * @return 1 - Sensor Data Streamer packet
00075  * @return 2 - Sensor Monitor packet
00076  */
00077 int parse_sensor_packet(char *buf, SENSOR_DATA *pd);