10 #ifndef FmiApplicationLayer_H 11 #define FmiApplicationLayer_H 23 #if( FMI_SUPPORT_A602 ) 27 #if( FMI_SUPPORT_A603 ) 32 #if( FMI_SUPPORT_A603 || FMI_SUPPORT_A617 ) 36 #if( FMI_SUPPORT_A604 ) 40 #if( FMI_SUPPORT_A606 ) 44 #if( FMI_SUPPORT_A607 ) 49 #if( FMI_SUPPORT_A610 ) 53 #if( FMI_SUPPORT_A617 ) 79 #if( FMI_SUPPORT_A604 ) 123 #if( FMI_SUPPORT_LEGACY ) 124 void sendLegacyProductRequest();
133 void sendLegacyTextMessage
139 #if( FMI_SUPPORT_A602 ) 156 uint16 *aFeatureCodes = NULL,
157 uint8 aFeatureCount = 0
164 uint8 aFmiPayloadSize
170 uint8 const *
const aFmiPayload,
171 uint8 const aFmiPayloadSize
177 #if( FMI_SUPPORT_A603 ) 225 #if( FMI_SUPPORT_A604 ) 228 const char * aMessageText,
234 const char * aMessageText,
236 uint8 aResponseCount,
237 const uint32 * aResponseList,
244 uint8 aVersionLength,
255 CString aResponseText
288 CString aDriverStatusText
323 #if( FMI_SUPPORT_A605 ) 327 #if (FMI_SUPPORT_A606) 334 #if( FMI_SUPPORT_A607 ) 385 #if( FMI_SUPPORT_A607 ) 392 #if( FMI_SUPPORT_A608 ) 403 #if( FMI_SUPPORT_A611 ) 406 const char * aMessageText,
412 #if( FMI_SUPPORT_A616 ) 501 #if( FMI_SUPPORT_A602 ) 509 #if( FMI_SUPPORT_A603 ) 565 #if( FMI_SUPPORT_A604 ) 632 #if( FMI_SUPPORT_A605 ) 638 #if( FMI_SUPPORT_A607 ) 655 #if( FMI_SUPPORT_A609 ) 660 #if( FMI_SUPPORT_A610 ) 686 #if( FMI_SUPPORT_A615 ) 694 #if( FMI_SUPPORT_A623 ) 703 cdt_id_type
const aCdtPacketId,
704 uint8 const *
const aCdtPayload,
705 uint8 const aCdtPayloadSize,
706 bool const aSendNow =
false 712 #if( FMI_SUPPORT_A610 ) 739 #define SAVE_AOBRD_LOG "aobrd_compressed.dat" 743 #define SAVE_CONVERTED_AOBRD_LOG "aobrd_event_log.%s.csv" 745 #define SAVE_RECEIVED_AOBRD_LOG "aobrd_from_client.dat" 748 #if( FMI_SUPPORT_A615 ) 749 #define SAVE_RECEIVED_IFTA_FILE "received_ifta.dat.gz" 759 const char * driverId
774 #if( FMI_SUPPORT_A602 ) 778 uint8 const *
const aFmiPayload,
779 uint8 const aFmiPayloadSize,
780 bool const aSendNow =
false 783 #if( FMI_SUPPORT_A603 ) 792 #if( FMI_SUPPORT_A604 ) 796 uint8 aDriverIndex = 0
804 #if( FMI_SUPPORT_A607 ) 808 #if( FMI_SUPPORT_A611 ) 811 const char * aMessageText,
817 #if( FMI_SUPPORT_A604 ) 860 #if( FMI_SUPPORT_A610 ) 886 #if( FMI_SUPPORT_A611 ) 897 #if( FMI_SUPPORT_A612 ) 898 #define SAVE_RECEIVED_FORM_SUBMIT "tmp_submitted_form.xml" 903 #if( FMI_SUPPORT_A616 ) file_info_data_type mCurrentReceiptFile
Current file being received.
void sendAOBRDDriverDownloadResponseV2(const char *driverId)
Send an AOBRD driver profile V2 to the device per request from device.
void sendAutoArrival(uint32 aArrivalTime, uint32 aArrivalDistance)
Send a request to update the auto-arrival preferences.
char mEtaTime[13]
String containing the ETA time from the client, or "invalid".
uint8 mCannedResponseMessageType
The message_type for the server to client canned text message.
void sendA607DriverIdRequest(uint8 aDriverIndex)
Ask the client for the current Driver ID.
#define INVALID16
Placeholder for an invalid 16-bit value.
void resetSavedStops()
Clear the stop list on the server.
void sendProductRequest()
Send an FMI Product ID request.
bool mUsePasswords
If true, driver password support is enabled.
int mAOBRDCurrentShipmentTxIndex
Iterator for shipments being sent to device.
void calculate2DVelocity(float32 aNorthVelocity, float32 aEastVelocity)
Calculate and format a 2D velocity given the north and east components.
void sendAOBRDDriverProfileV2(const AobrdDriverItem &driver)
Push an AOBRD driver profile V2 to the device.
#define TEXT_MSG_BUFFER_MAX_SIZE
The maximum size of any text message, in bytes.
void beginA611LongTextMessage(const char *aMessageText, const MessageId &aMessageId, uint8 aMessageType)
Send the first packet of an A611 server to client long text message.
void sendA607DriverStatusRequest(uint8 aDriverIndex)
Ask the client for the current Driver Status.
uint16 fmi_id_type
Fleet Management packet ID (first two bytes of payload when Garmin packet ID == ID_FMI_PACKET) ...
void sendUnitIdRequest()
Request the Unit ID (ESN) from the client.
uint8 mLongTextMessagePayloadSize[10]
Indicates the lengths of the long text message packets.
void txFmi(fmi_id_type const aFmiPacketId, uint8 const *const aFmiPayload, uint8 const aFmiPayloadSize, bool const aSendNow=false)
Transmit FMI packet (packet ID = ID_FMI_BYTE)
char mPvtLongitude[14]
Longitude in degrees from the last PVT packet, as an ASCII null-terminated string.
sint16 mClientSoftwareVersion
Raw software version reported by the client.
int mAOBRDCurrentAnnotationTxIndex
Iterator for annotations being sent to device.
void endFileReceive()
Save received file chunk.
uint32 mFileTransferBytesDone
Number of bytes of the file that have been transferred so far.
void sendDriverIdRequest()
Ask the client for the current Driver ID.
char mSentDriverId[50]
The last driver ID that was sent to the client.
FileBackedMap< DriverLoginItem > mDriverLogins
Map of allowed driver IDs and passwords.
bool sendCannedResponseTextMessage(const char *aMessageText, const MessageId &aMessageId, uint8 aResponseCount, const uint32 *aResponseList, uint8 aMessageType)
Initiate the canned response text message protocol.
transfer_state
Enum to track file transfer status.
char mDriverStatus[FMI_DRIVER_COUNT][50]
Last driver status received from the client.
void startFileReceive(const file_info_data_type &file_size)
Save received file chunk.
uint8 id_type
Garmin packet ID.
char mEtaLatitude[14]
String representing the latitude in decimal degrees (and N or S)
void sendStopMoveRequest(uint16 aMoveToIndex, uint16 aMoveFromIndex)
Send a stop move request.
void sendA607DriverIdUpdate(char *aDriverId, uint8 aIndex)
Send an A607 Driver ID Update to the client.
FileBackedMap< ClientListItem > mCannedResponses
Map of canned response IDs to names.
CTime mLastClientPingTime
Last time when a client to server ping was received.
void sendNextAOBRDShipment(char *driver_id)
Send next AOBRD shipment to device.
void sendFmiPacket(uint16 aFmiPacketId, uint8 *aFmiPayload, uint8 aFmiPayloadSize)
Send an arbitrary FMI packet.
uint8 mFileVersionLength
Number of significant bytes in mFileVersion.
uint32 mActiveStopId
Unique ID of the active stop.
Data type for File Data Packet ID.
CString mAOBRDAnnotationDriverId
Driver ID for annotations being sent to device.
bool mLongTextMessageInProgress
Indicates whether a long text message is in progress.
void sendMessageThrottlingUpdate(uint16 aPacketId, uint16 aNewState)
Sends an update to the client to tell it whether to enable or disable a protocol. ...
char mEtaDistance[13]
Null-terminated ASCII string containing the distance to the current destination, including units...
void sendDriverIdUpdate(char *aDriverId)
Send a Driver ID Update to the client.
void sendCreateWaypointCat(uint8 aCatId, CString &aCatName)
Create waypoint category.
void sendEnable(uint16 *aFeatureCodes=NULL, uint8 aFeatureCount=0)
Transmit an FMI Enable packet, and clear any error state.
#define PROTOCOL_SIZE
Size of the formatted "supported protocols" string.
void sendA602TextMessage(fmi_id_type aFmiPacketId, char *aMessageText, const MessageId &aMessageId)
Send a server to client text message, for all A602 FMI protocols.
void sendDeleteCannedMessageRequest(uint32 aMessageId)
Send a request to the client to delete a canned message.
bool sendA611LongTextMessage(const char *aMessageText, const MessageId &aMessageId, uint8 aMessageType)
Send an A611 server to client long text message.
FileBackedMap< StopListItem > mA603Stops
Map of unique ID to stop details for all A603 stops on the client.
codepage_type
The code page used for encoding of text fields sent to or received from the client.
void sendTextMessageStatusRequest(const MessageId &aMessageId)
Ask the server for the aStopStatus of a text message.
bool mRefreshingCannedResponses
If TRUE, FmiApplicationLayer is handling a request to refresh the canned response list...
void sendAOBRDOdometerValue(uint32 aOdometer)
Send AOBRD Odometer value to device.
virtual bool rx(const Packet *aPacket)
Handle a packet received from the client.
void sendWaypoint(uint16 aUniqueId, double aLat, double aLon, uint16 aSymbol, CString &aName, uint16 aCat, CString &aComment)
Send a waypoint.
bool mStopFileTransfer
Flag to indicate that the user wants to stop the file transfer.
id_type mFreeformFmiPacketId
Defaults to ID_FMI_PACKET unless overridden on command line.
void sendA602Stop(double aLatitude, double aLongitude, char *aStopName)
Initiates the A602 stop protocol.
uint32 mFileTransferSize
Total number of bytes in the file being transferred.
FileBackedMap< InboxListItem > mSentCannedResponseMessages
List of message IDs for canned response text messages.
CTime mLastServerPingTime
Last time when a server to client ping was received.
FileBackedMap< AobrdDriverItem > mAOBRDDrivers
Map of allowed driver IDs and passwords.
char mClientUnitId[11]
Null-terminated ASCII string containing the Unit ID (ESN) of the client.
void removeStopByIndex(uint16 aDeletedStopIndex)
Remove a deleted stop.
signed short int sint16
16-bit signed integer
void continueFileReceive(uint32 offset, uint8 length, uint8 const *data)
Save received file chunk.
void sendEtaRequest()
Send a request for ETA data.
void sendDeleteDriverStatusListItem(uint32 aDriverStatusId)
Initiate the Delete Driver Status List Item protocol.
void sendSetSpeedLimitAlerts(uint8 aMode, uint8 aTimeOver, uint8 aTimeUnder, boolean aAlertUser, float aThreshold)
Set FMI speed limit alerts.
char mPvtDate[11]
Date from the last PVT packet, as an ASCII null-terminated string of the form MM/DD/YYYY.
bool mActiveRoute
If TRUE, the client has a stop active.
message_throttling_data_type mThrottledProtocols[60]
Response from the last Message Throttling Query Protocol.
codepage_type mClientCodepage
Code page used for encoding of text fields when communicating with the client.
char mPvtEastWestVelocity[15]
East-west velocity in meters per second from the last PVT packet, as an ASCII null-terminated string...
FmiApplicationLayer(id_type freeformFmiPacketId)
Constructor.
int mAOBRDStopShipmentTxIndex
Iterator end for shipments being sent to device.
float float32
32-bit IEEE-format floating point data. (1 sign bit, 8 exponent bits, and 23 mantissa bits) ...
char mProtocols[PROTOCOL_SIZE]
Null-terminated ASCII string containing the protocols supported by the client.
bool mUseMultipleDrivers
If true, multiple driver support is enabled.
char mPvtTime[13]
Time from the last PVT packet.
void sendStopStatusRequest(uint32 aStopId, stop_status_status_type aStopStatus, uint16 aMoveToIndex=INVALID16)
Initiate the Stop Status protocol to update an A603 stop.
int mServerPingCount
Number of server-to-client pings sent; can be reset by the user.
char mHorizontalVelocity[15]
2-D velocity in the horizontal plane in meters per second from the last PVT packet, as an ASCII null-terminated string
void sendUserInterfaceText(uint32 aElementId, char *aText)
Request that the text of a particular user interface text element be changed.
#define FMI_DRIVER_COUNT
Number of supported drivers.
void sendFreeformFmiPacket(fmi_id_type const aFmiPacketId, uint8 const *const aFmiPayload, uint8 const aFmiPayloadSize)
Data type for Long Text Message Request Packet ID (0X0055) from server to client. ...
Serial communication controller for Garmin and FMI packets.
void txCommand(command_type const aCommandId)
Transmit Garmin command packet (packet ID = ID_COMMAND_BYTE)
bool mRefreshingCannedMessages
If TRUE, FmiApplicationLayer is handling a request to refresh the canned message list.
int mAOBRDStopAnnotationTxIndex
Iterator end for annotations being sent to device.
void sendCannedMessage(uint32 aMessageId, CString aMessageText)
Transmit a new or updated canned message to the client.
char mDriverId[FMI_DRIVER_COUNT][50]
Last driver ID received from the client.
bool mStopListInitialized
If TRUE, the stop list has been initialized.
void sendDeleteCannedResponseRequest(uint32 aResponseId)
Send a request to the client to delete a canned response.
#define FMI_SUPPORT_A602
If true, app was build with support for A602 protocols.
uint32 getNextStopId()
Find an available stop ID.
void sendNextAOBRDAnnotation(char *driver_id)
Send next AOBRD annotation to device.
uint8 mFileVersion[16]
file version (FMI_GPI_FILE_INFORMATION)
uint8 mBaudRateSyncRateType
Mark which baud rate is currently being synced.
uint32 mFileSize
file size (FMI_GPI_FILE_INFORMATION)
FileBackedMap< ClientListItem > mDriverStatuses
Map of driver status IDs to names.
unsigned short int uint16
16-bit unsigned integer
void sendDriverStatusListItem(uint32 aDriverStatusId, CString aDriverStatusText)
Initiate the Set Driver Status List Item protocol.
void rebootDevice()
Send a command to the attached device to reboot it.
Abstract base class for a packet of data.
char mCannedResponseMessageBody[TEXT_MSG_BUFFER_MAX_SIZE]
The message text for the server to client canned text message.
char mPVTFixType[9]
GPS fix type from the last PVT packet, interpreted as an null-terminated ASCII string.
void resetCannedResponseMessages()
Clear the canned response text messages on the server.
CString mAOBRDShipmentDriverId
Driver ID for shipments being sent to device.
void sendEnablePvtCommand(bool aEnable)
Send an Enable PVT or Disable PVT command.
void sendDeleteWaypointCat(uint16 aCatIdx)
Delete waypoint category.
void resetCannedMessages()
Clear the canned messages on the server.
void sendA603Stop(double aLatitude, double aLongitude, char *aStopName, uint32 aStopId)
Initiates the A603 stop protocol.
void sendDriverStatusRequest()
Asks the client for the current driver status.
bool mEnablePending
If true, the FMI Enable protocol is in progress.
Data type for the Message Throttling Command Packet ID and Message Throttling Response Packet ID...
void sendDriverStatusUpdate(uint32 aDriverStatusId)
Initiate the Driver Status Update protocol.
Data structure to holds an AOBRD driver info. Used by the FmiApplicationLayer to validate logins when...
void clearError()
Clear any communication error.
Data type for the File Transfer Start Packet ID.
transfer_state mFileTransferState
State of the current file transfer (in progress, completed, etc.)
const char * getReceiveFilename(uint8 file_type) const
Determine which filename to store a received file under.
virtual void onAck(const Packet *aPacket)
Callback when a packet is ACKed by the client.
bool mUseAOBRD
If true, allow AOBRD driver provisioning.
int mClientPingCount
Number of client-to-server pings received; can be reset by the user.
void sendAOBRDDriverProfile(const AobrdDriverItem &driver)
Send an AOBRD driver profile to the device.
char mPvtNorthSouthVelocity[15]
North-south velocity in meters per second from the last PVT packet, as an ASCII null-terminated strin...
virtual ~FmiApplicationLayer()
Destructor.
uint16 stop_status_status_type
Enumeration for Stop Status protocol.
FileBackedMap< ClientListItem > mCategories
Map of waypoint category IDs to names.
void sendDeleteWaypoint(uint16 aUniqueId)
Delete a waypoint.
bool mRefreshingDriverStatusList
If TRUE, FmiApplicationLayer is handling a request to refresh the driver status list.
unsigned char uint8
8-bit unsigned integer
void sendMessageDeleteRequest(const MessageId &aMessageId)
Ask the server to delete a text message.
void sendCannedResponse(uint32 aResponseId, CString aResponseText)
Transmit a new or updated canned response to the client.
void resetDriverStatusList()
Clear the driver statuses on the server.
char mEtaLongitude[14]
String representing the longitude in decimal degrees (and E or W)
char mPvtUpDownVelocity[15]
Up-down velocity in meters per second from the last PVT packet, as an ASCII null-terminated string...
void sendEtaModeRequest(FMI_eta_mode_type aModeType)
Send an ETA mode request.
void sendFile(char *aFilename, uint8 aVersionLength, uint8 *aVersion, uint8 aFileType, BOOL gzipIt=FALSE)
Start a file transfer protocol.
void sendStopSortRequest()
Sends a sort stop list request to the client.
Abstract base class for the application layer in the OSI model.
uint32 mSentDriverStatus
The last driver status that was sent to the client.
FileBackedMap< ClientListItem > mCannedMessages
Map of canned message IDs to names.
uint16 mClientProductId
Numeric product ID reported by the client.
void sendDataDeletionRequest(del_data aDataType)
Send a data deletion request and remove the appropriate data from the server.
void resetWaypoints()
Clear the waypoint and waypoint category lists on the server.
void removeStopById(uint32 aStopId)
Find the index of the deleted stop corresponding to a stop ID.
std::vector< uint32 > mStopIndexInList
Vector relating the stop list to unique_ids.
char mPvtLatitude[14]
Latitude in degrees from the last PVT packet, as an ASCII null-terminated string. ...
void stopFileTransfer()
Stop a file transfer protocol.
file_packet_data_type mLastFilePacketSent
The last file packet that was sent.
void sendGpiFileInfoRequest()
Send a GPI File Information Request to the client.
uint16 command_type
Garmin command ID (payload when packet ID == ID_COMMAND_BYTE)
void sendPing()
Send a ping packet to the client.
void sendA607DriverStatusUpdate(uint32 aDriverStatusId, uint8 aIndex)
Initiate the A607 Driver Status Update protocol.
del_data
Enumeration for Data Deletion protocol.
void sendA604TextMessage(const char *aMessageText, const MessageId &aMessageId, uint8 aMessageType=A604_MESSAGE_TYPE_NORMAL)
Send an A604 server to client open text message.
unsigned long int uint32
32-bit unsigned integer
boolean procDriverStatusUpdate(uint32 aDriverStatusId, uint8 aDriverIndex=0)
Process a Driver Status Update from the client.
FileBackedMap< WaypointListItem > mWaypoints
Map of waypoint IDs to names.
char mPvtAltitude[13]
Altitude in meters from the last PVT packet, as an ASCII null-terminated string.
long_text_msg_data_type mLongTextMessage[10]
Contains the data for the most recent long text message.
void sendFmiSafeModeSpeed(float speed)
Set FMI safe mode speed.
char mFilePath[200]
Path to the file that is being transferred to the client.
Encapsulation of a message ID.
uint8 mCurrentSendFileType
Current file type for file being sent.
void sendMessageThrottlingQuery()
Initiate the Message Throttling Query protocol.
uint8 mEtaMode
Unique ID of the active stop.
void sendAOBRDDriverLogoff(const AobrdDriverItem &driver)
Send an AOBRD driver logoff command to the device.
void resetCannedResponses()
Clear the canned responses on the server.