4 #include "../../gsmstate.h" 6 #ifdef GSM_ENABLE_MBUS2 12 #include "../../gsmcomon.h" 16 unsigned const char *MsgBuffer,
20 unsigned char *buffer=NULL, checksum = 0;
22 int i=0, sent=0, length=0;
26 buffer = (
unsigned char *)malloc(MsgLength + 8);
32 buffer[4] = MsgLength / 256;
33 buffer[5] = MsgLength % 256;
35 memcpy(buffer + 6, MsgBuffer, MsgLength);
36 length = 6 + MsgLength;
51 for (i = 0; i < length + 1; i++) {
52 checksum ^= buffer[i];
54 }
while (checksum == 0x1f);
57 buffer[length++] = checksum;
74 unsigned char sequence)
77 unsigned char buffer[6]={0};
78 int i=0,length=0,write_data=0;
86 length=strlen(buffer);
89 for (i = 0; i < length; i++) {
90 buffer[5] ^= buffer[i];
97 if (write_data!=length) {
void GSM_DumpMessageBinary(GSM_StateMachine *s, unsigned const char *message, size_t messagesize, int type)
GSM_Error(* DeviceSetDtrRts)(GSM_StateMachine *s, gboolean dtr, gboolean rts)
struct GSM_Protocol::@1 Data
GSM_Error(* DeviceSetParity)(GSM_StateMachine *s, gboolean parity)
int(* WriteDevice)(GSM_StateMachine *s, const void *buf, size_t nbytes)
unsigned char Destination
int smprintf_level(GSM_StateMachine *s, GSM_DebugSeverity severity, const char *format,...)
#define MBUS2_DEVICE_PHONE
unsigned char CheckSum[2]
GSM_Device_Functions * Functions
GSM_Phone_Functions * Functions
GSM_Error(* DispatchMessage)(GSM_StateMachine *s)
GSM_Protocol_Message * RequestMsg
GSM_Error(* DeviceSetSpeed)(GSM_StateMachine *s, int speed)
void GSM_DumpMessageText(GSM_StateMachine *s, unsigned const char *message, size_t messagesize, int type)