62 port_(
"/dev/ttyUSB0"),
144 printf(
"Debug statements enabled.\n");
149 printf(
"Unable to intialize packet storage. Error code: %d", errorCode);
166 printf(
"Calculated required minimum baud rate: %d\n", minBaudRequired);
169 if (minBaudRequired < _initOptions.
baudRate)
192 strncpy(portArr,
port_.c_str(), 4096);
197 printf(
"Unable to establish connection.\n");
211 printf(
"Sending packet_periods.\n");
216 requestPacket =
nullptr;
223 printf(
"Sending filter options packet.");
227 requestPacket =
nullptr;
228 if (packetError != 0)
238 printf(
"Initializing decoder.\n");
266 int unexpectedPackets = 0;
286 printf(
"*********************************\n" 287 "Acknowledging packet from packet id: %d\n Result of packet %d\n" 288 "********************************\n",
295 printf(
"Unable to decode acknowledge packet properly.\n");
309 if (
debug_) printf(
"Recieved %d unexpected packets during transmission.", unexpectedPackets);
KVH Geo Fog 3D driver class header.
std::string port_
Port to connect to the kvh through. Ex. "/dev/ttyUSB0".
an_packet_t * encode_filter_options_packet(filter_options_packet_t *filter_options_packet)
void an_decoder_initialise(an_decoder_t *an_decoder)
#define an_decoder_increment(an_decoder, bytes_received)
static int CreateFilterOptionsPacket(filter_options_packet_t &, bool _permanent=true, uint8_t _vehicle_type=vehicle_type_car, bool _internal_gnss_enabled=true, bool _atmospheric_altitude_enabled=true, bool _velocity_heading_enabled=true, bool _reversing_detection_enabled=true, bool _motion_analysis_enabled=true)
an_decoder_t anDecoder_
Decoder for decoding incoming AN encoded packets.
int Once()
Do a single data read from the device.
KvhInitOptions defaultOptions_
If no init options are passed in, use this as the default.
int OpenComport(char *, int)
static int CalculateRequiredBaud(KvhPacketRequest &)
an_packet_t * an_packet_decode(an_decoder_t *an_decoder)
bool connected_
True if we're connected to the localization unit.
#define an_packet_size(packet)
std::vector< packet_id_e > packetRequests_
an_packet_t * encode_packet_periods_packet(packet_periods_packet_t *packet_periods_packet)
~Driver()
Destructor. Will automatically cleanup the driver.
bool velocityHeadingEnabled
bool atmosphericAltitudeEnabled
int PollComport(unsigned char *, int)
std::vector< std::pair< packet_id_e, uint16_t > > KvhPacketRequest
#define an_decoder_size(an_decoder)
bool motionAnalysisEnabled
int Init(KvhPacketRequest &)
Correctly sets up a KvhPacketMap for the requested packets.
int Init(const std::string &_port, KvhPacketRequest &_packetsRequested)
Driver(bool _debug=false)
Initializes connected status, port to use, and if debug printing is turned on.
bool PacketIsUpdated(packet_id_e)
Use this function to determine if new packet data has arrived since the last time you checked...
int SetPacketUpdated(packet_id_e, bool)
bool PacketIsUpdated(packet_id_e)
bool debug_
Set true to print debug statements.
KvhPacketStorage packetStorage_
Class responsible for handling packets and ensuring consistency.
int SetPacketUpdated(packet_id_e, bool)
Use this function to set that the packet has been updated (though the driver will usually do that its...
uint8_t filterVehicleType
static int CreatePacketPeriodsPacket(KvhPacketRequest &_packetsRequested, packet_periods_packet_t &_packetPeriods)
void an_packet_encode(an_packet_t *an_packet)
#define an_packet_pointer(packet)
bool reversingDetectionEnabled
int DecodePacket(an_packet_t *)
int SendPacket(an_packet_t *)
Wrapper function for more easily sending an packets via serial port.
void an_packet_free(an_packet_t **an_packet)
int SendBuf(unsigned char *, int)
int Cleanup()
Cleanup and close our connections.
uint8_t acknowledge_result
#define an_decoder_pointer(an_decoder)
KvhDeviceConfig deviceConfig_
Class responsible for configuring kvh geo fog.
int decode_acknowledge_packet(acknowledge_packet_t *acknowledge_packet, an_packet_t *an_packet)