20 #ifdef GSM_ENABLE_ATGEN 27 #include "../../gsmcomon.h" 28 #include "../../gsmphones.h" 29 #include "../../misc/coding/coding.h" 30 #include "../../service/gsmpbk.h" 36 #include "../../../helper/string.h" 60 char *pos_start = NULL, *pos_end = NULL, *pos_tmp = NULL;
86 if (strcmp(Line,
"") == 0) {
90 smprintf(s,
"Assuming broken Samsung response, both memories available!\n");
98 if (strchr(msg->
Buffer,
'(') == NULL) {
99 smprintf(s,
"Assuming broken iWOW style response, no lists!\n");
100 pos_start = strstr(msg->
Buffer,
"\", \"");
102 if (pos_start == NULL) {
103 pos_start = strstr(msg->
Buffer,
"\",\"");
106 pos_start = strstr(msg->
Buffer,
"), (");
108 if (pos_start == NULL) {
109 pos_start = strstr(msg->
Buffer,
"),(");
112 if (pos_start != NULL) {
114 pos_end = strchrnul(pos_start + 1,
')');
115 pos_tmp = strstr(pos_start,
"\"SM\"");
117 if (pos_tmp != NULL && pos_tmp < pos_end) {
120 pos_tmp = strstr(pos_start,
"\"ME\"");
122 if (pos_tmp != NULL && pos_tmp < pos_end) {
126 if (strstr(msg->
Buffer,
"\"SM\"") != NULL) {
131 if (strstr(msg->
Buffer,
"\"ME\"") != NULL) {
137 if (strstr(msg->
Buffer,
"\"MT\"") != NULL && strstr(msg->
Buffer,
"\"OM\"") != NULL) {
145 smprintf(s,
"Available SMS memories received: read: ME : %s, SM : %s, save: ME : %s, SM = %s, Motorola = %s\n",
170 smprintf(s,
"Getting available SMS memories\n");
178 smprintf(s,
"Forcing support for SM storage!\n");
183 smprintf(s,
"Forcing support for ME storage!\n");
188 smprintf(s,
"Forcing to disable ME storage!\n");
193 smprintf(s,
"Forcing to disable SM storage!\n");
208 unsigned char cpmsCmdReq[] =
"AT+CPMS=\"XX\",\"XX\"\r";
209 size_t cpmsCmdReqLength = strlen(cpmsCmdReq);
221 ATGEN_GetSMSMemories(s);
227 smprintf(s,
"Saving SMS not supported!\n");
231 smprintf(s,
"Saving SMS not supported!\n");
236 cpmsCmdReq[12] =
'\r';
237 cpmsCmdReqLength = 13;
246 cpmsCmdReq[9] =
'S'; cpmsCmdReq[10] =
'M';
247 cpmsCmdReq[14] =
'S'; cpmsCmdReq[15] =
'M';
249 smprintf(s,
"Setting SMS memory type to SM\n");
256 smprintf(s,
"Can't access SIM card?\n");
272 cpmsCmdReq[9] =
'M'; cpmsCmdReq[10] =
'T';
275 cpmsCmdReq[14] =
'O'; cpmsCmdReq[15] =
'M';
277 cpmsCmdReq[14] =
'I'; cpmsCmdReq[15] =
'M';
280 cpmsCmdReq[9] =
'M'; cpmsCmdReq[10] =
'E';
281 cpmsCmdReq[14] =
'M'; cpmsCmdReq[15] =
'E';
283 smprintf(s,
"Setting SMS memory type to ME\n");
337 smprintf(s,
"Forcibily enabled SMS text mode\n");
339 smprintf(s,
"Trying SMS PDU mode\n");
344 smprintf(s,
"Trying SMS text mode\n");
353 int ifolderid = 0, maxfolder = 0;
356 error = ATGEN_SetSMSMemory(s,
FALSE, for_write, (sms->
Folder % 2) == 0);
363 error = ATGEN_SetSMSMemory(s,
TRUE, for_write, (sms->
Folder % 2) == 0);
371 smprintf(s,
"No SMS memory at all!\n");
383 if (sms->
Folder == 0x00) {
386 if (ifolderid + 1 > maxfolder) {
387 smprintf(s,
"Too high location for flat folder: %d (folder=%d, maxfolder=%d)\n",
393 *folderid = ifolderid + 1;
396 if (sms->
Folder > 2 * maxfolder) {
397 smprintf(s,
"Too high folder: folder=%d, maxfolder=%d\n",
402 *folderid = sms->
Folder <= 2 ? 1 : 2;
410 smprintf(s,
"SMS folder %i & location %i -> ATGEN folder %i & location %i\n",
417 return ATGEN_SetSMSMemory(s,
TRUE, for_write, (sms->
Folder % 2) == 0);
420 return ATGEN_SetSMSMemory(s,
FALSE, for_write, (sms->
Folder % 2) == 0);
437 smprintf(s,
"ATGEN folder %i & location %i -> SMS folder %i & location %i\n",
446 unsigned char *buffer;
447 size_t parse_len = 0, length = 0;
449 length = strlen(PDU);
452 if (strcmp(PDU,
"00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF") == 0) {
454 }
else if (strcmp(PDU,
"00") == 0) {
459 buffer = (
unsigned char*)malloc((length / 2) + 1);
460 if (buffer == NULL) {
468 while (length >= 2 && PDU[length - 1] ==
'0' && PDU[length - 2] ==
',') {
474 smprintf(s,
"Failed to decode hex string!\n");
505 if (parse_len != length) {
506 smprintf(s,
"Did not parse all PDU data (%u, %u)!\n", (
unsigned int)parse_len, (
unsigned int)length);
508 if (buffer[parse_len] == 0xff) {
509 smprintf(s,
"Assuming broken phone which pads SMS data with FF\n");
510 }
else if (buffer[parse_len] == 0x89) {
512 smprintf(s,
"Assuming we can ignore anything starting with 0x89\n");
590 unsigned char buffer[3000] = {
'\0'}, firstbyte = 0, TPDCS = 0, TPUDL = 0, TPStatus = 0, TPPID = 0;
591 int current = 0, i = 0;
595 char *expected_comma;
623 if (strcmp(buffer,
"+CMGR: 0,,0") == 0) {
639 while (msg->
Buffer[current] !=
':') {
644 while (msg->
Buffer[current] ==
' ') {
652 for (ptr = buffer; *ptr ==
'"'; ptr++);
654 memmove (buffer, ptr, strlen (ptr) + 1);
658 for (ptr = buffer; *ptr; ptr++);
661 while (ptr >= buffer && *ptr ==
'"') {
667 smprintf(s,
"Message type: %s\n", buffer);
670 if (!strcmp(buffer,
"0") || !strcmp(buffer,
"REC UNREAD")) {
671 smprintf(s,
"SMS type - deliver\n");
681 }
else if (!strcmp(buffer,
"1") || !strcmp(buffer,
"REC READ")) {
682 smprintf(s,
"SMS type - deliver\n");
692 }
else if (!strcmp(buffer,
"2") || !strcmp(buffer,
"STO UNSENT")) {
703 }
else if (!strcmp(buffer,
"3") || !strcmp(buffer,
"STO SENT")) {
715 smprintf(s,
"Uknown message state: %s\n", buffer);
729 return ATGEN_ReadSMSText(msg, s, sms);
734 if ((sms->
Folder == 1 || sms->
Folder == 3) && buffer[0]!=0 && buffer[0]!=
'"') {
746 firstbyte = atoi(buffer);
769 TPStatus = atoi(buffer);
786 if (strlen(buffer)!=0) {
820 firstbyte = atoi(buffer);
822 smprintf (s,
"buffer firstbyte:%s\n", buffer);
828 TPPID = atoi(buffer);
832 TPDCS = atoi(buffer);
833 smprintf(s,
"TPDCS: %02x\n", TPDCS);
838 if (buffer[0] !=
'"' && buffer[0]) {
846 if ((firstbyte & 128)==128) {
850 if (TPPID > 0x40 && TPPID < 0x48) {
853 smprintf(s,
"TPPID: %02x %i\n", TPPID, TPPID);
860 TPUDL = atoi(buffer);
865 if ((TPDCS & 0xD0) == 0x10 || (TPDCS & 0xF0) == 0xF0) {
866 sms->
Class = TPDCS & 3;
876 if ((firstbyte & 0x40)!=0x40) {
878 error = ATGEN_ReadSMSText(msg, s, sms);
879 if (sms->
Length == TPUDL + 4) {
882 if (tail[0] == 0 && tail[1] ==
',' && tail[4] == 0 && tail[5] ==
',') {
887 if (sms->
Length != TPUDL) {
888 smprintf(s,
"WARNING: Indicated message length (%d) does not match real (%d)\n", TPUDL, sms->
Length);
895 comma = strchr (msg->
Buffer+current,
',');
898 expected_comma = (
char *)msg->
Buffer+current + ((7 * TPUDL + 7) / 8) * 2;
900 expected_comma = (
char *)msg->
Buffer+current + TPUDL * 2;
902 if (comma == expected_comma || !comma) {
903 comma = expected_comma;
905 smprintf (s,
"UDL fix: %d,", TPUDL);
907 TPUDL = ((comma - ((
char *)msg->
Buffer+current)) * 4) / 7;
909 TPUDL = (comma - ((
char *)msg->
Buffer+current)) / 2;
936 smprintf(s,
"Internal error - SMS mode not set!\n");
961 unsigned char req[20] = {
'\0'}, folderid = 0;
962 int location = 0, getfolder = 0, add = 0, length = 0;
966 error = ATGEN_GetSMSMode(s);
979 error = ATGEN_GetSMSLocation(s, &sms->
SMS[0], &folderid, &location,
FALSE);
987 length = sprintf(req,
"AT+CMGR=%i\r", location + add);
1004 ATGEN_SetSMSLocation(s, &sms->
SMS[0], folderid, location);
1010 if (oldmode != Priv->
SMSMode) {
1011 ATGEN_SetSMSMode(s, oldmode);
1023 int line = 1, cur = 0, allocsize = 0;
1043 smprintf(s,
"SMS listing received\n");
1054 str = strstr(str,
"+CMGL:");
1063 smprintf(s,
"Can not find +CMGL:!\n");
1078 if (allocsize <= Priv->SMSCount) {
1106 smprintf(s,
"Failed to parse reply, not using cache!\n");
1113 smprintf(s,
"PDU (%s) too long for cache, skipping!\n", str);
1122 smprintf(s,
"WARNING: Line should contain PDU data, but contains +CMGL, stripping it!\n");
1147 error = ATGEN_GetSMSMode(s);
1200 smprintf(s,
"Getting SMS locations\n");
1218 smprintf(s,
"WARNING: Used messages according to CPMS %d, but CMGL returned %d. Expect problems!\n", used, Priv->
SMSCount);
1220 smprintf(s,
"HINT: Your might want to use F_USE_SMSTEXTMODE flag\n");
1231 int usedsms = 0, i = 0, found = -1, tmpfound = -1;
1256 error = ATGEN_GetSMSList(s,
TRUE);
1266 for (i = 0; i < Priv->
SMSCount; i++) {
1272 && ((tmpfound == -1) ||
1282 smprintf(s,
"Invalid location passed to %s!\n", __FUNCTION__);
1284 if (tmpfound == -1) {
1287 smprintf(s,
"Attempting to skip to next location!\n");
1291 smprintf(s,
"Cache status: Found: %d, count: %d\n", found, Priv->
SMSCount);
1300 error = ATGEN_GetSMSList(s,
FALSE);
1330 smprintf(s,
"Getting message from cache\n");
1332 error = ATGEN_DecodePDUMessage(s,
1371 smprintf(s,
"No more messages to read\n");
1400 unsigned char buffer[50] = {
'\0'};
1401 int used = 0, size = 0;
1405 smprintf(s,
"SMS status received\n");
1410 "+CPMS: @i, @i, @0",
1421 "+CPMS: @s, @i, @i, @0",
1422 &buffer,
sizeof(buffer), &used, &size);
1434 if ((strstr(msg->
Buffer,
"CPMS=\"ME") != NULL) ||
1445 if (strstr(msg->
Buffer,
"SM")!=NULL) {
1446 smprintf(s,
"Can't access SIM card\n");
1474 ATGEN_GetSMSMemories(s);
1491 smprintf(s,
"Getting SIM SMS status\n");
1510 smprintf(s,
"Getting phone SMS status\n");
1544 smprintf(s,
"Received unexpected SMS edit prompt!\n");
1563 smprintf(s,
"Saved at AT location %i\n",
1566 ATGEN_SetSMSLocation(
1593 unsigned char req[1000] = {
'\0'}, buffer[1000] = {
'\0'};
1594 int i = 0, length = 0;
1598 error = ATGEN_GetSMSMode(s);
1628 for(i = 0;i < 7;i++) {
1633 for(i = 0;i < length;i++) {
1637 *length2 = *current * 2;
1662 for(i = 0;i < length;i++) {
1665 req[(*current)+1]=
'\0';
1667 *length2 = *current * 2;
1689 len = sprintf(buffer,
"AT+CSMP=%i,%i,%i,%i\r",
1698 len = sprintf(buffer,
"AT+CSMP=%i,,%i,%i\r",
1705 smprintf(s,
"WARNING: Failed to set message parameters, continuing without them!\n");
1707 switch (message->
Coding) {
1741 unsigned char buffer[1000] = {
'\0'}, hexreq[1000] = {
'\0'},folderid = 0;
1742 const char *statetxt;
1743 int state = 0, Replies = 0, reply = 0, current = 0, location = 0;
1750 smprintf(s,
"This phone supports only folder = 2!\n");
1757 smprintf(s,
"Flat memory not supported for adding!\n");
1765 error = ATGEN_GetSMSLocation(s, sms, &folderid, &location,
TRUE);
1772 if ((sms->
Folder % 2) == 1) {
1781 smprintf(s,
"This phone probably does not support saving submit messages to ME location!\n");
1782 smprintf(s,
"But trying anyway...\n");
1787 error = ATGEN_MakeSMSFrame(s, sms, hexreq,
sizeof(hexreq), ¤t, &length);
1793 switch (Phone->
Priv.ATGEN.SMSMode) {
1807 error = ATGEN_MakeSMSFrame(s, sms, hexreq,
sizeof(hexreq), ¤t, &length);
1808 if (error !=
ERR_NONE)
return error;
1811 len = sprintf(buffer,
"AT+CMGW=%i,%i\r",current,state);
1815 statetxt =
"REC UNREAD";
1818 statetxt =
"STO UNSENT";
1830 len = sprintf(buffer,
"AT+CMGW=\"123\",,\"%s\"\r",statetxt);
1839 smprintf(s,
"Internal error - SMS mode not set!\n");
1844 for (reply = 0;reply < s->
ReplyNum;reply++) {
1851 smprintf(s,
"Waiting for modem prompt\n");
1880 smprintf(s,
"Escaping SMS mode\n");
1897 int i = 0,reference = 0;
1905 smprintf(s,
"Received unexpected SMS edit prompt!\n");
1956 unsigned char buffer[1000] = {
'\0'}, hexreq[1000] = {
'\0'};
1957 int current = 0, Replies = 0, retries = 0;
1964 error = ATGEN_MakeSMSFrame(s, sms, hexreq,
sizeof(hexreq), ¤t, &length);
1971 smprintf(s,
"No SMSC in SMS to send\n");
1975 switch (Phone->
Priv.ATGEN.SMSMode) {
1977 len = sprintf(buffer,
"AT+CMGS=%i\r",current);
1983 smprintf(s,
"Internal error - SMS mode not set!\n");
1996 while (retries < s->ReplyNum) {
1997 smprintf(s,
"Waiting for modem prompt\n");
2017 smprintf(s,
"Escaping SMS mode\n");
2031 unsigned char req[100] = {
'\0'}, smsfolder = 0;
2059 error = ATGEN_GetSMSLocation(s, &msms.
SMS[0], &smsfolder, &location,
FALSE);
2064 len = sprintf(req,
"AT+CMSS=%i\r",location);
2066 usleep(strlen(req)*1000);
2075 int number_type = 0;
2079 smprintf(s,
"SMSC info received\n");
2175 unsigned char req[20] = {
'\0'}, folderid = 0;
2176 int location = 0, length = 0;
2187 error = ATGEN_GetSMSLocation(s, sms, &folderid, &location,
TRUE);
2193 length = sprintf(req,
"AT+CMGD=%i\r",location);
2255 smprintf(s,
"Enabling fast SMS sending\n");
2258 smprintf(s,
"Disabling fast SMS sending\n");
2271 char *buffer = NULL;
2273 memset(&sms, 0,
sizeof(sms));
2281 buffer = strchr(msg->
Buffer,
':');
2283 if (buffer == NULL) {
2288 while (isspace((
int)*buffer)) {
2291 if (strncmp(buffer,
"ME", 2) == 0 || strncmp(buffer,
"\"ME\"", 4) == 0) {
2297 }
else if (strncmp(buffer,
"MT", 2) == 0 || strncmp(buffer,
"\"MT\"", 4) == 0) {
2303 }
else if (strncmp(buffer,
"SM", 2) == 0 || strncmp(buffer,
"\"SM\"", 4) == 0) {
2305 }
else if (strncmp(buffer,
"SR", 2) == 0 || strncmp(buffer,
"\"SR\"", 4) == 0) {
2311 buffer = strchr(msg->
Buffer,
',');
2313 if (buffer == NULL) {
2318 while (isspace((
int)*buffer)) {
2331 unsigned char buffer[300] = {
'\0'}, smsframe[800] = {
'\0'};
2332 int current = 0, length, i = 0;
2334 smprintf(s,
"Incoming SMS received (Deliver)\n");
2344 while (Data->
Priv.ATGEN.Lines.numbers[i*2+1] != 0) {
2353 for(i = 0;i < buffer[0]+1;i++) {
2354 smsframe[i]=buffer[current++];
2356 smsframe[12]=buffer[current++];
2357 length=((buffer[current])+1)/2+1;
2359 for(i = 0;i < length+1;i++) {
2365 for(i = 0;i < 7;i++) {
2382 smprintf(s,
"Incoming SMS received (Report)\n");
2386 gboolean InRange(
int *range,
int i) {
2387 while (*range != -1) {
2399 size_t allocated = 0, pos = 0;
2400 const char *chr = buffer;
2401 char *endptr = NULL;
2403 int current, diff, i;
2405 smprintf(s,
"Parsing range: %s\n", chr);
2412 while (*chr !=
')' && *chr != 0) {
2414 current = strtol(chr, &endptr, 10);
2418 diff = current - result[pos - 1];
2424 if (endptr == chr) {
2425 smprintf(s,
"Failed to find number in range!\n");
2430 if (allocated < pos + diff + 1) {
2431 result = (
int *)realloc(result,
sizeof(
int) * (pos + diff + 10));
2432 if (result == NULL) {
2433 smprintf(s,
"Not enough memory to parse range!\n");
2436 allocated = pos + 10 + diff;
2441 result[pos++] = current;
2443 for (i = result[pos - 1] + 1; i <= current; i++) {
2455 }
else if (*chr ==
',') {
2457 }
else if (*chr ==
')') {
2460 }
else if (*chr !=
',') {
2461 smprintf(s,
"Bad character in range: %c\n", *chr);
2466 if (result == NULL) {
2471 for (i = 0; result[i] != -1; i++) {
2510 #ifdef GSM_ENABLE_CELLBROADCAST 2511 Priv->CNMIBroadcastProcedure = 0;
2516 if (buffer == NULL) {
2519 while (isspace((
int)*buffer)) {
2522 if (strncmp(buffer,
"+CNMI:", 6) != 0) {
2526 buffer = strchr(buffer,
'(');
2528 if (buffer == NULL) {
2531 range = GetRange(s, buffer);
2533 if (range == NULL) {
2536 if (InRange(range, 2)) {
2539 else if (InRange(range, 3)) {
2551 buffer = strchr(buffer,
'(');
2553 if (buffer == NULL) {
2556 range = GetRange(s, buffer);
2557 if (range == NULL) {
2560 if (InRange(range, 1)) {
2563 else if (InRange(range, 2)) {
2566 else if (InRange(range, 3)) {
2574 buffer = strchr(buffer,
'(');
2575 #ifdef GSM_ENABLE_CELLBROADCAST 2576 if (buffer == NULL) {
2579 range = GetRange(s, buffer);
2581 if (range == NULL) {
2584 if (InRange(range, 2)) {
2585 Priv->CNMIBroadcastProcedure = 2;
2587 else if (InRange(range, 1)) {
2588 Priv->CNMIBroadcastProcedure = 1;
2590 else if (InRange(range, 3)) {
2591 Priv->CNMIBroadcastProcedure = 3;
2599 buffer = strchr(buffer,
'(');
2601 if (buffer == NULL) {
2604 range = GetRange(s, buffer);
2606 if (range == NULL) {
2609 if (InRange(range, 2)) {
2612 else if (InRange(range, 1)) {
2631 #ifdef GSM_ENABLE_CELLBROADCAST 2638 error = ATGEN_GetCNMIMode(s);
2648 if (Priv->CNMIBroadcastProcedure == 0) {
2654 smprintf(s,
"Enabling incoming CB\n");
2655 length = sprintf(buffer,
"AT+CNMI=%d,,%d\r", Priv->
CNMIMode, Priv->CNMIBroadcastProcedure);
2658 smprintf(s,
"Disabling incoming CB\n");
2659 length = sprintf(buffer,
"AT+CNMI=%d,,%d\r", Priv->
CNMIMode, 0);
2675 char buffer[100] = {
'\0'};
2693 error = ATGEN_GetCNMIMode(s);
2709 smprintf(s,
"Enabling incoming SMS\n");
2731 smprintf(s,
"Disabling incoming SMS\n");
2734 length = sprintf(buffer,
"AT+CNMI=%d,,,%d\r", Priv->
CNMIMode, 0);
2742 length = sprintf(buffer,
"AT+CNMI=%d,%d\r", Priv->
CNMIMode, 0);
2753 #ifdef GSM_ENABLE_CELLBROADCAST 2759 char Buffer[300] = {
'\0'},Buffer2[300] = {
'\0'};
2768 for (j = 0;j < msg->
Length;j++) {
2769 smprintf(s,
"j=" SIZE_T_FORMAT
"\n",j);
2774 if (Buffer[i] == 13) i = i - 1;
else break;
GSM_SMSMemoryStatus LastSMSStatus
GSM_Error ATGEN_GetSMSC(GSM_StateMachine *s, GSM_SMSC *smsc)
void GSM_TweakInternationalNumber(unsigned char *Number, const GSM_NumberType numType)
void GSM_SetDefaultReceivedSMSData(GSM_SMSMessage *SMS)
GSM_Error ATGEN_ReplyAddSMSMessage(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_Error ATGEN_SetCharset(GSM_StateMachine *s, GSM_AT_Charset_Preference Prefer)
unsigned char Text[(GSM_MAX_SMS_LENGTH+1) *2]
char * DecodeUnicodeString(const unsigned char *src)
void DumpMessage(GSM_Debug_Info *d, const unsigned char *message, const size_t messagesize)
unsigned char Number[(GSM_MAX_NUMBER_LENGTH+1) *2]
void CopyUnicodeString(unsigned char *Dest, const unsigned char *Source)
GSM_Error ATGEN_ReplyGetSMSMemories(GSM_Protocol_Message *msg, GSM_StateMachine *s)
void DecodeDefault(unsigned char *dest, const unsigned char *src, size_t len, gboolean UseExtensions, unsigned char *ExtraAlphabet)
GSM_Error ATGEN_IncomingSMSCInfo(GSM_Protocol_Message *msg UNUSED, GSM_StateMachine *s UNUSED)
IncomingCBCallback IncomingCB
struct GSM_Protocol::@1 Data
unsigned char ReplaceMessage
GSM_Error ATGEN_HandleCMEError(GSM_StateMachine *s)
GSM_AT_Feature PhoneSMSMemory
#define GSM_PHONE_MAXSMSINFOLDER
void CopyLineString(char *dest, const char *src, const GSM_CutLines *lines, int start)
GSM_Error ATGEN_EncodeText(GSM_StateMachine *s, const unsigned char *input, const size_t inlength, unsigned char *output, const size_t outlength, size_t *resultlength)
GSM_SMSMemoryStatus * SMSStatus
#define GSM_MAX_NUMBER_LENGTH
GSM_Error ATGEN_GetSMSFolders(GSM_StateMachine *s, GSM_SMSFolders *folders)
int ATGEN_ExtractOneParameter(unsigned char *input, unsigned char *output)
GSM_Error ATGEN_DecodeDateTime(GSM_StateMachine *s, GSM_DateTime *dt, unsigned char *_input)
GSM_MultiSMSMessage * GetSMSMessage
GSM_Error ATGEN_DeleteSMS(GSM_StateMachine *s, GSM_SMSMessage *sms)
GSM_Error ATGEN_HandleCMSError(GSM_StateMachine *s)
SendSMSStatusCallback SendSMSStatus
GSM_Error GSM_DecodeSMSFrame(GSM_Debug_Info *di, GSM_SMSMessage *SMS, unsigned char *buffer, GSM_SMSMessageLayout Layout)
gboolean EnableIncomingCB
GSM_Error GSM_DecodePDUFrame(GSM_Debug_Info *di, GSM_SMSMessage *SMS, const unsigned char *buffer, size_t length, size_t *final_pos, gboolean SMSC)
GSM_Error ATGEN_IncomingSMSInfo(GSM_Protocol_Message *msg, GSM_StateMachine *s)
const char * GetLineString(const char *message, GSM_CutLines *lines, int start)
#define ATGEN_WaitForAutoLen(s, cmd, type, time, request)
GSM_OneSMSFolder Folder[GSM_MAX_SMS_FOLDERS]
GSM_Error ATGEN_IncomingSMSDeliver(GSM_Protocol_Message *msg, GSM_StateMachine *s)
void * SendSMSStatusUserData
size_t UnicodeLength(const unsigned char *str)
GSM_SMSMessageLayout PHONE_SMSDeliver
GSM_Error ATGEN_ReplyGetSMSC(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_Error GSM_WaitForOnce(GSM_StateMachine *s, unsigned const char *buffer, size_t length, int type, int timeout)
GSM_Error ATGEN_IncomingSMSReport(GSM_Protocol_Message *msg UNUSED, GSM_StateMachine *s)
GSM_Error ATGEN_ReplyDeleteSMSMessage(GSM_Protocol_Message *msg UNUSED, GSM_StateMachine *s)
GSM_Error(* WriteMessage)(GSM_StateMachine *s, unsigned const char *buffer, int length, int type)
GSM_Error ATGEN_DecodeText(GSM_StateMachine *s, const unsigned char *input, const size_t length, unsigned char *output, const size_t outlength, const gboolean guess, const gboolean phone)
GSM_Error ATGEN_SetFastSMSSending(GSM_StateMachine *s, gboolean enable)
GSM_Error ATGEN_GetSMSStatus(GSM_StateMachine *s, GSM_SMSMemoryStatus *status)
GSM_Error ATGEN_ReplyGetSMSMessage(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_AT_Feature PhoneSaveSMS
GSM_PhoneModel * ModelInfo
int smprintf_level(GSM_StateMachine *s, GSM_DebugSeverity severity, const char *format,...)
GSM_Error ATGEN_ReplySendSMS(GSM_Protocol_Message *msg, GSM_StateMachine *s)
unsigned char DefaultNumber[(GSM_MAX_NUMBER_LENGTH+1) *2]
GSM_Error ATGEN_AddSMS(GSM_StateMachine *s, GSM_SMSMessage *sms)
GSM_ValidityPeriodFormat Format
GSM_Error ATGEN_GetSMS(GSM_StateMachine *s, GSM_MultiSMSMessage *sms)
void EncodeUnicode(unsigned char *dest, const char *src, size_t len)
unsigned char Name[(GSM_MAX_SMS_NAME_LENGTH+1) *2]
GSM_Error GSM_DecodeSMSFrameText(GSM_Debug_Info *di, GSM_SMSMessage *SMS, unsigned char *buffer, GSM_SMSMessageLayout Layout)
GSM_AT_Feature SIMSMSMemory
struct GSM_Phone_Data::@2 Priv
GSM_Error ATGEN_ParseReply(GSM_StateMachine *s, const unsigned char *input, const char *format,...)
GSM_Error ATGEN_SendSavedSMS(GSM_StateMachine *s, int Folder, int Location)
GSM_AT_Feature SIMSaveSMS
GSM_Error ATGEN_SendSMS(GSM_StateMachine *s, GSM_SMSMessage *sms)
GSM_Coding_Type GSM_GetMessageCoding(GSM_Debug_Info *di, const char TPDCS)
void DecodeUTF8(unsigned char *dest, const char *src, size_t len)
GSM_Phone_RequestID RequestID
GSM_AT_SMS_Cache * SMSCache
unsigned char Name[(GSM_MAX_SMS_FOLDER_NAME_LEN+1) *2]
int GetLineLength(const char *message UNUSED, const GSM_CutLines *lines, int start)
GSM_Error ATGEN_WaitFor(GSM_StateMachine *s, const char *cmd, size_t len, int type, int time, GSM_Phone_RequestID request)
GSM_Error ATGEN_GetNextSMS(GSM_StateMachine *s, GSM_MultiSMSMessage *sms, gboolean start)
GSM_SMSMessage SMS[GSM_MAX_MULTI_SMS]
GSM_Error PHONE_GetSMSFolders(GSM_StateMachine *s UNUSED, GSM_SMSFolders *folders)
unsigned char Number[(GSM_MAX_NUMBER_LENGTH+1) *2]
GSM_SMSMessageLayout PHONE_SMSStatusReport
int GSM_UnpackEightBitsToSeven(size_t offset, size_t in_length, size_t out_length, const unsigned char *input, unsigned char *output)
gboolean GSM_IsPhoneFeatureAvailable(GSM_PhoneModel *model, GSM_Feature feature)
GSM_SMSMessageLayout PHONE_SMSSubmit
gboolean DecodeHexBin(unsigned char *dest, const unsigned char *src, size_t len)
GSM_Error ATGEN_SetSMSC(GSM_StateMachine *s, GSM_SMSC *smsc)
void EncodeHexBin(char *dest, const unsigned char *src, size_t len)
void * IncomingSMSUserData
GSM_Error ATGEN_ReplyIncomingCB(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_Protocol_Functions * Functions
GSM_SMSMessage * SaveSMSMessage
gboolean ReplyViaSameSMSC
gboolean EnableIncomingSMS
GSM_Error PHONE_EncodeSMSFrame(GSM_StateMachine *s, GSM_SMSMessage *SMS, unsigned char *buffer, GSM_SMSMessageLayout Layout, int *length, gboolean clear)
GSM_AT_Reply_State ReplyState
GSM_ValidityPeriod Relative
GSM_AT_Manufacturer Manufacturer
GSM_Error ATGEN_SetIncomingCB(GSM_StateMachine *s, gboolean enable)
GSM_Error ATGEN_ReplyGetMessageList(GSM_Protocol_Message *msg, GSM_StateMachine *s)
IncomingSMSCallback IncomingSMS
char PDU[GSM_AT_MAXPDULEN]
GSM_Error ATGEN_ReplyGetCNMIMode(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_Error ATGEN_SetIncomingSMS(GSM_StateMachine *s, gboolean enable)
GSM_Error GSM_DecodeSMSFrameStatusReportData(GSM_Debug_Info *di, GSM_SMSMessage *SMS, unsigned char *buffer, GSM_SMSMessageLayout Layout)
int smprintf(GSM_StateMachine *s, const char *format,...)
GSM_Error ATGEN_ReplyGetSMSStatus(GSM_Protocol_Message *msg, GSM_StateMachine *s)
unsigned char Name[(GSM_MAX_SMSC_NAME_LENGTH+1) *2]