279 lines
7.1 KiB
C#
279 lines
7.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
|
|
namespace SafeMobileLib.MessageDecoders
|
|
{
|
|
// -------------------------------------------------------------------
|
|
// General
|
|
// -------------------------------------------------------------------
|
|
public class htCell_t
|
|
{
|
|
public string lat, lng, spd,alt; // GPS data
|
|
public DateTime location_time;
|
|
public double radius;
|
|
public string di;
|
|
public DateTime activity_time; // = min(gpstime, arstime)
|
|
public bool triggered;
|
|
|
|
public bool isCSBK;
|
|
public string suid;
|
|
public byte requestID;
|
|
public double d_lat, d_lng;
|
|
public int altitude;
|
|
public int altitude_accuracy;
|
|
public int level_confidence;
|
|
public string seq_ID;
|
|
public Int64 seqID;
|
|
public string logId = "";
|
|
public string heading = "";
|
|
}
|
|
|
|
struct htSMSMessage_t
|
|
{
|
|
public string suid;
|
|
public string message;
|
|
}
|
|
|
|
enum Result_Codes_ENUM
|
|
{
|
|
SUCCESS = 0x0,
|
|
UNSUPPORTED_VERSION = 0x08,
|
|
SYNTAX_ERROR = 0x0A,
|
|
PROTOCOL_ELEMENT_NOT_SUPPORTED = 0x0B,
|
|
PROTOCOL_ELEMENT_VALUE_OUT_OF_RANGE = 0x0D,
|
|
QUERY_INFO_NOT_ATTAINABLE = 0x0F,
|
|
QUERY_INFO_NOT_CURRENTLY_ATTAINABLE = 0x10,
|
|
REPORTING_WILL_STOP = 0x11,
|
|
NO_SUCH_REQUEST = 0x15,
|
|
DUPLICATE_REQUEST_ID = 0x16,
|
|
INSUFFICIENT_GPS_SATELLITES = 0x200,
|
|
BAD_GPS_GEOMETRY = 0x201
|
|
};
|
|
|
|
enum Document_Identifiers_ENUM
|
|
{
|
|
Immediate_Location_Request = 0x04,
|
|
Immediate_Location_Request_NoCDT = 0x05,
|
|
Immediate_Location_Report = 0x06,
|
|
Immediate_Location_Report_NoCDT = 0x07,
|
|
Triggered_Location_Request = 0x08,
|
|
Triggered_Location_Request_NoCDT = 0x09,
|
|
Triggered_Location_Answer = 0x0A,
|
|
Triggered_Location_Answer_NoCDT = 0x0B,
|
|
Triggered_Location_Report = 0x0C,
|
|
Triggered_Location_Report_NoCDT = 0x0D,
|
|
Triggered_Location_Stop_Request = 0x0E,
|
|
Triggered_Location_Stop_Request_NoCDT = 0x0F,
|
|
Triggered_Location_Stop_Answer = 0x10,
|
|
Triggered_Location_Stop_Answer_NoCDT = 0x11,
|
|
Unsolicited_Location_Report = 0x12,
|
|
Unsolicited_Location_Report_NoCDT = 0x13,
|
|
Location_Protocol_Request_NoCDT = 0x14,
|
|
Location_Protocol_Report_NoCDT = 0x15
|
|
};
|
|
// -------------------------------------------------------------------
|
|
// Location Service
|
|
// -------------------------------------------------------------------
|
|
|
|
|
|
enum Common_Element_Tokens_ENUM
|
|
{
|
|
request_id = 0x22,
|
|
request_id1 = 0x23,
|
|
request_id2 = 0x24
|
|
};
|
|
enum Query_Request_Messages_Tokens_ENUM
|
|
{
|
|
interval = 0x31,
|
|
oneshot_trigger = 0x33,
|
|
periodic_trigger = 0x34,
|
|
request_altitude = 0x54,
|
|
request_altitude_acc = 0x55,
|
|
request_altitude_acc1 = 0x56,
|
|
request_direction_hor = 0x57,
|
|
request_hor_acc = 0x5F,
|
|
request_hor_acc1 = 0x60,
|
|
request_lev_conf = 0x61,
|
|
request_protocol_version = 0x3F,
|
|
request_speed_hor = 0x62,
|
|
request_speed_vrt = 0x64,
|
|
require_max_info_age = 0x42,
|
|
require_altitude = 0x66,
|
|
require_altitude_acc = 0x67,
|
|
require_altitude_acc1 = 0x68,
|
|
require_direction_hor = 0x69,
|
|
require_hor_acc = 0x71,
|
|
require_hor_acc1 = 0x72,
|
|
require_lev_conf = 0x73,
|
|
require_speed_hor = 0x74,
|
|
require_speed_vrt = 0x76,
|
|
ret_info = 0x50,
|
|
ret_info1 = 0x51,
|
|
ret_info2 = 0x52,
|
|
ret_info3 = 0x53,
|
|
trg_condition = 0x4A
|
|
};
|
|
|
|
enum Report_Messages_Tokens_ENUM
|
|
{
|
|
circle_2d = 0x51,
|
|
circle_3d = 0x54,
|
|
circle_3d1 = 0x55,
|
|
direction_hor = 0x56,
|
|
info_time = 0x34,
|
|
info_time1 = 0x35,
|
|
lev_conf = 0x65,
|
|
point_2d = 0x66,
|
|
point_3d = 0x69,
|
|
point_3d1 = 0x6A,
|
|
protocol_version = 0x36,
|
|
result = 0x37,
|
|
result1 = 0x38,
|
|
result2 = 0x39,
|
|
speed_hor = 0x6C,
|
|
speed_vrt = 0x70,
|
|
SU_IPv4 = 0x26
|
|
};
|
|
|
|
enum Attribute_Tokens_ENUM
|
|
{
|
|
result_code = 0x22,
|
|
result_code1 = 0x23,
|
|
ret_info_accuracy = 0x50,
|
|
ret_info_accuracy1 = 0x51,
|
|
ret_info_no_req_id = 0x52,
|
|
ret_info_no_req_id1 = 0x53,
|
|
ret_info_time = 0x54,
|
|
ret_info_time1 = 0x55
|
|
};
|
|
|
|
public enum OPCODE_ENUM
|
|
{
|
|
XNL_MASTER_STATUS_BRDCST = 0x0002,
|
|
DEVICE_AUTH_KEY_REQUEST = 0x0004,
|
|
DEVICE_AUTH_KEY_REPLY = 0x0005,
|
|
DEVICE_CONN_REQUEST = 0x0006,
|
|
DEVICE_CONN_REPLY = 0x0007,
|
|
DATA_MSG = 0x000b,
|
|
DATA_MSG_ACK = 0x000c,
|
|
SPKRSTAT = 0xb407 // Speaker State broadcast message
|
|
};
|
|
|
|
public enum MotoTRBOcmd
|
|
{
|
|
SET_REPORT_INTERVAL = 0x01,
|
|
SEND_SMS = 0x02,
|
|
SEND_POLL = 0x03
|
|
};
|
|
|
|
public enum Alert_TYPE
|
|
{
|
|
SPEED = 0x01,
|
|
LANDMARK = 0x02,
|
|
GEOFENCE = 0x03,
|
|
DI = 0x04
|
|
};
|
|
|
|
public class GeoPoint
|
|
{
|
|
public double lat;
|
|
public double lng;
|
|
public int speed;
|
|
}
|
|
|
|
public class MotoTRBOcmdMsg
|
|
{
|
|
public string m_suid;
|
|
public int m_cmd;
|
|
public string m_payload;
|
|
public Int32 m_seqID; //seqID when it was last sent
|
|
public DateTime m_time; //time when it was last sent
|
|
public DateTime m_created = DateTime.Now;
|
|
}
|
|
|
|
public class GWstatus
|
|
{
|
|
public string gw_id;
|
|
public int status;
|
|
public string message;
|
|
}
|
|
|
|
public class OC4Jrfid
|
|
{
|
|
public string suid;
|
|
public string rfid;
|
|
}
|
|
|
|
|
|
public class SMSmsg
|
|
{
|
|
public string suid;
|
|
public string msg;
|
|
public bool conf; //sent confirmation
|
|
public uint DBmsg_id;//message ID from database (for message confirmation)
|
|
public int seq_no;
|
|
public bool req_conf;
|
|
DateTime added;
|
|
public DateTime waitConfSMSList_time;
|
|
|
|
public SMSmsg()
|
|
{
|
|
req_conf = true;
|
|
conf = false;
|
|
added = DateTime.Now;
|
|
}
|
|
}
|
|
|
|
public class POLLmsg
|
|
{
|
|
public int DBid;
|
|
public string suid;
|
|
public DateTime created;
|
|
public DateTime read;
|
|
public DateTime sent;
|
|
public DateTime response;
|
|
public string lat;
|
|
public string lng;
|
|
public string speed;
|
|
public Int32 requestID;
|
|
}
|
|
|
|
public struct header_T
|
|
{
|
|
public bool ext, ext2, ack, cntl;
|
|
public byte pdu_type;
|
|
public byte seq_no;
|
|
public byte encoding;
|
|
public byte header;
|
|
public string message;
|
|
}
|
|
|
|
|
|
|
|
public class ArsMSG
|
|
{
|
|
public string suid;
|
|
public string msg;
|
|
|
|
public string imei;
|
|
public string gatewayID;
|
|
}
|
|
|
|
public class gpsMSG
|
|
{
|
|
public byte[] data = null;
|
|
}
|
|
|
|
public class SUinfo
|
|
{
|
|
public int DBid;
|
|
public string suid;
|
|
public bool ARSon = false;
|
|
public int repInterval;
|
|
public DateTime arsCheckTime;
|
|
public DateTime GPSlasttime;
|
|
public List<Alert> alertList;
|
|
}
|
|
}
|