diff options
author | Michal Čihař <michal@cihar.com> | 2011-02-25 10:01:18 +0100 |
---|---|---|
committer | Michal Čihař <michal@cihar.com> | 2011-02-25 10:01:18 +0100 |
commit | 88e15062c1d36ed989ff154b1ecf644824a3728d (patch) | |
tree | 8454309440a0fc0502c2f5a02a69efd90ea5df52 /gammu | |
parent | 66ce5a2dc79d6132a0db61f880782e56d4f8bfcf (diff) |
Imported Upstream version 1.29.91
Diffstat (limited to 'gammu')
-rw-r--r-- | gammu/depend/nokia/dct3.c | 110 | ||||
-rw-r--r-- | gammu/depend/nokia/dct3trac/wmx.c | 84 | ||||
-rw-r--r-- | gammu/depend/nokia/dct4.c | 170 | ||||
-rw-r--r-- | gammu/depend/siemens/dsiemens.c | 22 | ||||
-rw-r--r-- | gammu/message.c | 16 | ||||
-rw-r--r-- | gammu/message.h | 8 | ||||
-rw-r--r-- | gammu/misc.c | 20 | ||||
-rw-r--r-- | gammu/nokia.c | 2 |
8 files changed, 216 insertions, 216 deletions
diff --git a/gammu/depend/nokia/dct3.c b/gammu/depend/nokia/dct3.c index 6830fc0..c5a2ce0 100644 --- a/gammu/depend/nokia/dct3.c +++ b/gammu/depend/nokia/dct3.c @@ -84,13 +84,13 @@ static gboolean answer_yes3(const char *text) static FILE *DCT3T9File; -static GSM_Error DCT3_ReplyGetT9(GSM_Protocol_Message msg, GSM_StateMachine *sm UNUSED) +static GSM_Error DCT3_ReplyGetT9(GSM_Protocol_Message *msg, GSM_StateMachine *sm UNUSED) { size_t DCT3T9Size; size_t written; - DCT3T9Size = msg.Length - 6; - written = fwrite(msg.Buffer+6,1,DCT3T9Size,DCT3T9File); + DCT3T9Size = msg->Length - 6; + written = fwrite(msg->Buffer+6,1,DCT3T9Size,DCT3T9File); if (written == DCT3T9Size) return ERR_NONE; return ERR_UNKNOWN; } @@ -145,11 +145,11 @@ void DCT3VibraTest(int argc, char *argv[]) Print_Error(error); } -static GSM_Error DCT3_ReplyPhoneTests(GSM_Protocol_Message msg, GSM_StateMachine *sm UNUSED) +static GSM_Error DCT3_ReplyPhoneTests(GSM_Protocol_Message *msg, GSM_StateMachine *sm UNUSED) { int i; - for (i=0;i<msg.Buffer[3];i++) { + for (i=0;i<msg->Buffer[3];i++) { switch (i) { case 0: printf("Unknown(%02i) ",i);break; case 1: printf("MCU ROM checksum (startup)"); break; @@ -176,11 +176,11 @@ static GSM_Error DCT3_ReplyPhoneTests(GSM_Protocol_Message msg, GSM_StateMachine case 22:printf("IMEI check? "); break;/*from PC-Locals1.3.is OK?*/ default:printf("Unknown(%02i) ",i);break; } - switch (msg.Buffer[4+i]) { + switch (msg->Buffer[4+i]) { case 0: printf(" : passed"); break; case 0xff:printf(" : not executed"); break; case 254: printf(" : fail"); break; - default: printf(" : result unknown(%i)",msg.Buffer[4+i]); break; + default: printf(" : result unknown(%i)",msg->Buffer[4+i]); break; } printf("\n"); } @@ -249,14 +249,14 @@ static struct DCT3ADCInfo DCT3ADC[] = { unsigned char DCT3ADCBuf[200]; int DCT3ADCInt; -static GSM_Error DCT3_ReplyGetADC(GSM_Protocol_Message msg, GSM_StateMachine *sm) +static GSM_Error DCT3_ReplyGetADC(GSM_Protocol_Message *msg, GSM_StateMachine *sm) { - switch (msg.Buffer[2]) { + switch (msg->Buffer[2]) { case 0x68: - memcpy(DCT3ADCBuf,msg.Buffer+4,msg.Length-4); + memcpy(DCT3ADCBuf,msg->Buffer+4,msg->Length-4); return ERR_NONE; case 0x91: - DCT3ADCInt = msg.Buffer[4]*256+msg.Buffer[5]; + DCT3ADCInt = msg->Buffer[4]*256+msg->Buffer[5]; return ERR_NONE; } return ERR_UNKNOWNRESPONSE; @@ -353,23 +353,23 @@ void DCT3netmonitor(int argc, char *argv[]) GSM_Terminate(); } -static GSM_Error DCT3_ReplyGetMSID(GSM_Protocol_Message msg, GSM_StateMachine *sm) +static GSM_Error DCT3_ReplyGetMSID(GSM_Protocol_Message *msg, GSM_StateMachine *sm) { int i; printf("MSID : "); - for (i=5;i<18;i++) printf("%02x",msg.Buffer[i]); + for (i=5;i<18;i++) printf("%02x",msg->Buffer[i]); printf("\n"); return ERR_NONE; } -static GSM_Error DCT3_ReplyGetDSPROM(GSM_Protocol_Message msg, GSM_StateMachine *sm) +static GSM_Error DCT3_ReplyGetDSPROM(GSM_Protocol_Message *msg, GSM_StateMachine *sm) { - printf("DSP ROM : %c\n",msg.Buffer[5]); + printf("DSP ROM : %c\n",msg->Buffer[5]); return ERR_NONE; } -static GSM_Error DCT3_ReplySimlockInfo(GSM_Protocol_Message msg, GSM_StateMachine *sm) +static GSM_Error DCT3_ReplySimlockInfo(GSM_Protocol_Message *msg, GSM_StateMachine *sm) { int i, j; char uni[100], buffer[50]; @@ -377,12 +377,12 @@ static GSM_Error DCT3_ReplySimlockInfo(GSM_Protocol_Message msg, GSM_StateMachin j=0; for (i=0; i < 12; i++) { if (j<24) { - uni[j]='0' + (msg.Buffer[9+i] >> 4); + uni[j]='0' + (msg->Buffer[9+i] >> 4); j++; } if (j!=15) { if (j<24) { - uni[j]='0' + (msg.Buffer[9+i] & 0x0f); + uni[j]='0' + (msg->Buffer[9+i] & 0x0f); j++; } } else j++; @@ -392,45 +392,45 @@ static GSM_Error DCT3_ReplySimlockInfo(GSM_Protocol_Message msg, GSM_StateMachin buffer[5]=0; printf("Simlock 1 : MCC+MNC %10s, %s, %s, counter %i\n", buffer, - ((msg.Buffer[6] & 1) == 1)==0?"opened":"CLOSED", - ((msg.Buffer[5] & 1) != 1)==0?"user ":"factory", - msg.Buffer[21]); + ((msg->Buffer[6] & 1) == 1)==0?"opened":"CLOSED", + ((msg->Buffer[5] & 1) != 1)==0?"user ":"factory", + msg->Buffer[21]); strncpy(buffer,uni+16,4); buffer[4]=0; printf("Simlock 2 : GID1 %10s, %s, %s, counter %i\n", buffer, - ((msg.Buffer[6] & 4) == 4)==0?"opened":"CLOSED", - ((msg.Buffer[5] & 4) != 4)==0?"user ":"factory", - msg.Buffer[23]); + ((msg->Buffer[6] & 4) == 4)==0?"opened":"CLOSED", + ((msg->Buffer[5] & 4) != 4)==0?"user ":"factory", + msg->Buffer[23]); strncpy(buffer,uni+20,4); buffer[4]=0; printf("Simlock 3 : GID2 %10s, %s, %s, counter %i\n", buffer, - ((msg.Buffer[6] & 8) == 8)==0?"opened":"CLOSED", - ((msg.Buffer[5] & 8) != 8)==0?"user ":"factory", - msg.Buffer[24]); + ((msg->Buffer[6] & 8) == 8)==0?"opened":"CLOSED", + ((msg->Buffer[5] & 8) != 8)==0?"user ":"factory", + msg->Buffer[24]); strncpy(buffer,uni+5,10); buffer[10]=0; printf("Simlock 4 : MSIN %10s, %s, %s, counter %i\n", buffer, - ((msg.Buffer[6] & 2) == 2)==0?"opened":"CLOSED", - ((msg.Buffer[5] & 2) != 2)==0?"user ":"factory", - msg.Buffer[22]); + ((msg->Buffer[6] & 2) == 2)==0?"opened":"CLOSED", + ((msg->Buffer[5] & 2) != 2)==0?"user ":"factory", + msg->Buffer[22]); return ERR_NONE; } -static GSM_Error DCT3_ReplyGetMCUchkSum(GSM_Protocol_Message msg, GSM_StateMachine *sm) +static GSM_Error DCT3_ReplyGetMCUchkSum(GSM_Protocol_Message *msg, GSM_StateMachine *sm) { int i; - if (msg.Buffer[3] == 0x12) printf("Language Pack: %c\n",msg.Buffer[5]); - if (msg.Buffer[3] == 0x02) { + if (msg->Buffer[3] == 0x12) printf("Language Pack: %c\n",msg->Buffer[5]); + if (msg->Buffer[3] == 0x02) { printf("MCU checksum : "); - for (i=5;i<9;i++) printf("%c",msg.Buffer[i]); + for (i=5;i<9;i++) printf("%c",msg->Buffer[i]); printf("\n"); } return ERR_NONE; @@ -438,10 +438,10 @@ static GSM_Error DCT3_ReplyGetMCUchkSum(GSM_Protocol_Message msg, GSM_StateMachi static unsigned char MSID1; -GSM_Error DCT3_ReplyEnableSecurity2(GSM_Protocol_Message msg, GSM_StateMachine *sm) +GSM_Error DCT3_ReplyEnableSecurity2(GSM_Protocol_Message *msg, GSM_StateMachine *sm) { smprintf(sm, "State of security commands set\n"); - MSID1 = msg.Buffer[5]; + MSID1 = msg->Buffer[5]; return ERR_NONE; } @@ -477,7 +477,7 @@ GSM_Error DCT3Info(void) return ERR_NONE; } -static GSM_Error DCT3_ReplyResetTest36(GSM_Protocol_Message msg, GSM_StateMachine *sm) +static GSM_Error DCT3_ReplyResetTest36(GSM_Protocol_Message *msg, GSM_StateMachine *sm) { printf("Netmonitor test 36 cleaned OK\n"); return ERR_NONE; @@ -508,19 +508,19 @@ void DCT3ResetTest36(int argc, char *argv[]) static unsigned char PPS[32]; /* Product Profile Settings */ -static GSM_Error DCT3_ReplyGetPPS(GSM_Protocol_Message msg, GSM_StateMachine *sm) +static GSM_Error DCT3_ReplyGetPPS(GSM_Protocol_Message *msg, GSM_StateMachine *sm) { int i,j,z; #ifdef DEBUG smprintf(sm, "Product Profile Settings received -"); - for (i=0;i<4;i++) smprintf(sm, " %02x",msg.Buffer[3+i]); + for (i=0;i<4;i++) smprintf(sm, " %02x",msg->Buffer[3+i]); smprintf(sm, "\n"); #endif j=128;z=0; for (i=0;i<32;i++) { PPS[i]='0'; - if (msg.Buffer[z+3]&j) PPS[i]='1'; + if (msg->Buffer[z+3]&j) PPS[i]='1'; if (j==1) { j=128; z++; @@ -534,7 +534,7 @@ static GSM_Error DCT3_ReplyGetPPS(GSM_Protocol_Message msg, GSM_StateMachine *sm return ERR_NONE; } -static GSM_Error DCT3_ReplySetPPS(GSM_Protocol_Message msg, GSM_StateMachine *sm) +static GSM_Error DCT3_ReplySetPPS(GSM_Protocol_Message *msg, GSM_StateMachine *sm) { printf("Setting done OK\n"); return ERR_NONE; @@ -614,15 +614,15 @@ void DCT3SetPhoneMenus(int argc, char *argv[]) Print_Error(error); } -static GSM_Error DCT3_Reply61GetSecurityCode(GSM_Protocol_Message msg, GSM_StateMachine *sm) +static GSM_Error DCT3_Reply61GetSecurityCode(GSM_Protocol_Message *msg, GSM_StateMachine *sm) { - printf("Security Code is \"%s\"\n",msg.Buffer+5); + printf("Security Code is \"%s\"\n",msg->Buffer+5); return ERR_NONE; } -static GSM_Error DCT3_Reply7191GetSecurityCode(GSM_Protocol_Message msg, GSM_StateMachine *sm) +static GSM_Error DCT3_Reply7191GetSecurityCode(GSM_Protocol_Message *msg, GSM_StateMachine *sm) { - printf("Security Code is \"%s\"\n",msg.Buffer+6); + printf("Security Code is \"%s\"\n",msg->Buffer+6); return ERR_NONE; } @@ -665,15 +665,15 @@ void DCT3GetSecurityCode(int argc, char *argv[]) #ifdef GSM_ENABLE_NOKIA6110 -static GSM_Error DCT3_ReplyGetOperatorName(GSM_Protocol_Message msg, GSM_StateMachine *sm) +static GSM_Error DCT3_ReplyGetOperatorName(GSM_Protocol_Message *msg, GSM_StateMachine *sm) { unsigned char buffer[10]; - NOKIA_DecodeNetworkCode(msg.Buffer+5, buffer); + NOKIA_DecodeNetworkCode(msg->Buffer+5, buffer); buffer[6] = 0; printf("Network : %s (%s ", buffer,DecodeUnicodeString(GSM_GetNetworkName(buffer))); printf(", %s)\n", DecodeUnicodeString(GSM_GetCountryName(buffer))); - printf("Name : \"%s\"\n",msg.Buffer+8); + printf("Name : \"%s\"\n",msg->Buffer+8); return ERR_NONE; } @@ -699,7 +699,7 @@ void DCT3GetOperatorName(int argc, char *argv[]) GSM_Terminate(); } -static GSM_Error DCT3_ReplySetOperatorName(GSM_Protocol_Message msg, GSM_StateMachine *sm) +static GSM_Error DCT3_ReplySetOperatorName(GSM_Protocol_Message *msg, GSM_StateMachine *sm) { printf("Operator name set OK\n"); return ERR_NONE; @@ -740,17 +740,17 @@ void DCT3SetOperatorName(int argc, char *argv[]) GSM_Terminate(); } -static GSM_Error DCT3_ReplyDisplayOutput(GSM_Protocol_Message msg, GSM_StateMachine *sm) +static GSM_Error DCT3_ReplyDisplayOutput(GSM_Protocol_Message *msg, GSM_StateMachine *sm) { unsigned char buf[100]; - switch (msg.Buffer[3]) { + switch (msg->Buffer[3]) { case 0x50: smprintf(sm, "Display string received\n"); - memcpy(buf,msg.Buffer+8,msg.Buffer[7]*2); - buf[msg.Buffer[7]*2] = 0; - buf[msg.Buffer[7]*2+1] = 0; - printf("X=%i, Y=%i, Text=\"%s\"\n",msg.Buffer[6],msg.Buffer[5],DecodeUnicodeString(buf)); + memcpy(buf,msg->Buffer+8,msg->Buffer[7]*2); + buf[msg->Buffer[7]*2] = 0; + buf[msg->Buffer[7]*2+1] = 0; + printf("X=%i, Y=%i, Text=\"%s\"\n",msg->Buffer[6],msg->Buffer[5],DecodeUnicodeString(buf)); return ERR_NONE; case 0x54: smprintf(sm, "Display output set\n"); diff --git a/gammu/depend/nokia/dct3trac/wmx.c b/gammu/depend/nokia/dct3trac/wmx.c index 903fe8b..47e7250 100644 --- a/gammu/depend/nokia/dct3trac/wmx.c +++ b/gammu/depend/nokia/dct3trac/wmx.c @@ -34,9 +34,9 @@ extern GSM_Reply_Function UserReplyFunctionsX[]; GSMDecoder *gsmdec; struct wmx_tracestruct *traces; -static GSM_Error DCT3_ReplySwitchDebug(GSM_Protocol_Message msg, GSM_StateMachine *sm) +static GSM_Error DCT3_ReplySwitchDebug(GSM_Protocol_Message *msg, GSM_StateMachine *sm) { - switch(msg.Buffer[2]) { + switch(msg->Buffer[2]) { case 0x70: printf("Debug Trace Enabled\n"); break; @@ -50,15 +50,15 @@ static GSM_Error DCT3_ReplySwitchDebug(GSM_Protocol_Message msg, GSM_StateMachin /** * RPC confirmation/reply */ -static GSM_Error DCT3_ReplyRPC(GSM_Protocol_Message msg, GSM_StateMachine *sm) +static GSM_Error DCT3_ReplyRPC(GSM_Protocol_Message *msg, GSM_StateMachine *sm) { printf("RPC Reply "); - printf("call=%02x rettype=%02x data=", msg.Buffer[2], msg.Buffer[3]); - if(msg.Buffer[3] == 3) { + printf("call=%02x rettype=%02x data=", msg->Buffer[2], msg->Buffer[3]); + if(msg->Buffer[3] == 3) { /* string */ - printf("%s", &msg.Buffer[4]); + printf("%s", &msg->Buffer[4]); } else { - dumpraw("RPC Reply data", &msg.Buffer[4], msg.Length-4); + dumpraw("RPC Reply data", &msg->Buffer[4], msg->Length-4); } printf("\n"); return ERR_NONE; @@ -155,7 +155,7 @@ static void mdircv_data(unsigned char type, unsigned char *buffer, size_t length } } -static GSM_Error DCT3_ReplyDebugTrace(GSM_Protocol_Message msg, GSM_StateMachine *sm) +static GSM_Error DCT3_ReplyDebugTrace(GSM_Protocol_Message *msg, GSM_StateMachine *sm) { size_t x; int id,timestamp,number; @@ -174,16 +174,16 @@ static GSM_Error DCT3_ReplyDebugTrace(GSM_Protocol_Message msg, GSM_StateMachine 0x0C seq nr 0x0D .. parameters */ - id = ((msg.Buffer[2]&0xFF)<<8)|(msg.Buffer[3]&0xFF); - timestamp = ((msg.Buffer[4]&0xFF)<<8)|(msg.Buffer[5]&0xFF); - number = msg.Buffer[6]&0xFF; - length = msg.Buffer[7]&0xFF; + id = ((msg->Buffer[2]&0xFF)<<8)|(msg->Buffer[3]&0xFF); + timestamp = ((msg->Buffer[4]&0xFF)<<8)|(msg->Buffer[5]&0xFF); + number = msg->Buffer[6]&0xFF; + length = msg->Buffer[7]&0xFF; /* filter */ //if((id&0xFF00)==0x1900 && id != 0x1980) // return GE_NONE; - //printf("%02x\n",msg.Buffer[10]); - //if(msg.Buffer[10]!=0x40) + //printf("%02x\n",msg->Buffer[10]); + //if(msg->Buffer[10]!=0x40) // return GE_NONE; /* Query trace type name */ desc = "Unknown"; @@ -209,15 +209,15 @@ static GSM_Error DCT3_ReplyDebugTrace(GSM_Protocol_Message msg, GSM_StateMachine /* text */ /* skip length byte */ printf("\""); - for(x=8; x<msg.Length; x++) { - printf("%c",msg.Buffer[x]&0xFF); + for(x=8; x<msg->Length; x++) { + printf("%c",msg->Buffer[x]&0xFF); } printf("\""); break; /* case 0x6801: - for(x=8; x<msg.Length; x++) { - printf("%02x%c ",msg.Buffer[x]&0xFF,msg.Buffer[x]&0xFF); + for(x=8; x<msg->Length; x++) { + printf("%02x%c ",msg->Buffer[x]&0xFF,msg->Buffer[x]&0xFF); } break; */ @@ -227,60 +227,60 @@ static GSM_Error DCT3_ReplyDebugTrace(GSM_Protocol_Message msg, GSM_StateMachine +00 length +01 type (also xx in 0x18xx) */ - if(msg.Length<10 || msg.Buffer[9]!=(id&0xFF)) { - printf("C %02X: param:%02x", id&0xFF, msg.Buffer[8]); + if(msg->Length<10 || msg->Buffer[9]!=(id&0xFF)) { + printf("C %02X: param:%02x", id&0xFF, msg->Buffer[8]); } else { //printf("D %02X: ", id&0xFF); printf("D %02X: ", id&0xFF); - mdisnd_data((unsigned char)(id&0xFF), (unsigned char*)&msg.Buffer[10], msg.Length-10); + mdisnd_data((unsigned char)(id&0xFF), (unsigned char*)&msg->Buffer[10], msg->Length-10); } break; case 0x19: /* MDIRCV */ - if(msg.Length<10 || msg.Buffer[9]!=(id&0xFF)) { - printf("C %02X: param:%02x", id&0xFF, msg.Buffer[8]); + if(msg->Length<10 || msg->Buffer[9]!=(id&0xFF)) { + printf("C %02X: param:%02x", id&0xFF, msg->Buffer[8]); } else { printf("D %02X: ", id&0xFF); - mdircv_data((unsigned char)(id&0xFF), (unsigned char*)&msg.Buffer[10], msg.Length-10); - //dumpraw((unsigned char*)&msg.Buffer[10], msg.Length-10); + mdircv_data((unsigned char)(id&0xFF), (unsigned char*)&msg->Buffer[10], msg->Length-10); + //dumpraw((unsigned char*)&msg->Buffer[10], msg->Length-10); } break; case 0x20: /* 0x25 SIM commands */ /* - for(x=8;x<msg.Length;x++) - printf("%02x ", msg.Buffer[x]&0xFF); + for(x=8;x<msg->Length;x++) + printf("%02x ", msg->Buffer[x]&0xFF); */ printf("SIM command "); - if(msg.Buffer[8]==0xa0) { // check if valid (class=a0) - simCommand_data(msg.Buffer[9], (unsigned char)(id&0xFF), (unsigned char*)&msg.Buffer[10], msg.Length-10); - // TODO: pass the msg.Buffer[9] and skip 1rst arg + if(msg->Buffer[8]==0xa0) { // check if valid (class=a0) + simCommand_data(msg->Buffer[9], (unsigned char)(id&0xFF), (unsigned char*)&msg->Buffer[10], msg->Length-10); + // TODO: pass the msg->Buffer[9] and skip 1rst arg } else { printf("Unknown 0x25 packet (NOT SIM cmd): "); - for(x=8;x<msg.Length;x++) printf("%02x ", msg.Buffer[x]&0xFF); + for(x=8;x<msg->Length;x++) printf("%02x ", msg->Buffer[x]&0xFF); printf("\n"); } break; case 0x22: /* 0x27 SIM answer to command (error/ok/etc..) */ - if(msg.Length < 10 || msg.Length < length + 8) { + if(msg->Length < 10 || msg->Length < length + 8) { // Unknown response - for(x=0;x<msg.Length;x++) printf("%02x ", msg.Buffer[x]&0xFF); + for(x=0;x<msg->Length;x++) printf("%02x ", msg->Buffer[x]&0xFF); printf(" (Unknown 0x27 packet ? ? )\n"); } else { - simAnswer_Process((unsigned char)(id&0xFF), (unsigned char*)&msg.Buffer[8], length); + simAnswer_Process((unsigned char)(id&0xFF), (unsigned char*)&msg->Buffer[8], length); } break; case 0x23: /* 0x28 SIM response data to commands */ - if(msg.Length < 10 || msg.Length < length + 8) { + if(msg->Length < 10 || msg->Length < length + 8) { // Unknown response - for(x=0;x<msg.Length;x++) printf("%02x ", msg.Buffer[x]&0xFF); + for(x=0;x<msg->Length;x++) printf("%02x ", msg->Buffer[x]&0xFF); printf(" (Unknown 0x28 packet)\n"); } else { - simResponse_Process((unsigned char)(id&0xFF), (unsigned char*)&msg.Buffer[8], length); + simResponse_Process((unsigned char)(id&0xFF), (unsigned char*)&msg->Buffer[8], length); } break; default: /* hex */ - for(x=8; x<msg.Length; x++) { - printf("%02x ",msg.Buffer[x]&0xFF); + for(x=8; x<msg->Length; x++) { + printf("%02x ",msg->Buffer[x]&0xFF); } break; } @@ -289,13 +289,13 @@ static GSM_Error DCT3_ReplyDebugTrace(GSM_Protocol_Message msg, GSM_StateMachine } -static GSM_Error DCT3_ReplyMyPacket(GSM_Protocol_Message msg, GSM_StateMachine *sm) +static GSM_Error DCT3_ReplyMyPacket(GSM_Protocol_Message *msg, GSM_StateMachine *sm) { size_t x; printf("MyPacket "); - for(x=0; x<msg.Length; x++) { - printf("%02x ",msg.Buffer[x]&0xFF); + for(x=0; x<msg->Length; x++) { + printf("%02x ",msg->Buffer[x]&0xFF); } printf("\n"); return ERR_NONE; diff --git a/gammu/depend/nokia/dct4.c b/gammu/depend/nokia/dct4.c index dadf6cd..569fc0a 100644 --- a/gammu/depend/nokia/dct4.c +++ b/gammu/depend/nokia/dct4.c @@ -260,7 +260,7 @@ static DCT4_Phone_Features DCT4PhoneFeatures[] = { {"", {{0,0}}} }; -static GSM_Error DCT4_ReplySetPPS(GSM_Protocol_Message msg, GSM_StateMachine *sm) +static GSM_Error DCT4_ReplySetPPS(GSM_Protocol_Message *msg, GSM_StateMachine *sm) { printf("%s\n", _("Setting done")); return ERR_NONE; @@ -313,72 +313,72 @@ void DCT4SetPhoneMenus(int argc, char *argv[]) DCT4_Phone_Tests DCT4Tests; -static GSM_Error DCT4_ReplyTestsNames(GSM_Protocol_Message msg, GSM_StateMachine *sm) +static GSM_Error DCT4_ReplyTestsNames(GSM_Protocol_Message *msg, GSM_StateMachine *sm) { int i,pos; - DCT4Tests.Num = msg.Buffer[5]; + DCT4Tests.Num = msg->Buffer[5]; pos = 6; - smprintf(sm,"%i names for phone tests received\n",msg.Buffer[5]); - for (i=0;i<msg.Buffer[5];i++) { - strcpy(DCT4Tests.Tests[i].Name,msg.Buffer+pos+4); - DCT4Tests.Tests[i].ID = msg.Buffer[pos+2]; + smprintf(sm,"%i names for phone tests received\n",msg->Buffer[5]); + for (i=0;i<msg->Buffer[5];i++) { + strcpy(DCT4Tests.Tests[i].Name,msg->Buffer+pos+4); + DCT4Tests.Tests[i].ID = msg->Buffer[pos+2]; smprintf(sm,"%x.\"%s\"\n",DCT4Tests.Tests[i].ID,DCT4Tests.Tests[i].Name); - pos+=msg.Buffer[pos+1]; + pos+=msg->Buffer[pos+1]; } return ERR_NONE; } -static GSM_Error DCT4_ReplyTestsStartup(GSM_Protocol_Message msg, GSM_StateMachine *sm) +static GSM_Error DCT4_ReplyTestsStartup(GSM_Protocol_Message *msg, GSM_StateMachine *sm) { int i,pos,j; gboolean found; pos = 10; - for (i=0;i<msg.Buffer[8];i++) { + for (i=0;i<msg->Buffer[8];i++) { found = FALSE; for (j=0;j<DCT4Tests.Num;j++) { - if (DCT4Tests.Tests[j].ID == msg.Buffer[pos]) { + if (DCT4Tests.Tests[j].ID == msg->Buffer[pos]) { DCT4Tests.Tests[j].Startup = TRUE; found = TRUE; break; } } - if (!found) printf("%x ",msg.Buffer[pos]); + if (!found) printf("%x ",msg->Buffer[pos]); pos++; } return ERR_NONE; } -static GSM_Error DCT4_ReplyTestsStatus(GSM_Protocol_Message msg, GSM_StateMachine *sm) +static GSM_Error DCT4_ReplyTestsStatus(GSM_Protocol_Message *msg, GSM_StateMachine *sm) { int i,pos,j; pos = 6; - smprintf(sm,"%i status entries for phone tests received\n",msg.Buffer[5]); - for (i=0;i<msg.Buffer[5];i++) { + smprintf(sm,"%i status entries for phone tests received\n",msg->Buffer[5]); + for (i=0;i<msg->Buffer[5];i++) { for (j=0;j<DCT4Tests.Num;j++) { - if (DCT4Tests.Tests[j].ID == msg.Buffer[pos+2]) { + if (DCT4Tests.Tests[j].ID == msg->Buffer[pos+2]) { printf("\"%40s\" : ",DCT4Tests.Tests[j].Name); - switch(msg.Buffer[pos+3]) { + switch(msg->Buffer[pos+3]) { case 0x00: printf("%s", _("Passed")); break; case 0x01: printf("%s", _("Fail")); break; case 0x03: printf("%s", _("Not executed")); break; case 0x06: printf("%s", _("No signal")); break; case 0x0D: printf("%s", _("Timeout")); break; - default : printf(_("Unknown (%x)"),msg.Buffer[pos+3]); + default : printf(_("Unknown (%x)"),msg->Buffer[pos+3]); } if (DCT4Tests.Tests[j].Startup) printf("%s", _(" (startup)")); printf("\n"); break; } } - pos+=msg.Buffer[pos+1]; + pos+=msg->Buffer[pos+1]; } return ERR_NONE; @@ -421,10 +421,10 @@ void DCT4SelfTests(int argc, char *argv[]) Print_Error(error); } -static GSM_Error DCT4_ReplyVibra(GSM_Protocol_Message msg, GSM_StateMachine *sm) +static GSM_Error DCT4_ReplyVibra(GSM_Protocol_Message *msg, GSM_StateMachine *sm) { #ifdef DEBUG - switch (msg.Buffer[3]) { + switch (msg->Buffer[3]) { case 0x0D : smprintf(sm, "Vibra state set OK\n"); break; case 0x0F : smprintf(sm, "Vibra power set OK\n"); break; } @@ -502,9 +502,9 @@ void DCT4VibraTest(int argc, char *argv[]) } #ifdef DEBUG -static GSM_Error DCT4_ReplyResetSecurityCode(GSM_Protocol_Message msg, GSM_StateMachine *sm) +static GSM_Error DCT4_ReplyResetSecurityCode(GSM_Protocol_Message *msg, GSM_StateMachine *sm) { - switch (msg.Buffer[3]) { + switch (msg->Buffer[3]) { case 0x05: printf(_("Security code set to \"12345\"\n")); return ERR_NONE; @@ -547,13 +547,13 @@ void DCT4ResetSecurityCode(int argc, char *argv[]) char SecLength; -static GSM_Error DCT4_ReplyGetSecurityCode(GSM_Protocol_Message msg, GSM_StateMachine *sm) +static GSM_Error DCT4_ReplyGetSecurityCode(GSM_Protocol_Message *msg, GSM_StateMachine *sm) { - if (msg.Length > 12) { - SecLength = msg.Buffer[13]; - if ((size_t)(msg.Buffer[17]+18) == msg.Length) { - printf(_("Security code is %s\n"),msg.Buffer+18); -// DumpMessage(stdout, msg.Buffer, msg.Length); + if (msg->Length > 12) { + SecLength = msg->Buffer[13]; + if ((size_t)(msg->Buffer[17]+18) == msg->Length) { + printf(_("Security code is %s\n"),msg->Buffer+18); +// DumpMessage(stdout, msg->Buffer, msg->Length); } } return ERR_NONE; @@ -587,47 +587,47 @@ void DCT4GetSecurityCode(int argc, char *argv[]) } } -static GSM_Error DCT4_ReplyGetVoiceRecord(GSM_Protocol_Message msg, GSM_StateMachine *sm) +static GSM_Error DCT4_ReplyGetVoiceRecord(GSM_Protocol_Message *msg, GSM_StateMachine *sm) { size_t i=18,j; unsigned char Buffer[100]; - switch (msg.Buffer[3]) { + switch (msg->Buffer[3]) { case 0x05: smprintf(sm, "Part of voice record received\n"); - if (msg.Length == 6) { + if (msg->Length == 6) { smprintf(sm, "Empty\n"); return ERR_EMPTY; } *sm->Phone.Data.VoiceRecord = 0; - while (i<msg.Length) { - sm->Phone.Data.PhoneString[(*sm->Phone.Data.VoiceRecord)++] = msg.Buffer[i+1]; - sm->Phone.Data.PhoneString[(*sm->Phone.Data.VoiceRecord)++] = msg.Buffer[i]; + while (i<msg->Length) { + sm->Phone.Data.PhoneString[(*sm->Phone.Data.VoiceRecord)++] = msg->Buffer[i+1]; + sm->Phone.Data.PhoneString[(*sm->Phone.Data.VoiceRecord)++] = msg->Buffer[i]; i += 2; } return ERR_NONE; case 0x0D: - smprintf(sm, "Last part of voice record is %02x %02x\n",msg.Buffer[11],msg.Buffer[12]); - smprintf(sm, "Token is %02x\n",msg.Buffer[13]); - sm->Phone.Data.PhoneString[0] = msg.Buffer[11]; - sm->Phone.Data.PhoneString[1] = msg.Buffer[12]; - sm->Phone.Data.PhoneString[2] = msg.Buffer[13]; + smprintf(sm, "Last part of voice record is %02x %02x\n",msg->Buffer[11],msg->Buffer[12]); + smprintf(sm, "Token is %02x\n",msg->Buffer[13]); + sm->Phone.Data.PhoneString[0] = msg->Buffer[11]; + sm->Phone.Data.PhoneString[1] = msg->Buffer[12]; + sm->Phone.Data.PhoneString[2] = msg->Buffer[13]; return ERR_NONE; case 0x31: smprintf(sm, "Names of voice records received\n"); j = 33; - for (i = 0; i < (size_t)msg.Buffer[9]; i++) { - memcpy(Buffer,msg.Buffer+(j+1),msg.Buffer[j]); - Buffer[msg.Buffer[j]] = 0; - Buffer[msg.Buffer[j]+1] = 0; + for (i = 0; i < (size_t)msg->Buffer[9]; i++) { + memcpy(Buffer,msg->Buffer+(j+1),msg->Buffer[j]); + Buffer[msg->Buffer[j]] = 0; + Buffer[msg->Buffer[j]+1] = 0; smprintf(sm, "%ld. \"%s\"\n",(long)i+1,DecodeUnicodeString(Buffer)); if (i==*sm->Phone.Data.VoiceRecord) { sprintf(sm->Phone.Data.PhoneString,"%s->wav",DecodeUnicodeString(Buffer)); return ERR_NONE; } - if (i != (size_t)msg.Buffer[9] - 1) { - j+=msg.Buffer[j] + 1; - if (msg.Buffer[j] == 0x00 && msg.Buffer[j+1]==0x00) j+=2; + if (i != (size_t)msg->Buffer[9] - 1) { + j+=msg->Buffer[j] + 1; + if (msg->Buffer[j] == 0x00 && msg->Buffer[j+1]==0x00) j+=2; j+=23; } } @@ -795,27 +795,27 @@ failnofile: GSM_Terminate(); } -static GSM_Error DCT4_ReplyGetBTInfo(GSM_Protocol_Message msg, GSM_StateMachine *sm) +static GSM_Error DCT4_ReplyGetBTInfo(GSM_Protocol_Message *msg, GSM_StateMachine *sm) { printf(_("device address %02x%02x%02x%02x%02x%02x\n"), - msg.Buffer[9],msg.Buffer[10],msg.Buffer[11], - msg.Buffer[12],msg.Buffer[13],msg.Buffer[14]); + msg->Buffer[9],msg->Buffer[10],msg->Buffer[11], + msg->Buffer[12],msg->Buffer[13],msg->Buffer[14]); return ERR_NONE; } -static GSM_Error DCT4_ReplyGetSimlock(GSM_Protocol_Message msg, GSM_StateMachine *sm) +static GSM_Error DCT4_ReplyGetSimlock(GSM_Protocol_Message *msg, GSM_StateMachine *sm) { int i; unsigned char buff[7]; - switch (msg.Buffer[3]) { + switch (msg->Buffer[3]) { case 0x0D: smprintf(sm, "Simlock info received\n"); smprintf(sm, "Config_Data: "); for (i=14;i<22;i++) { - smprintf(sm, "%02x",msg.Buffer[i]); + smprintf(sm, "%02x",msg->Buffer[i]); } - sprintf(buff,"%02x%02x%02x",msg.Buffer[14],msg.Buffer[15],msg.Buffer[16]); + sprintf(buff,"%02x%02x%02x",msg->Buffer[14],msg->Buffer[15],msg->Buffer[16]); buff[6] = 0; buff[5] = buff[4]; buff[4] = buff[3]; @@ -830,21 +830,21 @@ static GSM_Error DCT4_ReplyGetSimlock(GSM_Protocol_Message msg, GSM_StateMachine smprintf(sm, "\n"); smprintf(sm, "Profile_Bits: "); for (i=22;i<30;i++) { - smprintf(sm, "%02x",msg.Buffer[i]); + smprintf(sm, "%02x",msg->Buffer[i]); } smprintf(sm, "\n"); return ERR_NONE; case 0x13: smprintf(sm, "Simlock info received\n"); - if (msg.Buffer[58] == 0x05 && msg.Buffer[59] == 0x02) { + if (msg->Buffer[58] == 0x05 && msg->Buffer[59] == 0x02) { smprintf(sm, "SIM_PATH: "); for (i=44;i<52;i++) { - smprintf(sm, "%02x",msg.Buffer[i]); + smprintf(sm, "%02x",msg->Buffer[i]); } smprintf(sm, "\n"); printf(LISTFORMAT, _("Simlock data")); for (i=60;i<63;i++) { - printf("%02x",msg.Buffer[i]); + printf("%02x",msg->Buffer[i]); } printf("\n"); } @@ -893,11 +893,11 @@ static FILE *T9File; size_t T9Size; size_t T9FullSize; -static GSM_Error DCT4_ReplyGetT9(GSM_Protocol_Message msg, GSM_StateMachine *sm) +static GSM_Error DCT4_ReplyGetT9(GSM_Protocol_Message *msg, GSM_StateMachine *sm) { - T9FullSize = msg.Buffer[18] * 256 + msg.Buffer[19]; - T9Size = msg.Length - 18; - chk_fwrite(msg.Buffer+18,1,T9Size,T9File); + T9FullSize = msg->Buffer[18] * 256 + msg->Buffer[19]; + T9Size = msg->Length - 18; + chk_fwrite(msg->Buffer+18,1,T9Size,T9File); return ERR_NONE; fail: return ERR_WRITING_FILE; @@ -1011,17 +1011,17 @@ void DCT4DisplayTest(int argc, char *argv[]) int ADC; -static GSM_Error DCT4_ReplyGetADC(GSM_Protocol_Message msg, GSM_StateMachine *sm) +static GSM_Error DCT4_ReplyGetADC(GSM_Protocol_Message *msg, GSM_StateMachine *sm) { - if (msg.Buffer[6] == 0xff && msg.Buffer[7] == 0xff) return ERR_NONE; - switch (msg.Buffer[3]) { + if (msg->Buffer[6] == 0xff && msg->Buffer[7] == 0xff) return ERR_NONE; + switch (msg->Buffer[3]) { case 0x10: /* l10n: Raw data for A/D convertor */ - printf(_("raw result %10i "),msg.Buffer[8]*256+msg.Buffer[9]); + printf(_("raw result %10i "),msg->Buffer[8]*256+msg->Buffer[9]); break; case 0x12: /* l10n: Processed data for A/D convertor */ - printf(_("unit result %10i "),(msg.Buffer[8]*256+msg.Buffer[9])*ADC); + printf(_("unit result %10i "),(msg->Buffer[8]*256+msg->Buffer[9])*ADC); break; } return ERR_NONE; @@ -1089,17 +1089,17 @@ void DCT4GetADC(int argc, char *argv[]) static double RadioFreq; static unsigned char RadioName[100]; -static GSM_Error DCT4_ReplyTuneRadio(GSM_Protocol_Message msg, GSM_StateMachine *sm) +static GSM_Error DCT4_ReplyTuneRadio(GSM_Protocol_Message *msg, GSM_StateMachine *sm) { int length; unsigned char name[100]; - switch (msg.Buffer[3]) { + switch (msg->Buffer[3]) { case 0x09: - N6510_DecodeFMFrequency(&RadioFreq, msg.Buffer+16); + N6510_DecodeFMFrequency(&RadioFreq, msg->Buffer+16); - length = msg.Buffer[8]; - memcpy(name,msg.Buffer+18,length*2); + length = msg->Buffer[8]; + memcpy(name,msg->Buffer+18,length*2); name[length*2] = 0x00; name[length*2+1] = 0x00; CopyUnicodeString(RadioName,name); @@ -1108,7 +1108,7 @@ static GSM_Error DCT4_ReplyTuneRadio(GSM_Protocol_Message msg, GSM_StateMachine case 0x15: case 0x16: smprintf(sm,"Response for enabling radio/headset status received\n"); - if (msg.Buffer[5] == 0) { + if (msg->Buffer[5] == 0) { smprintf(sm,"Connected\n"); return ERR_NONE; } @@ -1280,7 +1280,7 @@ void DCT4PlaySavedRingtone(int argc, char *argv[]) GSM_Terminate(); } -static GSM_Error DCT4_ReplyMakeCameraShoot(GSM_Protocol_Message msg, GSM_StateMachine *sm) +static GSM_Error DCT4_ReplyMakeCameraShoot(GSM_Protocol_Message *msg, GSM_StateMachine *sm) { return ERR_NONE; } @@ -1324,15 +1324,15 @@ void DCT4MakeCameraShoot(int argc, char *argv[]) GSM_Terminate(); } -static GSM_Error DCT4_ReplyGetPBKFeatures(GSM_Protocol_Message msg, GSM_StateMachine *sm) +static GSM_Error DCT4_ReplyGetPBKFeatures(GSM_Protocol_Message *msg, GSM_StateMachine *sm) { int i,pos=6; - printf(_("%i entries types\n"),msg.Buffer[5]-1); + printf(_("%i entries types\n"),msg->Buffer[5]-1); - for (i=0;i<msg.Buffer[5]-1;i++) { - printf(_(" entry ID %02X"),msg.Buffer[pos+4]); - switch (msg.Buffer[pos+4]) { + for (i=0;i<msg->Buffer[5]-1;i++) { + printf(_(" entry ID %02X"),msg->Buffer[pos+4]); + switch (msg->Buffer[pos+4]) { case N7110_PBK_SIM_SPEEDDIAL : printf("%s", _(" (Speed dial on SIM)")); break; case N7110_PBK_NAME : printf("%s", _(" (Text: name (always the only one))")); break; case N7110_PBK_EMAIL : printf("%s", _(" (Text: email address)")); break; @@ -1361,20 +1361,20 @@ static GSM_Error DCT4_ReplyGetPBKFeatures(GSM_Protocol_Message msg, GSM_StateMac case N6510_PBK_GROUP2_ID : printf("%s", _(" (Group ID (6230i or later))")); break; } printf("%s", _(", type ")); - switch (msg.Buffer[pos+5]) { + switch (msg->Buffer[pos+5]) { case 0x05: printf("%s", _("string")); break; case 0x02: printf("%s", _("byte")); break; case 0x03: printf("%s", _("2 bytes")); break; case 0x06: printf("%s", _("4 bytes")); break; - default : printf("%02X",msg.Buffer[pos+5]); + default : printf("%02X",msg->Buffer[pos+5]); } printf("\n"); - pos+=msg.Buffer[pos+3]; + pos+=msg->Buffer[pos+3]; } - printf(_("%i phone number types\n"),msg.Buffer[pos+4]); - for (i=0;i<msg.Buffer[pos+4];i++) { - switch (msg.Buffer[pos+5+i]) { + printf(_("%i phone number types\n"),msg->Buffer[pos+4]); + for (i=0;i<msg->Buffer[pos+4];i++) { + switch (msg->Buffer[pos+5+i]) { case 0x02: printf(" %s\n", _("Home number")); break; case 0x03: printf(" %s\n", _("Mobile number")); break; case 0x04: printf(" %s\n", _("Fax number")); break; diff --git a/gammu/depend/siemens/dsiemens.c b/gammu/depend/siemens/dsiemens.c index 0a72b47..f7b9b3c 100644 --- a/gammu/depend/siemens/dsiemens.c +++ b/gammu/depend/siemens/dsiemens.c @@ -27,7 +27,7 @@ GSM_Error CheckSiemens(void) return ERR_NONE; } -GSM_Error ATSIEMENS_Reply_GetSAT(GSM_Protocol_Message msg, GSM_StateMachine *sm) +GSM_Error ATSIEMENS_Reply_GetSAT(GSM_Protocol_Message *msg, GSM_StateMachine *sm) { GSM_Phone_ATGENData *Priv = &(sm->Phone.Data.Priv.ATGEN); GSM_SAT_Measure_results MeasureResult; @@ -39,19 +39,19 @@ GSM_Error ATSIEMENS_Reply_GetSAT(GSM_Protocol_Message msg, GSM_StateMachine *sm) if (Priv->ReplyState!=AT_Reply_OK) return ERR_UNKNOWN; if (sm->Protocol.Data.AT.EditMode) sm->Protocol.Data.AT.EditMode = FALSE; - if (strstr(GetLineString(msg.Buffer,&Priv->Lines,2),"SSTK")) { - length = strlen(GetLineString(msg.Buffer,&Priv->Lines,2))-7; - DecodeHexBin(buf, GetLineString(msg.Buffer,&Priv->Lines,2)+7,length); + if (strstr(GetLineString(msg->Buffer,&Priv->Lines,2),"SSTK")) { + length = strlen(GetLineString(msg->Buffer,&Priv->Lines,2))-7; + DecodeHexBin(buf, GetLineString(msg->Buffer,&Priv->Lines,2)+7,length); if (buf[0]==0x7f) { new_variable=TRUE; return ERR_NONE; } else return ERR_UNKNOWN; } - if (!strstr(GetLineString(msg.Buffer,&Priv->Lines,3),"SSTK")) return ERR_UNKNOWN; + if (!strstr(GetLineString(msg->Buffer,&Priv->Lines,3),"SSTK")) return ERR_UNKNOWN; - length = strlen(GetLineString(msg.Buffer,&Priv->Lines,3))-7; - DecodeHexBin(buf, GetLineString(msg.Buffer,&Priv->Lines,3)+7,length); + length = strlen(GetLineString(msg->Buffer,&Priv->Lines,3))-7; + DecodeHexBin(buf, GetLineString(msg->Buffer,&Priv->Lines,3)+7,length); if (buf[3]!=0x26) return ERR_UNKNOWN; @@ -217,14 +217,14 @@ GSM_Error ATSIEMENS_Reply_GetSAT(GSM_Protocol_Message msg, GSM_StateMachine *sm) return ERR_NONE; } -GSM_Error ATSIEMENS_Reply_GetNetmon(GSM_Protocol_Message msg, GSM_StateMachine *sm) +GSM_Error ATSIEMENS_Reply_GetNetmon(GSM_Protocol_Message *msg, GSM_StateMachine *sm) { GSM_Phone_ATGENData *Priv = &(sm->Phone.Data.Priv.ATGEN); int i=2; - if (!strstr(GetLineString(msg.Buffer,&Priv->Lines,1),"AT^S^MI")) return ERR_UNKNOWN; - while (strlen(GetLineString(msg.Buffer,&Priv->Lines,i+1))) - printf("%s\n",GetLineString(msg.Buffer,&Priv->Lines,i++)); + if (!strstr(GetLineString(msg->Buffer,&Priv->Lines,1),"AT^S^MI")) return ERR_UNKNOWN; + while (strlen(GetLineString(msg->Buffer,&Priv->Lines,i+1))) + printf("%s\n",GetLineString(msg->Buffer,&Priv->Lines,i++)); printf("\n"); return ERR_NONE; } diff --git a/gammu/message.c b/gammu/message.c index cb01f0c..bc1198f 100644 --- a/gammu/message.c +++ b/gammu/message.c @@ -32,7 +32,7 @@ volatile int num_replies = 0; GSM_MultiSMSMessage IncomingSMSData; -void IncomingSMS(GSM_StateMachine *sm UNUSED, GSM_SMSMessage sms, void *user_data) +void IncomingSMS(GSM_StateMachine *sm UNUSED, GSM_SMSMessage *sms, void *user_data) { printf("%s\n", _("SMS message received")); fflush(stdout); @@ -43,7 +43,7 @@ void IncomingSMS(GSM_StateMachine *sm UNUSED, GSM_SMSMessage sms, void *user_dat return; } wasincomingsms = TRUE; - memcpy(&IncomingSMSData.SMS[0],&sms,sizeof(GSM_SMSMessage)); + IncomingSMSData.SMS[0] = *sms; IncomingSMSData.Number = 1; } @@ -73,19 +73,19 @@ void DisplayIncomingSMS(void) wasincomingsms = FALSE; } -void IncomingCB(GSM_StateMachine *sm UNUSED, GSM_CBMessage CB, void *user_data) +void IncomingCB(GSM_StateMachine *sm UNUSED, GSM_CBMessage *CB, void *user_data) { printf("%s\n", _("CB message received")); - printf(_("Channel %i, text \"%s\"\n"),CB.Channel,DecodeUnicodeConsole(CB.Text)); + printf(_("Channel %i, text \"%s\"\n"),CB->Channel,DecodeUnicodeConsole(CB->Text)); fflush(stdout); } -void IncomingUSSD(GSM_StateMachine *sm UNUSED, GSM_USSDMessage ussd, void *user_data) +void IncomingUSSD(GSM_StateMachine *sm UNUSED, GSM_USSDMessage *ussd, void *user_data) { printf("%s\n", _("USSD received")); printf(LISTFORMAT, _("Status")); - switch(ussd.Status) { + switch(ussd->Status) { case USSD_NoActionNeeded: printf("%s\n", _("No action needed")); break; @@ -111,11 +111,11 @@ void IncomingUSSD(GSM_StateMachine *sm UNUSED, GSM_USSDMessage ussd, void *user_ printf("%s\n", _("Unknown")); break; } - printf(LISTFORMAT "\"%s\"\n", _("Service reply"), DecodeUnicodeConsole(ussd.Text)); + printf(LISTFORMAT "\"%s\"\n", _("Service reply"), DecodeUnicodeConsole(ussd->Text)); fflush(stdout); } -void IncomingUSSD2(GSM_StateMachine *sm, GSM_USSDMessage ussd, void * user_data) +void IncomingUSSD2(GSM_StateMachine *sm, GSM_USSDMessage *ussd, void * user_data) { IncomingUSSD(sm, ussd, user_data); num_replies++; diff --git a/gammu/message.h b/gammu/message.h index 7b9e9fc..82d0973 100644 --- a/gammu/message.h +++ b/gammu/message.h @@ -1,10 +1,10 @@ #include <gammu.h> extern volatile gboolean wasincomingsms; -extern void IncomingSMS(GSM_StateMachine * s, GSM_SMSMessage sms, void *user_data); -extern void IncomingCB(GSM_StateMachine * s, GSM_CBMessage CB, void *user_data); -extern void IncomingUSSD(GSM_StateMachine * s, GSM_USSDMessage ussd, void *user_data); -extern void IncomingUSSD2(GSM_StateMachine * s, GSM_USSDMessage ussd, void *user_data); +extern void IncomingSMS(GSM_StateMachine * s, GSM_SMSMessage *sms, void *user_data); +extern void IncomingCB(GSM_StateMachine * s, GSM_CBMessage *CB, void *user_data); +extern void IncomingUSSD(GSM_StateMachine * s, GSM_USSDMessage *ussd, void *user_data); +extern void IncomingUSSD2(GSM_StateMachine * s, GSM_USSDMessage *ussd, void *user_data); extern void DisplayIncomingSMS(void); extern void GetSMSC(int argc, char *argv[]); extern void SetSMSC(int argc, char *argv[]); diff --git a/gammu/misc.c b/gammu/misc.c index 02ac2ca..9aed329 100644 --- a/gammu/misc.c +++ b/gammu/misc.c @@ -542,20 +542,20 @@ void Screenshot(int argc UNUSED, char *argv[]) GSM_Terminate(); } -void IncomingCall(GSM_StateMachine *sm UNUSED, GSM_Call call, void *user_data) +void IncomingCall(GSM_StateMachine *sm UNUSED, GSM_Call *call, void *user_data) { printf(LISTFORMAT, _("Call info")); - if (call.CallIDAvailable) { - printf(_("ID %i, "),call.CallID); + if (call->CallIDAvailable) { + printf(_("ID %i, "),call->CallID); } - switch(call.Status) { - case GSM_CALL_IncomingCall : printf(_("incoming call from \"%s\"\n"),DecodeUnicodeConsole(call.PhoneNumber)); break; - case GSM_CALL_OutgoingCall : printf(_("outgoing call to \"%s\"\n"),DecodeUnicodeConsole(call.PhoneNumber)); break; + switch(call->Status) { + case GSM_CALL_IncomingCall : printf(_("incoming call from \"%s\"\n"),DecodeUnicodeConsole(call->PhoneNumber)); break; + case GSM_CALL_OutgoingCall : printf(_("outgoing call to \"%s\"\n"),DecodeUnicodeConsole(call->PhoneNumber)); break; case GSM_CALL_CallStart : printf("%s\n", _("call started")); break; case GSM_CALL_CallEnd : printf("%s\n", _("end of call (unknown side)")); break; case GSM_CALL_CallLocalEnd : printf("%s\n", _("call end from our side")); break; - case GSM_CALL_CallRemoteEnd : printf(_("call end from remote side (code %i)\n"),call.StatusCode); break; + case GSM_CALL_CallRemoteEnd : printf(_("call end from remote side (code %i)\n"),call->StatusCode); break; case GSM_CALL_CallEstablished : printf("%s\n", _("call established. Waiting for answer")); break; case GSM_CALL_CallHeld : printf("%s\n", _("call held")); break; case GSM_CALL_CallResumed : printf("%s\n", _("call resumed")); break; @@ -785,9 +785,9 @@ void DialVoice(int argc, char *argv[]) int TerminateID = -1; -void IncomingCall0(GSM_StateMachine *sm UNUSED, GSM_Call call, void * user_data) +void IncomingCall0(GSM_StateMachine *sm UNUSED, GSM_Call *call, void * user_data) { - if (call.CallIDAvailable) TerminateID = call.CallID; + if (call->CallIDAvailable) TerminateID = call->CallID; } void MakeTerminatedCall(int argc, char *argv[]) @@ -2025,7 +2025,7 @@ void EnterSecurityCode(int argc UNUSED, char *argv[]) GSM_Init(TRUE); - error=GSM_EnterSecurityCode(gsm,Code); + error=GSM_EnterSecurityCode(gsm, &Code); Print_Error(error); GSM_Terminate(); diff --git a/gammu/nokia.c b/gammu/nokia.c index 4c2b3e1..9977cf1 100644 --- a/gammu/nokia.c +++ b/gammu/nokia.c @@ -685,7 +685,7 @@ void NokiaAddFile(int argc, char *argv[]) Print_Error(error); /* Getting values from JAD file */ - error = GSM_JADFindData(File, Vendor, Name, JAR, Version, &Size); + error = GSM_JADFindData(&File, Vendor, Name, JAR, Version, &Size); if (error == ERR_FILENOTSUPPORTED) { if (Vendor[0] == 0x00) { fprintf(stderr, "%s\n", _("No vendor info in JAD file")); |