20 #ifdef GSM_ENABLE_ATGEN 27 #include "../../gsmcomon.h" 28 #include "../../gsmphones.h" 29 #include "../../misc/coding/coding.h" 30 #include "../../service/gsmmisc.h" 31 #include "../../service/gsmpbk.h" 42 #include "../../../helper/string.h" 44 #ifdef GSM_ENABLE_ALCATEL 48 #ifdef GSM_ENABLE_ATOBEX 49 #include "../atobex/atobexfunc.h" 59 } GSM_AT_Charset_Info;
65 static GSM_AT_Charset_Info AT_Charsets[] = {
91 static ATErrorCode CMSErrorCodes[] = {
97 {1,
"Unassigned (unallocated) number"},
98 {8,
"Operator determined barring"},
100 {21,
"Short message transfer rejected"},
101 {27,
"Destination out of service"},
102 {28,
"Unidentified subscriber"},
103 {29,
"Facility rejected"},
104 {30,
"Unknown subscriber"},
105 {38,
"Network out of order"},
106 {41,
"Temporary failure"},
108 {47,
"Resources unavailable, unspecified"},
109 {50,
"Requested facility not subscribed"},
110 {69,
"Requested facility not implemented"},
111 {81,
"Invalid short message transfer reference value"},
112 {95,
"Invalid message, unspecified"},
113 {96,
"Invalid mandatory information"},
114 {97,
"Message type non-existent or not implemented"},
115 {98,
"Message not compatible with short message protocol state"},
116 {99,
"Information element non-existent or not implemented"},
117 {111,
"Protocol error, unspecified"},
118 {127,
"Interworking, unspecified"},
120 {0x80,
"Telematic interworking not supported"},
121 {0x81,
"Short message Type 0 not supported"},
122 {0x82,
"Cannot replace short message"},
123 {0x8F,
"Unspecified TP-PID error"},
124 {0x90,
"Data coding scheme (alphabet) not supported"},
125 {0x91,
"Message class not supported"},
126 {0x9F,
"Unspecified TP-DCS error"},
127 {0xA0,
"Command cannot be actioned"},
128 {0xA1,
"Command unsupported"},
129 {0xAF,
"Unspecified TP-Command error"},
130 {0xB0,
"TPDU not supported"},
132 {0xC1,
"No SC subscription"},
133 {0xC2,
"SC system failure"},
134 {0xC3,
"Invalid SME address"},
135 {0xC4,
"Destination SME barred"},
136 {0xC5,
"SM Rejected-Duplicate SM"},
137 {0xC6,
"TP-VPF not supported"},
138 {0xC7,
"TP-VP not supported"},
139 {0xD0,
"SIM SMS storage full"},
140 {0xD1,
"No SMS storage capability in SIM"},
141 {0xD2,
"Error in MS"},
142 {0xD3,
"Memory Capacity Exceede"},
143 {0xD4,
"SIM Application Toolkit Busy"},
144 {0xFF,
"Unspecified error cause"},
146 {256,
"Operation temporary not allowed"},
147 {257,
"call barred"},
150 {260,
"invalid dial string"},
151 {261,
"ss not executed"},
152 {262,
"SIM blocked"},
153 {263,
"Invalid Block"},
156 {301,
"SMS service of ME reserved"},
157 {302,
"operation not allowed"},
158 {303,
"operation not supported"},
159 {304,
"invalid PDU mode parameter"},
160 {305,
"invalid text mode parameter"},
161 {310,
"SIM not inserted"},
162 {311,
"SIM PIN required"},
163 {312,
"PH-SIM PIN required"},
164 {313,
"SIM failure"},
167 {316,
"SIM PUK required"},
168 {317,
"SIM PIN2 required"},
169 {318,
"SIM PUK2 required"},
170 {320,
"memory failure"},
171 {321,
"invalid memory index"},
172 {322,
"memory full"},
173 {330,
"SMSC address unknown"},
174 {331,
"no network service"},
175 {332,
"network timeout"},
176 {340,
"no CNMA acknowledgement expected"},
177 {500,
"unknown error"},
179 {516,
"Motorola - too high location?"},
182 {513,
"unable to store"},
183 {514,
"invalid status"},
184 {515,
"invalid character in address string"},
185 {516,
"invalid length"},
186 {517,
"invalid character in pdu"},
187 {519,
"invalid length or character"},
188 {520,
"invalid character in text"},
189 {521,
"timer expired"},
190 {522,
"Operation temporary not allowed"},
191 {532,
"SIM not ready"},
192 {534,
"Cell Broadcast error unknown"},
194 {538,
"invalid parameter"},
195 {549,
"incorrect PDU length"},
196 {550,
"invalid message type indication (MTI)"},
197 {551,
"invalid (non-hex) chars in address"},
198 {553,
"incorrect PDU length (UDL)"},
199 {554,
"incorrect SCA length"},
200 {578,
"GPRS - unspecified activation rejection"},
201 {588,
"GPRS - feature not supported"},
202 {594,
"GPRS - invalid address length"},
203 {595,
"GPRS - invalid character in address string"},
204 {596,
"GPRS - invalid cid value"},
205 {607,
"GPRS - missing or unknown APN"},
206 {615,
"network failure"},
207 {616,
"network is down"},
208 {625,
"GPRS - pdp type not supported"},
209 {630,
"GPRS - profile (cid) not defined"},
210 {632,
"GPRS - QOS not accepted"},
211 {633,
"GPRS - QOS validation fail"},
212 {639,
"service type not yet available"},
213 {640,
"operation of service temporary not allowed"},
214 {643,
"GPRS - unknown PDP address or type"},
215 {644,
"GPRS - unknown PDP context"},
216 {646,
"GPRS - QOS invalid parameter"},
217 {764,
"missing input value"},
218 {765,
"invalid input value"},
219 {767,
"operation failed"},
220 {769,
"unable to get control of required module"},
221 {770,
"SIM invalid - network reject"},
222 {771,
"call setup in progress"},
223 {772,
"SIM powered down"},
227 static ATErrorCode CMEErrorCodes[] = {
229 {0,
"phone failure"},
230 {1,
"no connection to phone"},
231 {2,
"phone-adaptor link reserved"},
232 {3,
"operation not allowed"},
233 {4,
"operation not supported"},
234 {5,
"PH-SIM PIN required"},
235 {10,
"SIM not inserted"},
236 {11,
"SIM PIN required"},
237 {12,
"SIM PUK required"},
241 {16,
"incorrect password"},
242 {17,
"SIM PIN2 required"},
243 {18,
"SIM PUK2 required"},
245 {21,
"invalid index"},
247 {23,
"memory failure"},
248 {24,
"text string too long"},
249 {25,
"invalid characters in text string"},
250 {26,
"dial string too long"},
251 {27,
"invalid characters in dial string"},
252 {30,
"no network service"},
253 {31,
"network timeout"},
255 {32,
"Network not allowed - emergency calls only."},
256 {40,
"Network personalization PIN required."},
257 {41,
"Network personalization PUK required."},
258 {42,
"Network subset personalization PIN required."},
259 {43,
"Network subset personalization PUK required."},
260 {44,
"Service provider personalization PIN required."},
261 {45,
"Service provider personalization PUK required."},
262 {46,
"Corporate personalization PIN required."},
263 {47,
"Corporate personalization PUK required."},
266 {103,
"Illegal MS (#3)."},
267 {106,
"Illegal ME (#6)."},
268 {107,
"GPRS services not allowed (#7)."},
269 {111,
"Public Land Mobile Network (PLMN) not allowed (#11)."},
270 {112,
"Location area not allowed (#12)."},
271 {113,
"Roaming not allowed in this location area (#13)."},
274 {132,
"Service option not supported (#32)."},
275 {133,
"Requested service option not subscribed (#33)."},
276 {134,
"Service option temporarily out of order (#34)."},
277 {148,
"Unspecified GPRS error."},
278 {149,
"PDP authentication failure."},
279 {150,
"Invalid mobile class."},
283 static char samsung_location_error[] =
"[Samsung] Empty location";
291 smprintf(s,
"CME Error occured, but it's type not detected\n");
354 smprintf(s,
"CMS Error occured, but it's type not detected\n");
425 error = MOTOROLA_SetMode(s, cmd);
429 error =
GSM_WaitFor(s, cmd, len, type, timeout, request);
440 gboolean ATGEN_HasOnlyHexChars(
const char *text,
const size_t length)
444 for (i = 0; i < length; i++) {
445 if (!isxdigit((
int)(
unsigned char)text[i])) {
459 gboolean ATGEN_HasOnlyDigits(
const char *text,
const size_t length)
463 for (i = 0; i < length; i++) {
464 if (!isdigit((
int)(
unsigned char)text[i])) {
479 gboolean ATGEN_IsUCS2(
const char *text,
const size_t length)
481 return (length > 3) &&
483 ATGEN_HasOnlyHexChars(text, length);
494 gboolean ATGEN_IsHex(
const char *text,
const size_t length)
496 return (length > 4) &&
498 ATGEN_HasOnlyHexChars(text, length);
509 gboolean ATGEN_IsNumber(
const char *text,
const size_t length)
511 return ATGEN_HasOnlyDigits(text, length);
526 const unsigned char *input,
527 const size_t inlength,
528 unsigned char *output,
529 const size_t outlength,
534 unsigned char *uname = NULL;
535 size_t len = inlength;
538 uname = (
unsigned char *)malloc(2 * (inlength + 1));
547 len = strlen(output);
556 len = strlen(output);
566 len = strlen(output);
570 IconvEncode(
"CP437", input, 2 * len, output, outlength);
571 len = strlen(output);
574 IconvEncode(
"ISO-8859-1", input, 2 * len, output, outlength);
575 len = strlen(output);
578 IconvEncode(
"ISO-8859-2", input, 2 * len, output, outlength);
579 len = strlen(output);
582 IconvEncode(
"ISO-8859-3", input, 2 * len, output, outlength);
583 len = strlen(output);
586 IconvEncode(
"ISO-8859-4", input, 2 * len, output, outlength);
587 len = strlen(output);
590 IconvEncode(
"ISO-8859-5", input, 2 * len, output, outlength);
591 len = strlen(output);
594 IconvEncode(
"ISO-8859-6", input, 2 * len, output, outlength);
595 len = strlen(output);
631 const unsigned char *input,
633 unsigned char *output,
634 const size_t outlength,
638 unsigned char *buffer;
654 is_hex = ATGEN_IsHex(input, length);
655 is_ucs = ATGEN_IsUCS2(input, length);
659 is_number = ATGEN_IsNumber(input, length);
668 buffer = (
unsigned char *)malloc(length);
670 if (buffer == NULL) {
674 if (!ATGEN_IsNumber(buffer, strlen(buffer))) {
712 && strchr(input,
'@') != NULL) {
731 && input[length - 1] ==
'0' 732 && input[length - 2] ==
'0' 756 buffer = (
unsigned char *)malloc(length);
758 if (buffer == NULL) {
762 if (2 * strlen(buffer) >= outlength) {
781 if (length >= outlength) {
784 buf = malloc (length / 2 + 5);
789 for (i = 0; 2 * i + 1 < length / 2; i++) {
790 buf[i] = (buf[2 * i] == 0x20 && buf[2 * i + 1] == 0xac) ? 0xe5 : buf[2 * i + 1];
791 if (!(buf[i] & 0x80)) {
792 if (state && buf[i] == 0x40) {
795 }
else if (state && buf[i] == 0x5b) {
798 }
else if (state && buf[i] == 0x5c) {
801 }
else if (state && buf[i] == 0x5d) {
804 }
else if (state && buf[i] == 0x5e) {
807 }
else if (state && buf[i] == 0x7b) {
810 }
else if (state && buf[i] == 0x7d) {
813 }
else if (state && buf[i] == 0x7e) {
819 }
else if ((buf[i] & 0xc0) == 0x80) {
823 }
else if ((buf[i] & 0xe0) == 0xc0) {
825 }
else if ((buf[i] & 0xf0) == 0xe0) {
837 if (length / 2 >= outlength) {
852 IconvDecode(
"CP437", input, length, output, outlength);
855 IconvDecode(
"ISO-8859-1", input, length, output, outlength);
858 IconvDecode(
"ISO-8859-2", input, length, output, outlength);
861 IconvDecode(
"ISO-8859-3", input, length, output, outlength);
864 IconvDecode(
"ISO-8859-4", input, length, output, outlength);
867 IconvDecode(
"ISO-8859-5", input, length, output, outlength);
870 IconvDecode(
"ISO-8859-6", input, length, output, outlength);
880 smprintf(s,
"Unsupported charset! (%d)\n", charset);
892 while ((*input!=
',' || inside_quotes) && *input != 0x0d && *input != 0x00) {
893 if (*input ==
'"') inside_quotes = ! inside_quotes;
913 size_t ATGEN_GrabString(
GSM_StateMachine *s,
const unsigned char *input,
unsigned char **output)
915 size_t size = 4, position = 0;
919 *output = (
unsigned char *)malloc(size);
921 if (*output == NULL) {
922 smprintf(s,
"Ran out of memory!\n");
925 while (inside_quotes ||
930 && *input != 0x00)) {
933 inside_quotes = ! inside_quotes;
937 if (position + 2 > size) {
939 *output = (
unsigned char *)realloc(*output, size);
940 if (*output == NULL) {
941 smprintf(s,
"Ran out of memory!\n");
947 (*output)[position] = *input;
952 (*output)[position] = 0;
955 if ((*output)[0] ==
'"' && (*output)[position - 1]) {
956 memmove(*output, (*output) + 1, position - 2);
957 (*output)[position - 2] = 0;
960 smprintf(s,
"Grabbed string from reply: \"%s\" (parsed %ld bytes)\n", *output, (
long)position);
977 unsigned char buffer[100]={
'\0'};
978 unsigned char *pos = NULL;
979 unsigned char buffer_unicode[200]={
'\0'};
980 unsigned char input[100]={
'\0'};
981 char separator =
'\0', *separator_pos, *comma_pos, *date_start, *time_start;
986 strncpy(input, _input, 100);
991 if (*pos ==
',') pos++;
993 if (input[strlen(pos) - 1] ==
',') input[strlen(pos) - 1] = 0;
997 if (*pos ==
'"') pos++;
999 if (input[strlen(pos) - 1] ==
'"') input[strlen(pos) - 1] = 0;
1005 buffer_unicode,
sizeof(buffer_unicode),
1007 if (error !=
ERR_NONE)
return error;
1020 if (buffer[len - 1] ==
'"') {
1021 buffer[len - 1] = 0;
1025 if ((separator_pos = strchr(pos,
'/')) != NULL) {
1027 }
else if ((separator_pos = strchr(pos,
'-')) != NULL) {
1032 comma_pos = strchr(pos,
',');
1035 if (comma_pos != NULL) {
1036 while (isspace(*(comma_pos + 1)) && *(comma_pos + 1) !=
'\0') {
1042 if (comma_pos != NULL && separator_pos > comma_pos) {
1043 date_start = comma_pos + 1;
1045 }
else if (separator_pos != NULL) {
1047 time_start = comma_pos + 1;
1054 if (date_start != NULL) {
1055 dt->
Year = atoi(date_start);
1056 pos = strchr(date_start, separator);
1059 dt->
Month = atoi(pos);
1060 pos = strchr(pos, separator);
1063 dt->
Day = atoi(pos);
1074 if (dt->
Year > 80 && dt->
Year < 1000) {
1076 }
else if (dt->
Year < 100) {
1089 dt->
Hour = atoi(time_start);
1090 pos = strchr(time_start,
':');
1094 pos = strchr(pos,
':');
1103 pos = strchr(time_start,
'+');
1105 pos = strchr(time_start,
'-');
1109 dt->
Timezone = (*pos ==
'+' ? 1 : -1) * atoi(pos+1) * 3600 / 4;
1113 smprintf(s,
"Parsed date: %d-%d-%d %d:%d:%d, TZ %d\n",
1126 const char *fmt = format;
1127 const char *input_pos = input;
1128 char *endptr = NULL, *out_s = NULL, *search_pos = NULL;
1130 unsigned char *out_us = NULL,*buffer = NULL,*buffer2=NULL;
1131 size_t length = 0,storage_size = 0;
1133 long int *out_l = NULL;
1137 smprintf(s,
"Parsing %s with %s\n", input, format);
1139 va_start(ap, format);
1144 smprintf(s,
"Invalid format string: %s\n", format);
1150 out_i = va_arg(ap,
int *);
1151 *out_i = strtol(input_pos, &endptr, 10);
1152 if (endptr == input_pos) {
1156 smprintf(s,
"Parsed int %d\n", *out_i);
1160 out_i = va_arg(ap,
int *);
1161 length = ATGEN_GrabString(s, input_pos, &buffer);
1162 *out_i = strtol(buffer, &endptr, 10);
1163 if (endptr == (
char *)buffer) {
1169 smprintf(s,
"Parsed int %d\n", *out_i);
1170 input_pos += length;
1173 out_i = va_arg(ap,
int *);
1174 *out_i = strtol(input_pos, &endptr, 10);
1175 if (endptr == input_pos) {
1179 smprintf(s,
"Parsed int %d\n", *out_i);
1184 out_l = va_arg(ap,
long int *);
1185 *out_l = strtol(input_pos, &endptr, 10);
1186 if (endptr == input_pos) {
1190 smprintf(s,
"Parsed long int %ld\n", *out_l);
1194 out_s = va_arg(ap,
char *);
1195 storage_size = va_arg(ap,
size_t);
1196 length = ATGEN_GrabString(s, input_pos, &buffer);
1197 smprintf(s,
"Parsed phone string \"%s\"\n", buffer);
1199 buffer, strlen(buffer),
1200 out_s, storage_size,
1211 input_pos += length;
1214 out_s = va_arg(ap,
char *);
1215 storage_size = va_arg(ap,
size_t);
1216 length = ATGEN_GrabString(s, input_pos, &buffer);
1217 smprintf(s,
"Parsed generic string \"%s\"\n", buffer);
1219 buffer, strlen(buffer),
1220 out_s, storage_size,
1231 input_pos += length;
1234 out_s = va_arg(ap,
char *);
1235 storage_size = va_arg(ap,
size_t);
1236 length = ATGEN_GrabString(s, input_pos, &buffer);
1237 smprintf(s,
"Parsed string with length \"%s\"\n", buffer);
1238 if (!isdigit((
int)buffer[0])) {
1244 search_pos = strchr(buffer,
',');
1245 if (search_pos == NULL) {
1253 search_pos, strlen(search_pos),
1254 out_s, storage_size,
1265 input_pos += length;
1268 out_s = va_arg(ap,
char *);
1269 storage_size = va_arg(ap,
size_t);
1270 length = ATGEN_GrabString(s, input_pos, &buffer);
1271 smprintf(s,
"Parsed utf-8 string \"%s\"\n", buffer);
1276 input_pos += length;
1279 out_s = va_arg(ap,
char *);
1280 storage_size = va_arg(ap,
size_t);
1281 length = ATGEN_GrabString(s, input_pos, &buffer);
1282 smprintf(s,
"Parsed utf-8 string with length \"%s\"\n", buffer);
1283 if (!isdigit((
int)buffer[0])) {
1289 search_pos = strchr(buffer,
',');
1290 if (search_pos == NULL) {
1297 DecodeUTF8(out_s, search_pos, strlen(search_pos));
1301 input_pos += length;
1304 out_s = va_arg(ap,
char *);
1305 storage_size = va_arg(ap,
size_t);
1306 length = ATGEN_GrabString(s, input_pos, &buffer);
1307 smprintf(s,
"Parsed generic string \"%s\"\n", buffer);
1309 buffer, strlen(buffer),
1310 out_s, storage_size,
1321 input_pos += length;
1324 out_s = va_arg(ap,
char *);
1325 storage_size = va_arg(ap,
size_t);
1326 length = ATGEN_GrabString(s, input_pos, &buffer);
1327 if (buffer[0] == 0x02 && buffer[strlen(buffer) - 1] == 0x03) {
1328 memmove(buffer, buffer + 1, strlen(buffer) - 2);
1329 buffer[strlen(buffer) - 2] = 0;
1331 smprintf(s,
"Parsed Samsung string \"%s\"\n", buffer);
1336 input_pos += length;
1339 out_us = va_arg(ap,
unsigned char *);
1340 storage_size = va_arg(ap,
size_t);
1341 length = ATGEN_GrabString(s, input_pos, &buffer);
1342 smprintf(s,
"Parsed raw string \"%s\"\n", buffer);
1343 if (strlen(buffer) > storage_size) {
1349 strcpy(out_us, buffer);
1352 input_pos += length;
1356 length = ATGEN_GrabString(s, input_pos, &buffer);
1359 if (length > 0 && *(input_pos + length) ==
',' &&
1360 strchr(buffer,
',') == NULL
1363 length += ATGEN_GrabString(s, input_pos + length, &buffer2);
1364 buffer = (
unsigned char *)realloc(buffer, length + 2);
1365 strcat(buffer,
",");
1366 strcat(buffer, buffer2);
1371 if (strlen(buffer) != 0) {
1372 smprintf(s,
"Parsed string for date \"%s\"\n", buffer);
1380 input_pos += length;
1387 if (*input_pos++ !=
'@') {
1396 smprintf(s,
"Invalid format string (@%c): %s\n", *(fmt - 1), format);
1402 while (isspace((
int)*input_pos)) input_pos++;
1405 if (*input_pos++ != *(fmt - 1)) {
1414 while (isspace((
int)*input_pos)) input_pos++;
1416 if (*input_pos != 0) {
1417 smprintf(s,
"String do not end same!\n");
1445 int i = 0,j = 0,k = 0;
1446 const char *err, *line;
1447 ATErrorCode *ErrorCodes = NULL;
1448 char *line1, *line2;
1453 i = ATGEN_PrintReplyLines(s);
1460 if (line1 == NULL || line2 == NULL) {
1466 if (strncmp(line1,
"AT", 2) == 0) {
1468 if (strcmp(line1, line2) == 0) {
1469 smprintf(s,
"Removing first reply, because it is duplicated\n");
1473 ATGEN_PrintReplyLines(s);
1487 smprintf(s,
"Checking line: %s\n", line);
1489 if (!strcmp(line,
"OK")) {
1492 if (!strncmp(line,
"+CPIN:", 6) && s->
Protocol.
Data.AT.CPINNoOK) {
1495 if (!strcmp(line,
"> ")) {
1498 if (!strcmp(line,
"CONNECT")) {
1501 if (!strcmp(line,
"ERROR")) {
1504 if (!strcmp(line,
"NO CARRIER")) {
1508 if (!strncmp(line,
"+CME ERROR:",11)) {
1510 ErrorCodes = CMEErrorCodes;
1512 if (!strncmp(line,
"+CMS ERROR:",11)) {
1514 ErrorCodes = CMSErrorCodes;
1518 if (!strncmp(line,
"COMMAND NOT SUPPORT", 19)) {
1523 if (!strncmp(line,
"MODEM ERROR:", 12)) {
1533 Priv->
ErrorText = samsung_location_error;
1539 if (ErrorCodes == NULL) {
1545 while (err[j] && !isalnum((
int)err[j])) j++;
1547 if (isdigit((
int)err[j])) {
1549 for (k = 0; ErrorCodes[k].Number != -1; k++) {
1550 if (ErrorCodes[k].Number == Priv->
ErrorCode) {
1555 }
else if (isalpha((
int)err[j])) {
1556 for (k = 0; ErrorCodes[k].Number != -1; k++) {
1557 if (!strncmp(err + j, ErrorCodes[k].Text, strlen(ErrorCodes[k].Text))) {
1622 unsigned char *pos = NULL;
1635 smprintf(s,
"Incoming USSD received\n");
1639 pos = strstr(msg->
Buffer,
"+CUSD:");
1656 if (error !=
ERR_NONE)
return error;
1688 "+CUSD: @i, @r, @i @0",
1690 hex_encoded,
sizeof(hex_encoded),
1699 hex_encoded,
sizeof(hex_encoded));
1705 if ((dcs & 0xc0) == 0) {
1706 if ((dcs & 0x30) != 0x10) {
1710 if ((dcs & 0xf) == 0) {
1713 }
else if ((dcs & 0xf) == 1) {
1717 smprintf(s,
"WARNING: unknown DCS: 0x%02x\n", dcs);
1726 smprintf(s,
"USSD coding DCS = %d -> Coding = %d\n", dcs, coding);
1730 DecodeHexBin(packed, hex_encoded, strlen(hex_encoded));
1739 DecodeHexBin(decoded, hex_encoded, strlen(hex_encoded));
1742 smprintf(s,
"WARNING: 8-bit encoding!\n");
1744 smprintf(s,
"WARNING: unknown encoding!\n");
1775 smprintf(s,
"Enabling incoming USSD\n");
1779 smprintf(s,
"Terminating possible incoming USSD\n");
1782 smprintf(s,
"Disabling incoming USSD\n");
1798 const char *pos, *pos2 = NULL;
1808 if (strstr(line,
"Manufacturer") != NULL) {
1810 if (strstr(line,
"Model") == NULL) {
1820 if ((pos2 = strstr(line,
"\"MODEL=")) != NULL) {
1822 pos2 = strchr(pos,
'"');
1824 }
else if (strncmp(
"+CGMM: \"", line, 8) == 0) {
1826 pos2 = strchr(pos,
'"');
1828 }
else if (strncmp(
"+CGMM: ", line, 7) == 0) {
1832 if (strncmp(
"Model: ", pos, 7) == 0) {
1836 if (strncmp(
"I: ", pos, 3) == 0) {
1841 while (isspace(*pos)) {
1845 pos2 = pos + strlen(pos);
1849 while(isspace(*pos2) && pos2 > pos) {
1855 smprintf(s,
"WARNING: Model name too long, increase GSM_MAX_MODEL_LENGTH to at least %ld (currently %d)\n",
1856 (
long int)(1 + pos2 - pos),
1861 Data->
Model[1 + pos2 - pos] = 0;
1872 smprintf(s,
"Unknown model, but it should still work\n");
1911 vendors_t vendors[] = {
1937 smprintf(s,
"Manufacturer info received\n");
1959 for (vendor = vendors; vendor->id != 0; vendor++) {
1960 if (strcasestr(msg->
Buffer, vendor->name)) {
1973 smprintf(s,
"HINT: Consider using Nokia specific protocol instead of generic AT.\n");
1980 if (strstr(msg->
Buffer,
"www.soft-switch.org")) {
2036 smprintf(s,
"Please increase GSM_MAX_VERSION_LENGTH!\n");
2074 smprintf(s,
"Getting firmware versions\n");
2177 #ifdef GSM_ENABLE_CELLBROADCAST 2178 Priv->CNMIBroadcastProcedure = -1;
2191 smprintf(s,
"Escaping SMS mode\n");
2208 smprintf(s,
"Sending simple AT command to wake up some devices\n");
2227 smprintf(s,
"Phone does not support enabled echo, it can not work with Gammu!\n");
2232 smprintf(s,
"Trying Motorola mode switch\n");
2236 smprintf(s,
"Seems not to be supported\n");
2239 smprintf(s,
"Works, will use it\n");
2243 smprintf(s,
"Enabling CME errors\n");
2253 smprintf(s,
"CME errors could not be enabled, some error types won't be detected.\n");
2273 smprintf(s,
"Checking for OBEX support\n");
2286 #ifdef GSM_ENABLE_ATOBEX_AUTO_MODE 2292 smprintf(s,
"Automatically enabling F_OBEX, please report bug if it causes problems\n");
2298 smprintf(s,
"There is a chance that phone supports F_OBEX,F_MODE22, please report bug if it works\n");
2303 smprintf(s,
"Checking for SYNCML/OBEX support\n");
2312 #ifdef GSM_ENABLE_ATOBEX 2317 #ifdef GSM_ENABLE_ATOBEX_AUTO_MODE 2323 smprintf(s,
"Phone seems to support Siemens like mode switching, adding OBEX feature.\n");
2328 smprintf(s,
"There is a chance that phone supports F_OBEX,F_SQWE, please report bug if it works\n");
2374 if (strcmp(line,
"+CSCS:0") == 0) {
2375 smprintf(s,
"WARNING: Charsets support broken! Assuming GSM as default!\n");
2379 while (AT_Charsets[i].charset != 0) {
2380 if (strstr(line, AT_Charsets[i].text) != NULL) {
2381 Priv->
Charset = AT_Charsets[i].charset;
2385 if (strstr(line,
"0055004300530032") != NULL) {
2393 smprintf(s,
"Could not determine charset returned by phone, probably not supported!\n");
2425 if (strcmp(line,
"+CSCS:") == 0) {
2426 smprintf(s,
"WARNING: Charsets support broken! Assuming that only GSM is supported!\n");
2434 while (AT_Charsets[i].charset != 0) {
2435 if (strstr(line, AT_Charsets[i].text) != NULL) {
2439 smprintf(s,
"Chosen %s as normal charset\n", AT_Charsets[i].text);
2446 smprintf(s,
"Could not find supported charset in list returned by phone!\n");
2451 while (AT_Charsets[i].charset != 0) {
2452 if ((Priv->
UnicodeCharset == 0) && AT_Charsets[i].unicode && (strstr(line, AT_Charsets[i].text) != NULL)) {
2457 smprintf(s,
"Skipped %s because it is usually wrongly implemented on Motorola phones\n", AT_Charsets[i].text);
2462 smprintf(s,
"Skipped %s because it is reported to be broken on this phone\n", AT_Charsets[i].text);
2467 smprintf(s,
"Chosen %s as unicode charset\n", AT_Charsets[i].text);
2470 if (!IRAset && AT_Charsets[i].ira && (strstr(line, AT_Charsets[i].text) != NULL)) {
2474 if (!GSMset && AT_Charsets[i].GSM && (strstr(line, AT_Charsets[i].text) != NULL)) {
2484 smprintf(s,
"Switched back to UTF8 charset, expect problems\n");
2497 smprintf(s,
"INFO: assuming GSM charset\n");
2549 if (error !=
ERR_NONE)
return error;
2577 while (AT_Charsets[i].charset != 0) {
2578 if (AT_Charsets[i].charset == cset) {
2585 if (AT_Charsets[i].charset == 0) {
2586 smprintf(s,
"Could not find string representation for charset (%d)!\n",
2593 EncodeUnicode(buffer2, AT_Charsets[i].text, strlen(AT_Charsets[i].text));
2595 len = sprintf(buffer,
"AT+CSCS=\"%s\"\r", buffer3);
2597 len = sprintf(buffer,
"AT+CSCS=\"%s\"\r", AT_Charsets[i].text);
2627 }
else if (strncmp(s->
Phone.
Data.
IMEI,
"+CGSN: ", 7) == 0) {
2672 unsigned char buffer[100];
2700 "+CALA: @d, @i, @s, @s, @s",
2703 buffer,
sizeof(buffer),
2705 buffer,
sizeof(buffer));
2712 if (!strcmp(buffer,
"\"1,2,3,4,5,6,7\"")) {
2742 if (error !=
ERR_NONE)
return error;
2746 smprintf(s,
"Getting date & time\n");
2760 sprintf(tz,
"%+03i", date_time->
Timezone / 3600);
2764 len = sprintf(req,
"AT+CCLK=\"%04i/%02i/%02i,%02i:%02i:%02i%s\"\r",
2773 len = sprintf(req,
"AT+CCLK=\"%02i/%02i/%02i,%02i:%02i:%02i%s\"\r",
2774 (date_time->
Year > 2000 ? date_time->
Year-2000 : date_time->
Year-1900),
2782 smprintf(s,
"Setting date & time\n");
2787 if (set_timezone && (
2799 smprintf(s,
"Retrying without timezone suffix\n");
2800 error = ATGEN_PrivSetDateTime(s, date_time,
FALSE);
2813 if (error !=
ERR_NONE)
return error;
2815 return ATGEN_PrivSetDateTime(s, date_time,
TRUE);
2826 if (error !=
ERR_NONE)
return error;
2851 if (error !=
ERR_NONE)
return error;
2869 smprintf(s,
"Incoming LAC & CID info, ignoring\n");
2891 smprintf(s,
"Network LAC & CID & state received\n");
2899 "+CGREG: @i, @i, @r, @r, @i, @r",
2912 "+CGREG: @i, @i, @r, @r, @i",
2925 "+CGREG: @i, @i, @r, @r",
2948 smprintf(s,
"Not registered into any network. Not searching for network\n");
2956 smprintf(s,
"Not registered into any network. Searching for network\n");
2960 smprintf(s,
"Registration denied\n");
2968 smprintf(s,
"Registered in roaming network\n");
2972 smprintf(s,
"Unknown: %d\n", state);
2989 smprintf(s,
"Incoming LAC & CID info, ignoring\n");
3006 NetworkInfo->
LAC[0] = 0;
3007 NetworkInfo->
CID[0] = 0;
3011 smprintf(s,
"Network LAC & CID & state received\n");
3013 NetworkInfo->
LAC[0] = 0;
3014 NetworkInfo->
CID[0] = 0;
3019 "+CREG: @i, @i, @r, @r, @i",
3022 NetworkInfo->
LAC,
sizeof(NetworkInfo->
LAC),
3023 NetworkInfo->
CID,
sizeof(NetworkInfo->
CID),
3031 "+CREG: @i, @i, @r, @r",
3034 NetworkInfo->
LAC,
sizeof(NetworkInfo->
LAC),
3035 NetworkInfo->
CID,
sizeof(NetworkInfo->
CID));
3042 "+CREG: @i, @r, @r",
3044 NetworkInfo->
LAC,
sizeof(NetworkInfo->
LAC),
3045 NetworkInfo->
CID,
sizeof(NetworkInfo->
CID));
3064 smprintf(s,
"Not registered into any network. Not searching for network\n");
3072 smprintf(s,
"Not registered into any network. Searching for network\n");
3076 smprintf(s,
"Registration denied\n");
3084 smprintf(s,
"Registered in roaming network\n");
3088 smprintf(s,
"Unknown: %d\n", state);
3105 smprintf(s,
"Network code received\n");
3108 "+COPS: @i, @i, @r",
3117 "+COPS: @i, @i, @r, @i",
3140 smprintf(s,
" Network code : %s\n",
3142 smprintf(s,
" Network name for Gammu : %s ",
3166 smprintf(s,
"Network name received\n");
3169 "+COPS: @i, @i, @s",
3178 "+COPS: @i, @i, @s, @i",
3211 smprintf(s,
"GPRS state received\n");
3220 }
else if (i == 0) {
3223 smprintf(s,
"WARNING: Unknown GPRS state %d\n", i);
3249 smprintf(s,
"Enable full network info\n");
3261 smprintf(s,
"Enable full packet network info\n");
3271 smprintf(s,
"Getting GPRS state\n");
3277 smprintf(s,
"Getting network LAC and CID and state\n");
3283 smprintf(s,
"Getting packet network LAC and CID and state\n");
3291 smprintf(s,
"Setting short network name format\n");
3295 smprintf(s,
"Getting network code\n");
3299 smprintf(s,
"Setting long string network name format\n");
3303 smprintf(s,
"Getting network code\n");
3335 smprintf(s,
"ERROR: Too long phonebook memories information received! (Recevided %d, AT_PBK_MAX_MEMORIES is %d\n",
3365 char req[] =
"AT^SBNR=?\r";
3369 smprintf(s,
"Forcing AT^SBNR support\n");
3374 smprintf(s,
"Checking availability of SBNR\n");
3382 char req[] =
"AT+SPBR=?\r";
3384 smprintf(s,
"Checking availability of SPBR\n");
3392 char req[] =
"AT+MPBR=?\r";
3394 smprintf(s,
"Checking availability of MPBR\n");
3403 char req[] =
"AT+CPBS=\"XX\"\r";
3418 if (error !=
ERR_NONE)
return error;
3429 strcpy(s->
Phone.
Data.
Priv.ATGEN.PBKMemories,
"\"ME\",\"SM\",\"DC\",\"ON\",\"LD\",\"FD\",\"MC\",\"RC\"");
3436 req[9] =
'S'; req[10] =
'M';
3440 req[9] =
'M'; req[10] =
'E';
3444 req[9] =
'M'; req[10] =
'T';
3450 req[9] =
'R'; req[10] =
'C';
3454 req[9] =
'M'; req[10] =
'C';
3458 req[9] =
'O'; req[10] =
'N';
3462 req[9] =
'F'; req[10] =
'D';
3466 req[9] =
'Q'; req[10] =
'D';
3470 req[9] =
'D'; req[10] =
'C';
3474 req[9] =
'L'; req[10] =
'D';
3482 smprintf(s,
"Setting memory type\n");
3505 unsigned char tmp[200]={0};
3511 smprintf(s,
"Memory status received\n");
3515 "+CPBS: @s, @i, @i",
3516 tmp,
sizeof(tmp) / 2,
3572 smprintf(s,
"Memory info received\n");
3577 if (strcmp(
"OK", str) == 0) {
3583 "+CPBR: (@i-@i), @i, @i",
3596 "+CPBR: @i-@i, @i, @i",
3609 "+CPBR: (), @i, @i",
3621 "+CPBR: (@i), @i, @i",
3633 "+CPBR: (@i-@i), @i, @i, @i",
3648 "+CPBR: (@i-@i), @i, @i, @0",
3696 smprintf(s,
"Memory entries for status received\n");
3719 smprintf(s,
"Memory status: Used: %d, Next: %d\n",
3737 char req[20]={
'\0'};
3738 int start = 0,end = 0,memory_end = 0;
3745 if (Status != NULL) {
3752 if (error !=
ERR_NONE)
return error;
3771 smprintf(s,
"Getting memory status\n");
3783 smprintf(s,
"Getting memory information\n");
3793 if (Priv->
MemorySize != 0 && Status != NULL) {
3798 (NeededInfo !=
AT_Status || free_read)) || Status == NULL) {
3802 smprintf(s,
"Getting memory status by reading values\n");
3813 if (end > memory_end)
3818 len = sprintf(req,
"AT+CPBR=%i\r", start);
3820 len = sprintf(req,
"AT+CPBR=%i,%i\r", start, end);
3843 if (end == memory_end) {
3859 error = ATGEN_SetPBKMemory(s, Status->
MemoryType);
3860 if (error !=
ERR_NONE)
return error;
3867 return ATGEN_GetMemoryInfo(s, Status,
AT_Status);
3888 unsigned char buffer[500];
3890 int number_type, types[10];
3894 smprintf(s,
"Phonebook entry received\n");
3916 "+CPBR: @i, @p, @I, @s",
3924 "+CPBR: @i, @p, @I, @e",
3931 smprintf(s,
"Generic AT reply detected\n");
3944 "+CPBR: @i, @p, @I, @e, @i",
3952 smprintf(s,
"AT reply with extra number detected\n");
3965 "+CPBR: @i, @p, @I, @s, @d",
3972 smprintf(s,
"Reply with date detected\n");
3984 smprintf(s,
"Date looks invalid, ignoring!\n");
3998 "+CPBR: @i, @s, @p, @I, @s, @d",
4006 smprintf(s,
"Reply with date detected\n");
4038 "+CPBR: @i,@p,@i,@S,@S,@p,@i,@p,@i,@p,@i,@p,@i,@s,@s,@S,@i,@i,@i,@i,@i,@s,@s",
4053 buffer,
sizeof(buffer),
4060 buffer,
sizeof(buffer),
4065 smprintf(s,
"Samsung reply detected\n");
4088 #define SHIFT_ENTRIES(index) \ 4089 for (i = index - offset + 1; i < GSM_PHONEBOOK_ENTRIES; i++) { \ 4090 Memory->Entries[i - 1] = Memory->Entries[i]; \ 4094 #define CHECK_TEXT(index) \ 4095 if (UnicodeLength(Memory->Entries[index - offset].Text) == 0) { \ 4096 smprintf(s, "Entry %d is empty\n", index); \ 4097 SHIFT_ENTRIES(index); \ 4099 #define CHECK_NUMBER(index) \ 4100 if (UnicodeLength(Memory->Entries[index - offset].Text) == 0) { \ 4101 smprintf(s, "Entry %d is empty\n", index); \ 4102 SHIFT_ENTRIES(index); \ 4104 Memory->Entries[index - offset].VoiceTag = 0; \ 4105 Memory->Entries[index - offset].SMSList[0] = 0; \ 4106 switch (types[index]) { \ 4108 Memory->Entries[index - offset].EntryType = PBK_Number_Fax; \ 4109 Memory->Entries[index - offset].Location = PBK_Location_Unknown; \ 4112 Memory->Entries[index - offset].EntryType = PBK_Number_Mobile; \ 4113 Memory->Entries[index - offset].Location = PBK_Location_Unknown; \ 4116 Memory->Entries[index - offset].EntryType = PBK_Number_Other; \ 4117 Memory->Entries[index - offset].Location = PBK_Location_Unknown; \ 4120 Memory->Entries[index - offset].EntryType = PBK_Number_General; \ 4121 Memory->Entries[index - offset].Location = PBK_Location_Home; \ 4124 Memory->Entries[index - offset].EntryType = PBK_Number_General; \ 4125 Memory->Entries[index - offset].Location = PBK_Location_Work; \ 4128 Memory->Entries[index - offset].EntryType = PBK_Number_Other; \ 4129 Memory->Entries[index - offset].Location = PBK_Location_Unknown; \ 4130 smprintf(s, "WARNING: Unknown memory entry type %d\n", types[index]); \ 4150 #undef SHIFT_ENTRIES 4164 "+CPBR: @i, @p, @I, @e, @0",
4170 smprintf(s,
"Extended AT reply detected\n");
4188 smprintf(s,
"Assuming that memory error means empty entry\n");
4193 smprintf(s,
"Error - too high location ?\n");
4214 if (error !=
ERR_NONE)
return error;
4228 len = sprintf(req,
"AT^SBNR=\"vcf\",%i\r",entry->
Location - 1);
4232 error = ATGEN_SetPBKMemory(s, entry->
MemoryType);
4233 if (error !=
ERR_NONE)
return error;
4236 len = sprintf(req,
"AT+SPBR=%i\r", entry->
Location);
4240 error = ATGEN_SetPBKMemory(s, entry->
MemoryType);
4241 if (error !=
ERR_NONE)
return error;
4255 error = ATGEN_SetPBKMemory(s, entry->
MemoryType);
4256 if (error !=
ERR_NONE)
return error;
4259 error = ATGEN_GetMemoryInfo(s, NULL,
AT_First);
4260 if (error !=
ERR_NONE)
return error;
4263 if (endlocation == 0) {
4271 smprintf(s,
"Getting phonebook entry\n");
4278 return ATGEN_PrivGetMemory(s, entry, 0);
4300 error = ATGEN_SetPBKMemory(s, entry->
MemoryType);
4301 if (error !=
ERR_NONE)
return error;
4304 error = ATGEN_GetMemoryInfo(s, NULL,
AT_Total);
4305 if (error !=
ERR_NONE)
return error;
4325 step =
MIN(step + 2, 20);
4335 unsigned char req[100];
4340 error = ATGEN_SetPBKMemory(s, type);
4341 if (error !=
ERR_NONE)
return error;
4344 error = ATGEN_GetMemoryInfo(s, NULL,
AT_Total);
4345 if (error !=
ERR_NONE)
return error;
4349 error = ATGEN_GetMemoryInfo(s, NULL,
AT_First);
4350 if (error !=
ERR_NONE)
return error;
4354 smprintf(s,
"Deleting all phonebook entries\n");
4356 len = sprintf(req,
"AT+CPBW=%d\r",i);
4388 char *req = NULL,*encoded = NULL;
4389 unsigned char *tmp = NULL;
4390 const char format[] =
"AT+CUSD=%d,\"%s\",15\r";
4391 size_t len = 0, sevenlen = 0;
4397 req = (
char *)malloc(strlen(format) + (strlen(number) * 2) + 1);
4410 len = strlen(number);
4411 encoded = (
char *)malloc(2 * (len + 1));
4413 if (encoded == NULL) {
4418 tmp = (
unsigned char *)malloc(len + 1);
4434 if (encoded != number) {
4461 smprintf(s,
"Making voice call\n");
4462 length = sprintf(buffer,
"ATDT%s;\r", number);
4466 smprintf(s,
"Making voice call without forcing to tone dial\n");
4467 length = sprintf(buffer,
"ATD%s;\r", number);
4471 smprintf(s,
"Assuming voice call succeeded even without reply from phone\n");
4482 smprintf(s,
"Security code was OK\n");
4485 smprintf(s,
"Incorrect security code\n");
4506 len = sprintf(req,
"AT+CPIN2=\"%s\"\r", Code->
Code);
4512 if (Status != Code->
Type) {
4513 smprintf(s,
"Phone is expecting different security code!\n");
4517 if (Code->
NewPIN[0] == 0) {
4518 smprintf(s,
"Need new PIN code to enter PUK!\n");
4521 len = sprintf(req,
"AT+CPIN=\"%s\",\"%s\"\r" , Code->
Code, Code->
NewPIN);
4523 len = sprintf(req,
"AT+CPIN=\"%s\"\r" , Code->
Code);
4527 smprintf(s,
"Entering security code\n");
4537 char status[100] = {
'\0'};
4567 smprintf(s,
"Security status received - ");
4568 if (strstr(status,
"READY")) {
4573 if (strstr(status,
"PH-SIM PIN")) {
4575 smprintf(s,
"Phone code needed\n");
4578 if (strstr(status,
"PH-NET PIN")) {
4580 smprintf(s,
"Network code needed\n");
4583 if (strstr(status,
"PH_SIM PIN")) {
4584 smprintf(s,
"no SIM inside or other error\n");
4587 if (strstr(status,
"SIM PIN2")) {
4592 if (strstr(status,
"SIM PUK2")) {
4597 if (strstr(status,
"SIM PIN")) {
4602 if (strstr(status,
"SIM PUK")) {
4617 smprintf(s,
"Getting security code status\n");
4634 smprintf(s,
"Answering all calls\n");
4669 smprintf(s,
"Dropping all calls\n");
4717 smprintf(s,
"Resetting settings to default\n");
4727 smprintf(s,
"Enabling automatic network login\n");
4738 int line, number_type;
4739 int status,
class, ignore;
4740 char ignore_buf[100];
4766 "+CCFC: @i, @i, @p, @I",
4776 "+CCFC: @i, @i, @p, @I, @s, @i",
4782 ignore_buf,
sizeof(ignore_buf),
4789 "+CCFC: @i, @i, @p, @I, @s, @I, @I",
4795 ignore_buf,
sizeof(ignore_buf),
4821 smprintf(s,
"WARNING: Unknown divert class %d, assuming all numbers\n",
class);
4874 smprintf(s,
"Getting diversions\n");
4875 sprintf(buffer,
"AT+CCFC=%d,2\r", reason);
4927 smprintf(s,
"Setting diversion\n");
4928 sprintf(buffer,
"AT+CCFC=%d,3,\"%s\",129,\"\",128,%d\r",
4935 smprintf(s,
"Setting diversion, trying shorter command\n");
4936 sprintf(buffer,
"AT+CCFC=%d,3,\"%s\"\r",
4947 smprintf(s,
"Enabling diversion\n");
4948 sprintf(buffer,
"AT+CCFC=%d,1\r", reason);
4957 char req[50] =
"AT+VTS=";
4958 int n = 0, len = 0, pos = 0;
4960 len = strlen(sequence);
4967 for (n = 0; n < len; n++) {
4971 req[pos++] = sequence[n];
4984 smprintf(s,
"Phonebook entry written OK\n");
5008 unsigned char req[100] = {
'\0'};
5014 error = ATGEN_SetPBKMemory(s, entry->
MemoryType);
5020 error = ATGEN_GetMemoryInfo(s, NULL,
AT_First);
5027 smprintf(s,
"Deleting phonebook entry\n");
5040 #define REQUEST_SIZE ((4 * GSM_PHONEBOOK_TEXT_LENGTH) + 30) 5045 int NumberType = 129;
5047 unsigned char req[REQUEST_SIZE + 1] = {
'\0'};
5052 int Group = 0, Name = 0, Number = 0, reqlen = 0, i = 0;
5071 smprintf(s,
"WARNING: setting memory for Motorola not implemented yet!\n");
5077 error = ATGEN_SetPBKMemory(s, entry->
MemoryType);
5102 ATGEN_GetMemoryInfo(s, NULL,
AT_Sizes);
5131 smprintf(s,
"WARNING: No usable name found!\n");
5136 NumberType = number[0];
5151 smprintf(s,
"WARNING: No usable number found!\n");
5156 error = ATGEN_GetMemoryInfo(s, NULL,
AT_First);
5168 reqlen = sprintf(req,
"AT+CPBW=%d,\"%s\",%i,\"", entry->
Location + Priv->
FirstMemoryEntry - 1, number, NumberType);
5170 if (reqlen + len > REQUEST_SIZE - 4) {
5171 smprintf(s,
"WARNING: Text truncated to fit in buffer!\n");
5172 len = REQUEST_SIZE - 4 - reqlen;
5175 memcpy(req + reqlen, name, len);
5179 memcpy(req + reqlen,
"\"", 1);
5184 memcpy(req + reqlen,
",0", 2);
5188 memcpy(req + reqlen,
"\r", 1);
5190 smprintf(s,
"Writing phonebook entry\n");
5201 return ATGEN_PrivSetMemory(s, entry);
5211 error = ATGEN_SetPBKMemory(s, entry->
MemoryType);
5226 return ATGEN_PrivSetMemory(s, entry);
5234 smprintf(s,
"Enabling incoming call notification\n");
5263 smprintf(s,
"Disabling incoming call notification\n");
5290 memset(&call, 0,
sizeof(call));
5292 smprintf(s,
"Incoming call info\n");
5299 if (strstr(msg->
Buffer,
"RING")) {
5314 }
else if (strstr(msg->
Buffer,
"CLIP:")) {
5322 }
else if (strstr(msg->
Buffer,
"CCWA:")) {
5330 }
else if (strstr(msg->
Buffer,
"NO CARRIER")) {
5331 smprintf(s,
"Call end detected\n");
5334 }
else if (strstr(msg->
Buffer,
"COLP:")) {
5343 smprintf(s,
"Incoming call error\n");
5366 p = strstr(msg->
Buffer,
"_OBS:");
5369 level = atoi(p + 5);
5371 smprintf(s,
"Battery level changed to %d\n", level);
5381 p = strstr(msg->
Buffer,
"_OSIGQ: ");
5384 level = atoi(p + 7);
5386 smprintf(s,
"Network level changed to %d\n", level);
5402 }
else if (strncmp(s->
Phone.
Data.
IMEI,
"+CIMI: ", 7) == 0) {
5409 smprintf(s,
"No access to SIM card or not supported by device\n");
5440 smprintf(s,
"Getting display status\n");
5451 int bcs = 0, bcl = 0;
5455 smprintf(s,
"Battery level received\n");
5497 smprintf(s,
"WARNING: Unknown battery state: %d\n", bcs);
5502 smprintf(s,
"Can't get battery level\n");
5505 smprintf(s,
"Can't get battery level\n");
5520 smprintf(s,
"Getting battery charge\n");
5530 int rssi = 0, ber = 0;
5538 smprintf(s,
"Signal quality info received\n");
5602 smprintf(s,
"Getting signal quality info\n");
5635 return MOTOROLA_GetCalendarStatus(s, Status);
5651 return MOTOROLA_GetCalendar(s, Note);
5679 return MOTOROLA_SetCalendar(s, Note);
5697 return MOTOROLA_AddCalendar(s, Note);
5713 return MOTOROLA_DelCalendar(s, Note);
5780 smprintf(s,
"Set AT phone power %s\n", on ?
"on" :
"off");
5792 unsigned char frame[40] = {
'\0'}, unicode_key[20] = {
'\0'};
5793 char key[20] = {
'\0'};
5809 strcat(frame,
"AT+CKPD=\"");
5813 case GSM_KEY_1 : strcpy(key,
"1");
break;
5814 case GSM_KEY_2 : strcpy(key,
"2");
break;
5815 case GSM_KEY_3 : strcpy(key,
"3");
break;
5816 case GSM_KEY_4 : strcpy(key,
"4");
break;
5817 case GSM_KEY_5 : strcpy(key,
"5");
break;
5818 case GSM_KEY_6 : strcpy(key,
"6");
break;
5819 case GSM_KEY_7 : strcpy(key,
"7");
break;
5820 case GSM_KEY_8 : strcpy(key,
"8");
break;
5821 case GSM_KEY_9 : strcpy(key,
"9");
break;
5822 case GSM_KEY_0 : strcpy(key,
"0");
break;
5857 if (strcmp(key,
"?") == 0) {
5858 smprintf(s,
"Could not encode key to GSM charset!\n");
5874 smprintf(s,
"Not supported charset for key presses (%d)!\n", Priv->
Charset);
5878 strcat(frame,
"\"\r");
5912 smprintf(s,
"Automatically enabling F_MOBEX, please report bug if it causes problems\n");
5926 char protocol_version[100] = {
'\0'};
5927 int protocol_id = 0, protocol_level = 0;
5944 "+TSSPCSW: @i, @r, @i",
5946 protocol_version,
sizeof(protocol_version),
5951 if (protocol_id == 1) {
5952 smprintf(s,
"Automatically enabling F_TSSPCSW, please report bug if it causes problems\n");
5967 char protocol_version[100] = {
'\0'};
5969 int line = 1, protocol_id = 0, protocol_level = 0;
5973 smprintf(s,
"Protocol entries received\n");
5983 "+CPROT: (@i), (@r), (@i)",
5985 protocol_version,
sizeof(protocol_version),
5994 "+CPROT: @i, @r, @i",
5996 protocol_version,
sizeof(protocol_version),
6005 strcpy(protocol_version,
"0");
6012 if (error ==
ERR_NONE && protocol_id == 0) {
6013 smprintf(s,
"OBEX seems to be supported, version %s, level %d!\n", protocol_version, protocol_level);
6018 if (protocol_level > 1 && (strcmp(protocol_version,
"1.2") == 0 || strcmp(protocol_version,
"1.3") == 0)) {
6024 smprintf(s,
"Automatically enabling F_OBEX, please report bug if it causes problems\n");
6031 if (error ==
ERR_NONE && protocol_id == 16) {
6033 smprintf(s,
"HINT: Please consider adding F_ALCATEL to your phone capabilities in common/gsmphones.c\n");
6052 {ATGEN_GenericReply,
"ERROR" ,0x00,0x00,ID_EnableEcho },
6053 {ATGEN_GenericReply,
"OK" ,0x00,0x00,ID_EnableEcho },
6055 {ATGEN_GenericReply,
"AT+CKPD=" ,0x00,0x00,
ID_PressKey },
6056 {ATGEN_ReplyGetSIMIMSI,
"AT+CIMI" ,0x00,0x00,
ID_GetSIMIMSI },
6057 {ATGEN_ReplyCheckProt,
"AT+CPROT=?" ,0x00,0x00,
ID_SetOBEX },
6058 {ATGEN_ReplyCheckSyncML,
"AT+SYNCML=?" ,0x00,0x00,ID_SetOBEX },
6059 {ATGEN_ReplyCheckTSSPCSW,
"AT$TSSPCSW=?" ,0x00,0x00,ID_SetOBEX },
6060 {ATGEN_GenericReply,
"AT+XLNK=?" ,0x00,0x00,ID_SetOBEX },
6063 #ifdef GSM_ENABLE_CELLBROADCAST 6068 {ATGEN_IncomingBattery,
"_OBS:" ,0x00,0x00,ID_IncomingFrame },
6071 {ATGEN_ReplyGetModel,
"AT+CGMM" ,0x00,0x00,
ID_GetModel },
6072 {ATGEN_ReplyGetModel,
"ATI4" ,0x00,0x00,ID_GetModel },
6074 {ATGEN_ReplyGetManufacturer,
"ATI3" ,0x00,0x00,ID_GetManufacturer },
6076 {ATGEN_ReplyGetFirmware,
"ATI5" ,0x00,0x00,ID_GetFirmware },
6077 {ATGEN_ReplyGetIMEI,
"AT+CGSN" ,0x00,0x00,
ID_GetIMEI },
6083 {ATGEN_GenericReply,
"AT+CSDH" ,0x00,0x00,ID_GetSMSMode },
6091 {ATGEN_GenericReply,
"AT+CSCA" ,0x00,0x00,
ID_SetSMSC },
6094 {ATGEN_GenericReply,
"ATE1" ,0x00,0x00,ID_SetSMSParameters },
6095 {ATGEN_GenericReply,
"\x1b\x0D" ,0x00,0x00,ID_SetSMSParameters },
6104 {ATGEN_GenericReply,
"AT+CALA=" ,0x00,0x00,
ID_SetAlarm },
6105 {ATGEN_ReplyGetAlarm,
"AT+CALA?" ,0x00,0x00,
ID_GetAlarm },
6108 {ATGEN_ReplyGetPacketNetworkLAC_CID,
"AT+CGREG?" ,0x00,0x00,ID_GetNetworkInfo },
6111 {ATGEN_GenericReply,
"AT+CGREG=1" ,0x00,0x00,ID_ConfigureNetworkInfo },
6112 {ATGEN_GenericReply,
"AT+CREG=2" ,0x00,0x00,ID_ConfigureNetworkInfo },
6113 {ATGEN_GenericReply,
"AT+CGREG=2" ,0x00,0x00,ID_ConfigureNetworkInfo },
6114 {ATGEN_GenericReply,
"AT+COPS=" ,0x00,0x00,ID_ConfigureNetworkInfo },
6119 {ATGEN_IncomingNetworkLevel,
"_OSIGQ:" ,0x00,0x00,ID_IncomingFrame },
6120 {ATGEN_IncomingGPRS,
"+CGREG:" ,0x00,0x00,ID_IncomingFrame },
6121 {ATGEN_ReplyGetNetworkLAC_CID,
"+CREG:" ,0x00,0x00,ID_IncomingFrame },
6123 {ATGEN_ReplyGetPBKMemories,
"AT+CPBS=?" ,0x00,0x00,ID_SetMemoryType },
6124 {ATGEN_ReplySetPBKMemory,
"AT+CPBS=" ,0x00,0x00,ID_SetMemoryType },
6127 {ATGEN_ReplyGetCPBRMemoryInfo,
"AT+CPBR=?" ,0x00,0x00,ID_GetMemoryStatus },
6128 {MOTOROLA_ReplyGetMPBRMemoryStatus,
"AT+MPBR=?" ,0x00,0x00,ID_GetMemoryStatus },
6129 {ATGEN_ReplyGetCPBRMemoryInfo,
"+CPBR:" ,0x00,0x00,ID_GetMemoryStatus },
6130 {ATGEN_ReplyGetCPBRMemoryStatus,
"AT+CPBR=" ,0x00,0x00,ID_GetMemoryStatus },
6132 {ATGEN_ReplyGetCharset,
"AT+CSCS?" ,0x00,0x00,ID_GetMemoryCharset },
6134 {ATGEN_ReplyGetMemory,
"AT+CPBR=" ,0x00,0x00,
ID_GetMemory },
6137 {MOTOROLA_ReplyGetMemoryInfo,
"AT+MPBR=?" ,0x00,0x00,ID_GetMemory },
6141 {MOTOROLA_ReplyGetMemory,
"AT+MPBR" ,0x00,0x00,ID_GetMemory },
6142 {ATGEN_ReplySetMemory,
"AT+CPBW" ,0x00,0x00,ID_SetMemory },
6155 {ATGEN_ReplyEnterSecurityCode,
"AT+CPIN2=" ,0x00,0x00,ID_EnterSecurityCode },
6159 {MOTOROLA_Banner,
"+MBAN:" ,0x00,0x00,ID_IncomingFrame },
6161 {ATGEN_GenericReply,
"AT+VTS" ,0x00,0x00,
ID_SendDTMF },
6162 {ATGEN_ReplyCancelCall,
"AT+CHUP" ,0x00,0x00,
ID_CancelCall },
6163 {ATGEN_ReplyDialVoice,
"ATD" ,0x00,0x00,
ID_DialVoice },
6164 {ATGEN_ReplyCancelCall,
"ATH" ,0x00,0x00,ID_CancelCall },
6166 {ATGEN_GenericReply,
"AT+CLIP" ,0x00,0x00,ID_SetIncomingCall },
6167 {ATGEN_GenericReply,
"AT+CCWA" ,0x00,0x00,ID_SetIncomingCall },
6168 {ATGEN_GenericReply,
"AT+CUSD" ,0x00,0x00,
ID_SetUSSD },
6169 {ATGEN_GenericReply,
"AT+CUSD" ,0x00,0x00,
ID_GetUSSD },
6170 {ATGEN_ReplyGetUSSD,
"+CUSD" ,0x00,0x00,ID_IncomingFrame },
6171 {ATGEN_GenericReply,
"AT+CLIP=1" ,0x00,0x00,ID_IncomingFrame },
6172 {ATGEN_ReplyIncomingCallInfo,
"+CLIP" ,0x00,0x00,ID_IncomingFrame },
6173 {ATGEN_ReplyIncomingCallInfo,
"+CCWA" ,0x00,0x00,ID_IncomingFrame },
6174 {ATGEN_ReplyIncomingCallInfo,
"+COLP" ,0x00,0x00,ID_IncomingFrame },
6175 {ATGEN_ReplyIncomingCallInfo,
"RING" ,0x00,0x00,ID_IncomingFrame },
6176 {ATGEN_ReplyIncomingCallInfo,
"+CRING" ,0x00,0x00,ID_IncomingFrame },
6177 {ATGEN_ReplyIncomingCallInfo,
"NO CARRIER" ,0x00,0x00,ID_IncomingFrame },
6179 {MOTOROLA_SetModeReply,
"AT+MODE" ,0x00,0x00,
ID_ModeSwitch },
6181 {ATGEN_ReplyReset,
"AT^SRESET" ,0x00,0x00,
ID_Reset },
6182 {ATGEN_ReplyReset,
"AT+CFUN=1,1" ,0x00,0x00,ID_Reset },
6192 {ATGEN_GenericReply,
"AT+CCFC=" ,0x00,0x00,
ID_SetDivert },
6193 {ATGEN_ReplyGetDivert,
"AT+CCFC=" ,0x00,0x00,
ID_Divert },
6197 {ATGEN_GenericReply,
"AT+SSHT?" ,0x00,0x00,ID_GetProtocol },
6202 {ATGEN_GenericReply,
"AT+ORGD=" ,0x00,0x00,ID_DeleteCalendarNote },
6207 {ATGEN_GenericReply,
"AT+SSHD=" ,0x00,0x00,ID_DeleteCalendarNote },
6210 {MOTOROLA_ReplyGetCalendarStatus,
"AT+MDBR=?" ,0x00,0x00,ID_GetCalendarNotesInfo },
6211 {MOTOROLA_ReplyGetCalendar,
"AT+MDBR=" ,0x00,0x00,ID_GetCalendarNote },
6212 {ATGEN_GenericReply,
"AT+MDBWE=" ,0x00,0x00,ID_DeleteCalendarNote },
6213 {MOTOROLA_ReplySetCalendar,
"AT+MDBW=" ,0x00,0x00,ID_SetCalendarNote },
6214 {ATGEN_GenericReply,
"AT+MDBL=" ,0x00,0x00,ID_SetCalendarNote },
6217 {ATGEN_GenericReplyIgnore,
"SAMSUNG PTS DG Test" ,0x00,0x00,ID_IncomingFrame },
6218 {ATGEN_GenericReplyIgnore,
"NOT FOND ^,NOT CUSTOM AT",0x00,0x00,ID_IncomingFrame },
6219 {ATGEN_GenericReplyIgnore,
"^RSSI:" ,0x00,0x00,ID_IncomingFrame },
6220 {ATGEN_GenericReplyIgnore,
"^HCSQ:" ,0x00,0x00,ID_IncomingFrame },
6221 {ATGEN_GenericReplyIgnore,
"^BOOT:" ,0x00,0x00,ID_IncomingFrame },
6222 {ATGEN_GenericReplyIgnore,
"^MODE:" ,0x00,0x00,ID_IncomingFrame },
6223 {ATGEN_GenericReplyIgnore,
"^DSFLOWRPT:" ,0x00,0x00,ID_IncomingFrame },
6224 {ATGEN_GenericReplyIgnore,
"^CSNR:" ,0x00,0x00,ID_IncomingFrame },
6225 {ATGEN_GenericReplyIgnore,
"^HCSQ:" ,0x00,0x00,ID_IncomingFrame },
6226 {ATGEN_GenericReplyIgnore,
"^SRVST:" ,0x00,0x00,ID_IncomingFrame },
6227 {ATGEN_GenericReplyIgnore,
"^SIMST:" ,0x00,0x00,ID_IncomingFrame },
6228 {ATGEN_GenericReplyIgnore,
"^STIN:" ,0x00,0x00,ID_IncomingFrame },
6229 {ATGEN_GenericReplyIgnore,
"+ZUSIMR:" ,0x00,0x00,ID_IncomingFrame },
6230 {ATGEN_GenericReplyIgnore,
"+ZEND" ,0x00,0x00,ID_IncomingFrame },
6231 {ATGEN_GenericReplyIgnore,
"+CDSI:" ,0x00,0x00,ID_IncomingFrame },
6232 {ATGEN_GenericReplyIgnore,
"+CLCC:" ,0x00,0x00,ID_IncomingFrame },
6238 #ifdef GSM_ENABLE_ATOBEX 6239 {ATGEN_GenericReply,
"AT*EOBEX=?" ,0x00,0x00,ID_SetOBEX },
6240 {ATGEN_GenericReply,
"AT*EOBEX" ,0x00,0x00,ID_SetOBEX },
6241 {ATGEN_GenericReply,
"AT+CPROT=0" ,0x00,0x00,ID_SetOBEX },
6242 {ATGEN_GenericReply,
"AT+MODE=22" ,0x00,0x00,ID_SetOBEX },
6243 {ATGEN_GenericReply,
"AT+XLNK" ,0x00,0x00,ID_SetOBEX },
6244 {ATGEN_GenericReply,
"AT^SQWE=3" ,0x00,0x00,ID_SetOBEX },
6245 {ATGEN_GenericReply,
"AT+SYNCML=MOBEXSTART" ,0x00,0x00,ID_SetOBEX },
6246 {ATGEN_GenericReply,
"AT$TSSPCSW=1" ,0x00,0x00,ID_SetOBEX },
6247 {ATGEN_GenericReply,
"AT^SQWE=0" ,0x00,0x00,ID_SetOBEX },
6248 {ATGEN_SQWEReply,
"AT^SQWE?" ,0x00,0x00,ID_GetProtocol },
6250 {ATGEN_GenericReply,
"AT*ESDF=" ,0x00,0x00,
ID_SetLocale },
6251 {ATGEN_GenericReply,
"AT*ESTF=" ,0x00,0x00,ID_SetLocale },
6256 {ATGEN_GenericReply,
"AT*EBCA" ,0x00,0x00,ID_GetBatteryCharge },
6259 #ifdef GSM_ENABLE_ALCATEL 6271 {ATGEN_GenericReply,
"AT+CFUN=" ,0x00,0x00,
ID_SetPower },
6272 {ATGEN_GenericReply,
"AT^CURC=" ,0x00,0x00,ID_SetIncomingCall },
6273 {ATGEN_GenericReply,
"AT^PORTSEL=" ,0x00,0x00,ID_SetIncomingCall },
6274 {ATGEN_GenericReply,
"AT+ZCDRUN=" ,0x00,0x00,
ID_Initialise },
6275 {ATGEN_GenericReply,
"AT+ZOPRT=" ,0x00,0x00,ID_Initialise },
6276 {ATGEN_GenericReply,
"AT\r" ,0x00,0x00,ID_Initialise },
6277 {ATGEN_GenericReply,
"AT\n" ,0x00,0x00,ID_Initialise },
6278 {ATGEN_GenericReply,
"OK" ,0x00,0x00,ID_Initialise },
6279 {ATGEN_GenericReply,
"AT\r" ,0x00,0x00,ID_IncomingFrame },
6281 {NULL,
"\x00" ,0x00,0x00,
ID_None }
6285 "A2D|iPAQ|at|M20|S25|MC35|TC35|C35i|S65|S300|5110|5130|5190|5210|6110|6130|6150|6190|6210|6250|6310|6310i|6510|7110|8210|8250|8290|8310|8390|8850|8855|8890|8910|9110|9210",
6356 ATGEN_GetCallDivert,
6357 ATGEN_SetCallDivert,
6358 ATGEN_CancelAllDiverts,
6389 ATGEN_GetCalendarStatus,
6391 ATGEN_GetNextCalendar,
6392 ATGEN_SetCalendarNote,
6393 ATGEN_AddCalendarNote,
6394 ATGEN_DelCalendarNote,
GSM_Error ATOBEX_ReplyGetTimeLocale(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_Error ATGEN_GetSMSC(GSM_StateMachine *s, GSM_SMSC *smsc)
GSM_Error ATGEN_GetAlarm(GSM_StateMachine *s, GSM_Alarm *Alarm)
GSM_SecurityCodeType * SecurityStatus
gboolean EnableIncomingUSSD
void GSM_TweakInternationalNumber(unsigned char *Number, const GSM_NumberType numType)
GSM_Error SAMSUNG_AddCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Note)
GSM_Error ATGEN_AnswerCall(GSM_StateMachine *s, int ID, gboolean all)
GSM_Error SAMSUNG_ORG_ReplySetCalendar(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_Error ATGEN_GetBatteryCharge(GSM_StateMachine *s, GSM_BatteryCharge *bat)
GSM_ChargeState ChargeState
GSM_Error ATGEN_ReplyAddSMSMessage(GSM_Protocol_Message *msg, GSM_StateMachine *s)
const unsigned char * GSM_GetNetworkName(const char *NetworkCode)
GSM_Error ATGEN_SetCharset(GSM_StateMachine *s, GSM_AT_Charset_Preference Prefer)
IncomingUSSDCallback IncomingUSSD
char * DecodeUnicodeString(const unsigned char *src)
void GSM_PhonebookFindDefaultNameNumberGroup(const GSM_MemoryEntry *entry, int *Name, int *Number, int *Group)
GSM_Error SIEMENS_GetCalendar(GSM_StateMachine *, GSM_CalendarEntry *)
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)
GSM_Error ATGEN_GetManufacturer(GSM_StateMachine *s)
GSM_Error SAMSUNG_SSH_ReplyGetCalendar(GSM_Protocol_Message *msg, GSM_StateMachine *s)
struct GSM_Protocol::@1 Data
void * IncomingCallUserData
char PBKMemories[AT_PBK_MAX_MEMORIES+1]
#define GSM_MAX_VERSION_LENGTH
GSM_Error SIEMENS_ReplyGetMemory(GSM_Protocol_Message *, GSM_StateMachine *)
GSM_Error ATGEN_GetMemory(GSM_StateMachine *s, GSM_MemoryEntry *entry)
GSM_Error ATGEN_HandleCMEError(GSM_StateMachine *s)
GSM_Error ATGEN_DialService(GSM_StateMachine *s, char *number)
GSM_MemoryType MemoryType
void * IncomingUSSDUserData
#define GSM_PHONEBOOK_TEXT_LENGTH
void FreeLines(GSM_CutLines *lines)
GSM_Error ATGEN_ResetPhoneSettings(GSM_StateMachine *s, GSM_ResetSettingsType Type)
int GSM_PackSemiOctetNumber(const unsigned char *Number, unsigned char *Output, gboolean semioctet)
GSM_AT_Feature PhoneSMSMemory
char Code[GSM_SECURITY_CODE_LEN+1]
GSM_ConnectionType ConnectionType
GSM_Error SAMSUNG_GetCalendarStatus(GSM_StateMachine *s, GSM_CalendarStatus *Status)
void CopyLineString(char *dest, const char *src, const GSM_CutLines *lines, int start)
GSM_Error ATGEN_GetRingtone(GSM_StateMachine *s, GSM_Ringtone *Ringtone, gboolean PhoneRingtone)
GSM_Error SIEMENS_ReplyGetMemoryInfo(GSM_Protocol_Message *msg, GSM_StateMachine *s)
unsigned char NetworkName[15 *2]
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_Error ATGEN_SetRingtone(GSM_StateMachine *s, GSM_Ringtone *Ringtone, int *maxlength)
GSM_Error ATGEN_Reset(GSM_StateMachine *s, gboolean hard)
#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_Error ATGEN_SendDTMF(GSM_StateMachine *s, char *sequence)
GSM_Error ATGEN_GetModel(GSM_StateMachine *s)
GSM_Error ATGEN_AddMemory(GSM_StateMachine *s, GSM_MemoryEntry *entry)
GSM_Error SAMSUNG_SetCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Note)
GSM_Error ATGEN_DeleteSMS(GSM_StateMachine *s, GSM_SMSMessage *sms)
GSM_Error SAMSUNG_GetBitmap(GSM_StateMachine *, GSM_Bitmap *)
GSM_Error ATGEN_Terminate(GSM_StateMachine *s)
GSM_Error ATGEN_HandleCMSError(GSM_StateMachine *s)
GSM_Error GSM_DispatchMessage(GSM_StateMachine *s)
GSM_Error ATGEN_SetAlarm(GSM_StateMachine *s, GSM_Alarm *Alarm)
int GSM_PackSevenBitsToEight(size_t offset, const unsigned char *input, unsigned char *output, size_t length)
GSM_Error ATGEN_GetDisplayStatus(GSM_StateMachine *s, GSM_DisplayFeatures *features)
GSM_Error ATGEN_GetMemoryStatus(GSM_StateMachine *s, GSM_MemoryStatus *Status)
GSM_Error ATGEN_Initialise(GSM_StateMachine *s)
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_Error SIEMENS_ReplyGetRingtone(GSM_Protocol_Message *, GSM_StateMachine *)
GSM_NetworkInfo * NetworkInfo
GSM_Error SIEMENS_ReplyGetBitmap(GSM_Protocol_Message *, GSM_StateMachine *)
GSM_Error ATGEN_IncomingSMSDeliver(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_Error SAMSUNG_ORG_ReplyGetCalendarStatus(GSM_Protocol_Message *msg, GSM_StateMachine *s)
size_t UnicodeLength(const unsigned char *str)
gboolean EnableIncomingCall
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_SetPower(GSM_StateMachine *s, gboolean on)
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 SIEMENS_ReplyGetNextCalendar(GSM_Protocol_Message *, GSM_StateMachine *)
#define GSM_MAX_MODEL_LENGTH
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)
void EncodeHexUnicode(char *dest, const unsigned char *src, size_t len)
GSM_Error ATGEN_SetMemory(GSM_StateMachine *s, GSM_MemoryEntry *entry)
char IMEI[GSM_MAX_IMEI_LENGTH+1]
char Version[GSM_MAX_VERSION_LENGTH+1]
GSM_Error ATGEN_CancelCall(GSM_StateMachine *s, int ID, gboolean all)
GSM_Error ATGEN_SetFastSMSSending(GSM_StateMachine *s, gboolean enable)
GSM_Error ATGEN_SetDateTime(GSM_StateMachine *s, GSM_DateTime *date_time)
GSM_Error ATGEN_GetSMSStatus(GSM_StateMachine *s, GSM_SMSMemoryStatus *status)
GSM_Error ATGEN_GetNetworkInfo(GSM_StateMachine *s, GSM_NetworkInfo *netinfo)
GSM_AT_Charset GSMCharset
GSM_Error ATGEN_DialVoice(GSM_StateMachine *s, char *number, GSM_CallShowNumber ShowNumber)
GSM_Error ATGEN_ReplyGetSMSMessage(GSM_Protocol_Message *msg, GSM_StateMachine *s)
char Manufacturer[GSM_MAX_MANUFACTURER_LENGTH+1]
GSM_AT_Feature PhoneSaveSMS
GSM_Error ATOBEX_ReplyGetBatteryCharge(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_PhoneModel * ModelInfo
int smprintf_level(GSM_StateMachine *s, GSM_DebugSeverity severity, const char *format,...)
unsigned char Text[(GSM_MAX_CALENDAR_TEXT_LENGTH+1) *2]
GSM_Error ATGEN_ReplySendSMS(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_Error SIEMENS_ReplySetRingtone(GSM_Protocol_Message *, GSM_StateMachine *)
#define GSM_MAX_IMEI_LENGTH
GSM_SignalQuality * SignalQuality
GSM_Error SAMSUNG_ReplySetRingtone(GSM_Protocol_Message *, GSM_StateMachine *)
#define GSM_WaitForAutoLen(s, buffer, type, timeout, request)
gboolean DecodeHexUnicode(unsigned char *dest, const char *src, size_t len)
GSM_Error ATGEN_GetBitmap(GSM_StateMachine *s, GSM_Bitmap *Bitmap)
#define GSM_MAX_USSD_LENGTH
void GSM_ClearBatteryCharge(GSM_BatteryCharge *bat)
GSM_Error ATGEN_AddSMS(GSM_StateMachine *s, GSM_SMSMessage *sms)
unsigned char Text[(GSM_PHONEBOOK_TEXT_LENGTH+1) *2]
GSM_Error SAMSUNG_ReplyGetBitmap(GSM_Protocol_Message *, GSM_StateMachine *)
GSM_Error ATGEN_GetDateTime(GSM_StateMachine *s, GSM_DateTime *date_time)
GSM_Error SAMSUNG_ReplyGetMemoryInfo(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_Error ATGEN_GetSMS(GSM_StateMachine *s, GSM_MultiSMSMessage *sms)
GSM_Error SAMSUNG_ReplyGetMemory(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_PhoneModel * GetModelData(GSM_StateMachine *s, const char *model, const char *number, const char *irdamodel)
void InitLines(GSM_CutLines *lines)
void EncodeUnicode(unsigned char *dest, const char *src, size_t len)
GSM_AT_Feature SIMSMSMemory
GSM_Error SAMSUNG_SetBitmap(GSM_StateMachine *, GSM_Bitmap *)
struct GSM_Phone_Data::@2 Priv
GSM_Error SAMSUNG_GetNextCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Note, gboolean start)
GSM_Error SAMSUNG_ReplyGetRingtone(GSM_Protocol_Message *, GSM_StateMachine *)
gboolean GSM_AddPhoneFeature(GSM_PhoneModel *model, GSM_Feature feature)
GSM_Reply_Function ATGENReplyFunctions[]
GSM_Error ATOBEX_ReplyGetDateLocale(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_Error SIEMENS_SetMemory(GSM_StateMachine *s, GSM_MemoryEntry *entry)
GSM_Error ATGEN_ParseReply(GSM_StateMachine *s, const unsigned char *input, const char *format,...)
GSM_Error GSM_WaitFor(GSM_StateMachine *s, unsigned const char *buffer, size_t length, int type, int timeout, GSM_Phone_RequestID request)
GSM_Error SIEMENS_GetRingtone(GSM_StateMachine *, GSM_Ringtone *, gboolean)
GSM_Error ATGEN_DeleteAllMemory(GSM_StateMachine *s, GSM_MemoryType type)
unsigned char Number[(GSM_MAX_NUMBER_LENGTH+1) *2]
GSM_Error SAMSUNG_ORG_ReplyGetCalendar(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_Error ATGEN_SendSavedSMS(GSM_StateMachine *s, int Folder, int Location)
unsigned char Text[2 *(GSM_MAX_USSD_LENGTH+1)]
#define GSM_MAX_MANUFACTURER_LENGTH
GSM_Error SIEMENS_GetNextCalendar(GSM_StateMachine *, GSM_CalendarEntry *, gboolean)
GSM_AT_Feature SIMSaveSMS
GSM_Error SIEMENS_ReplyDelCalendarNote(GSM_Protocol_Message *, GSM_StateMachine *)
GSM_Error ATGEN_SendSMS(GSM_StateMachine *s, GSM_SMSMessage *sms)
GSM_Error SAMSUNG_SetMemory(GSM_StateMachine *s, GSM_MemoryEntry *entry)
GSM_AT_Charset_Preference
GSM_Coding_Type GSM_GetMessageCoding(GSM_Debug_Info *di, const char TPDCS)
void DecodeUTF8(unsigned char *dest, const char *src, size_t len)
GSM_Divert_CallTypes CallType
GSM_Phone_RequestID RequestID
GSM_AT_SMS_Cache * SMSCache
GSM_Error ATGEN_SetIncomingCall(GSM_StateMachine *s, gboolean enable)
int GetLineLength(const char *message UNUSED, const GSM_CutLines *lines, int start)
gboolean CheckTime(GSM_DateTime *date)
GSM_Error ATGEN_PressKey(GSM_StateMachine *s, GSM_KeyCode Key, gboolean Press)
GSM_AT_Charset NormalCharset
int(* ReadDevice)(GSM_StateMachine *s, void *buf, size_t nbytes)
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)
char NewPIN[GSM_SECURITY_CODE_LEN+1]
GSM_Error ATOBEX_ReplyGetFileSystemStatus(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_Device_Functions * Functions
IncomingCallCallback IncomingCall
GSM_MultiCallDivert * Divert
GSM_Error SIEMENS_SetBitmap(GSM_StateMachine *, GSM_Bitmap *)
GSM_Divert_DivertTypes DivertType
GSM_BatteryCharge * BatteryCharge
GSM_CallDivert Entries[GSM_MAX_CALL_DIVERTS]
unsigned char PhoneNumber[(GSM_MAX_NUMBER_LENGTH+1) *2]
GSM_NetworkInfo_State State
GSM_Error ATGEN_GetSecurityStatus(GSM_StateMachine *s, GSM_SecurityCodeType *Status)
gboolean mywstrncmp(unsigned const char *a, unsigned const char *b, int num)
GSM_Error ATGEN_DeleteMemory(GSM_StateMachine *s, GSM_MemoryEntry *entry)
GSM_Error ATGEN_SetAutoNetworkLogin(GSM_StateMachine *s)
GSM_Error SONYERICSSON_Reply_ScreenshotData(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_Error SIEMENS_ReplySetBitmap(GSM_Protocol_Message *, GSM_StateMachine *)
int GSM_UnpackEightBitsToSeven(size_t offset, size_t in_length, size_t out_length, const unsigned char *input, unsigned char *output)
GSM_MemoryType MemoryType
GSM_SamsungCalendar SamsungCalendar
gboolean GSM_IsPhoneFeatureAvailable(GSM_PhoneModel *model, GSM_Feature feature)
GSM_Error ATGEN_SetBitmap(GSM_StateMachine *s, GSM_Bitmap *Bitmap)
GSM_Error SIEMENS_SetCalendarNote(GSM_StateMachine *, GSM_CalendarEntry *)
GSM_Error SIEMENS_SetRingtone(GSM_StateMachine *, GSM_Ringtone *, int *)
gboolean DecodeHexBin(unsigned char *dest, const unsigned char *src, size_t len)
GSM_EntryLocation Location
GSM_Error ATGEN_SetSMSC(GSM_StateMachine *s, GSM_SMSC *smsc)
void EncodeHexBin(char *dest, const unsigned char *src, size_t len)
GSM_Error ATGEN_GetNextMemory(GSM_StateMachine *s, GSM_MemoryEntry *entry, gboolean start)
void GSM_CreateFirmwareNumber(GSM_StateMachine *s)
GSM_AT_Charset UnicodeCharset
#define GSM_SECURITY_CODE_LEN
void DecodeUnicode(const unsigned char *src, char *dest)
GSM_Error ATGEN_GetIMEI(GSM_StateMachine *s)
GSM_Error SIEMENS_AddCalendarNote(GSM_StateMachine *, GSM_CalendarEntry *)
GSM_NetworkInfo_State PacketState
GSM_Error SAMSUNG_GetCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Note)
GSM_Error ATGEN_ReplyIncomingCB(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_Error SAMSUNG_DelCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Note)
#define GSM_MAX_CALL_DIVERTS
gboolean EncodeUTF8(char *dest, const unsigned char *src)
GSM_Protocol_Functions * Functions
GSM_AT_Charset IRACharset
int MotorolaFirstMemoryEntry
GSM_Error ATGEN_DispatchMessage(GSM_StateMachine *s)
GSM_SecurityCodeType Type
GSM_Error SONYERICSSON_Reply_Screenshot(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_Error SAMSUNG_SetRingtone(GSM_StateMachine *, GSM_Ringtone *, int *)
GSM_Error SONYERICSSON_GetScreenshot(GSM_StateMachine *s, GSM_BinaryPicture *picture)
GSM_DisplayFeatures * DisplayFeatures
GSM_Error SIEMENS_GetBitmap(GSM_StateMachine *, GSM_Bitmap *)
void SplitLines(const char *message, const size_t messagesize, GSM_CutLines *lines, const char *whitespaces, const size_t spaceslen, const char *quotes, const size_t quoteslen, const gboolean eot)
GSM_AT_Reply_State ReplyState
GSM_Error SAMSUNG_GetRingtone(GSM_StateMachine *, GSM_Ringtone *, gboolean)
void EncodeDefault(unsigned char *dest, const unsigned char *src, size_t *len, gboolean UseExtensions, unsigned char *ExtraAlphabet)
GSM_Error SAMSUNG_SSH_ReplyGetCalendarStatus(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_Error SAMSUNG_ReplySetBitmap(GSM_Protocol_Message *, GSM_StateMachine *)
GSM_AT_Manufacturer Manufacturer
gboolean CheckDate(GSM_DateTime *date)
char Model[GSM_MAX_MODEL_LENGTH+1]
GSM_Error SIEMENS_ReplyAddCalendarNote(GSM_Protocol_Message *, GSM_StateMachine *)
GSM_Error ATGEN_SetIncomingCB(GSM_StateMachine *s, gboolean enable)
GSM_Error SIEMENS_DelCalendarNote(GSM_StateMachine *, GSM_CalendarEntry *)
GSM_Error ATGEN_ReplyGetMessageList(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_Protocol_Message * RequestMsg
#define AT_PBK_MAX_MEMORIES
GSM_Error ATGEN_GetSIMIMSI(GSM_StateMachine *s, char *IMSI)
GSM_Error ATGEN_GetSignalQuality(GSM_StateMachine *s, GSM_SignalQuality *sig)
unsigned char * PhoneString
GSM_Error ATGEN_ReplyGetCNMIMode(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_Error ATGEN_SetIncomingSMS(GSM_StateMachine *s, gboolean enable)
GSM_Error SIEMENS_ReplySetMemory(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_Error ATGEN_EnterSecurityCode(GSM_StateMachine *s, GSM_SecurityCode *Code)
const unsigned char * GSM_GetCountryName(const char *CountryCode)
GSM_Error ATGEN_GetFirmware(GSM_StateMachine *s)
int smprintf(GSM_StateMachine *s, const char *format,...)
GSM_Error ATGEN_SetIncomingUSSD(GSM_StateMachine *s, gboolean enable)
GSM_Error ATGEN_ReplyGetSMSStatus(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_SubMemoryEntry Entries[GSM_PHONEBOOK_ENTRIES]