binary_header.h
Go to the documentation of this file.
00001 // *****************************************************************************
00002 //
00003 // Copyright (c) 2017, Southwest Research Institute® (SwRI®)
00004 // All rights reserved.
00005 //
00006 // Redistribution and use in source and binary forms, with or without
00007 // modification, are permitted provided that the following conditions are met:
00008 //     * Redistributions of source code must retain the above copyright
00009 //       notice, this list of conditions and the following disclaimer.
00010 //     * Redistributions in binary form must reproduce the above copyright
00011 //       notice, this list of conditions and the following disclaimer in the
00012 //       documentation and/or other materials provided with the distribution.
00013 //     * Neither the name of Southwest Research Institute® (SwRI®) nor the
00014 //       names of its contributors may be used to endorse or promote products
00015 //       derived from this software without specific prior written permission.
00016 //
00017 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00018 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00019 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00020 // ARE DISCLAIMED. IN NO EVENT SHALL SOUTHWEST RESEARCH INSTITUTE BE LIABLE FOR ANY
00021 // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00022 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00023 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00024 // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00025 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00026 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00027 //
00028 // *****************************************************************************
00029 
00030 #ifndef NOVATEL_GPS_DRIVER_BINARY_HEADER_H
00031 #define NOVATEL_GPS_DRIVER_BINARY_HEADER_H
00032 
00033 #include <stdint.h>
00034 
00035 #include <novatel_gps_driver/parsers/parsing_utils.h>
00036 
00037 namespace novatel_gps_driver
00038 {
00042   struct BinaryHeader
00043   {
00044     BinaryHeader() :
00045         sync0_(0xAA),
00046         sync1_(0x44),
00047         sync2_(0x12)
00048     {}
00049 
00050     uint8_t sync0_;
00051     uint8_t sync1_;
00052     uint8_t sync2_;
00053     uint8_t header_length_;
00054     uint16_t message_id_;
00055     int8_t message_type_;
00056     uint8_t port_address_;
00057     uint16_t message_length_;
00058     uint16_t sequence_;
00059     uint8_t idle_time_;
00060     uint8_t time_status_;
00061     uint16_t week_;
00062     uint32_t gps_ms_;
00063     uint32_t receiver_status_;
00064     uint16_t reserved_;
00065     uint16_t receiver_sw_version_;
00066 
00067     void ParseHeader(const uint8_t* data)
00068     {
00069       sync0_ = data[0];
00070       sync1_ = data[1];
00071       sync2_ = data[2];
00072       header_length_ = data[3];
00073       message_id_ = ParseUInt16(&data[4]);
00074       message_type_ = data[6];
00075       port_address_ = data[7];
00076       message_length_ = ParseUInt16(&data[8]);
00077       sequence_ = ParseUInt16(&data[10]);
00078       idle_time_ = data[12];
00079       time_status_ = data[13];
00080       week_ = ParseUInt16(&data[14]);
00081       gps_ms_ = ParseUInt32(&data[16]);
00082       receiver_status_ = ParseUInt32(&data[20]);
00083       receiver_sw_version_ = ParseUInt16(&data[26]);
00084     }
00085   };
00086 }
00087 #endif //NOVATEL_GPS_DRIVER_BINARY_HEADER_H


novatel_gps_driver
Author(s):
autogenerated on Wed Jul 3 2019 19:40:37