Go to the documentation of this file.
62 port_(
"/dev/ttyUSB0"),
144 printf(
"Debug statements enabled.\n");
149 printf(
"Unable to intialize packet storage. Error code: %d", errorCode);
160 printf(
"Unable to create packet periods packet properly.");
171 printf(
"Calculated required minimum baud rate: %d\n", minBaudRequired);
174 if (minBaudRequired < _initOptions.
baudRate)
206 strncpy(portArr,
port_.c_str(), 4096);
211 printf(
"Unable to establish connection.\n");
225 printf(
"Sending packet_periods.\n");
230 requestPacket =
nullptr;
237 printf(
"Sending filter options packet.");
241 requestPacket =
nullptr;
242 if (packetError != 0)
252 printf(
"Initializing decoder.\n");
280 int unexpectedPackets = 0;
300 printf(
"*********************************\n"
301 "Acknowledging packet from packet id: %d\n Result of packet %d\n"
302 "********************************\n",
309 printf(
"Unable to decode acknowledge packet properly.\n");
323 if (
debug_) printf(
"Recieved %d unexpected packets during transmission.\n", unexpectedPackets);
382 printf(
"Unable to send packet request.\n");
#define an_packet_size(packet)
static int CreatePacketPeriodsPacket(KvhPacketRequest &_packetsRequested, packet_periods_packet_t &_packetPeriods)
bool connected_
True if we're connected to the localization unit.
int decode_acknowledge_packet(acknowledge_packet_t *acknowledge_packet, an_packet_t *an_packet)
bool reversingDetectionEnabled
int RequestPacket(packet_id_e)
This function is used to request packets that you only want once or that cannot be requested through ...
#define an_decoder_size(an_decoder)
int PollComport(unsigned char *, int)
std::vector< std::pair< packet_id_e, uint16_t > > KvhPacketRequest
bool atmosphericAltitudeEnabled
int SendPacket(an_packet_t *)
Wrapper function for more easily sending an packets via serial port.
bool PacketIsUpdated(packet_id_e)
an_packet_t * encode_filter_options_packet(filter_options_packet_t *filter_options_packet)
void an_decoder_initialise(an_decoder_t *an_decoder)
bool velocityHeadingEnabled
an_packet_t * encode_request_packet(uint8_t requested_packet_id)
#define an_decoder_pointer(an_decoder)
int Init(KvhPacketRequest &)
Correctly sets up a KvhPacketMap for the requested packets.
KvhInitOptions defaultOptions_
If no init options are passed in, use this as the default.
bool debug_
Set true to print debug statements.
KvhPacketStorage packetStorage_
Class responsible for handling packets and ensuring consistency.
an_decoder_t anDecoder_
Decoder for decoding incoming AN encoded packets.
int OpenComport(char *, int)
an_packet_t * encode_packet_periods_packet(packet_periods_packet_t *packet_periods_packet)
int AddPacket(packet_id_e)
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)
static int CalculateRequiredBaud(KvhPacketRequest &)
~Driver()
Destructor. Will automatically cleanup the driver.
static int CreateOdometerOptionsPacket(odometer_configuration_packet_t &, bool _permanent=true, float _odom_pulse_to_meters=0.000583, bool _odom_auto_cal=true)
#define an_packet_pointer(packet)
uint8_t filterVehicleType
int AddPacket(packet_id_e)
std::vector< packet_id_e > packetRequests_
#define an_decoder_increment(an_decoder, bytes_received)
bool PacketIsUpdated(packet_id_e)
Use this function to determine if new packet data has arrived since the last time you checked.
void an_packet_free(an_packet_t **an_packet)
Driver(bool _debug=false)
Initializes connected status, port to use, and if debug printing is turned on.
int SendBuf(unsigned char *, int)
int DecodePacket(an_packet_t *)
an_packet_t * an_packet_decode(an_decoder_t *an_decoder)
int Once()
Do a single data read from the device.
KVH Geo Fog 3D driver class header.
int SetPacketUpdated(packet_id_e, bool)
int Cleanup()
Cleanup and close our connections.
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...
bool motionAnalysisEnabled
int Init(const std::string &_port, KvhPacketRequest &_packetsRequested)
uint8_t acknowledge_result
KvhDeviceConfig deviceConfig_
Class responsible for configuring kvh geo fog.
std::string port_
Port to connect to the kvh through. Ex. "/dev/ttyUSB0".
void an_packet_encode(an_packet_t *an_packet)