5 A Linux/Unix toolset and driver for Nokia mobile phones.
7 Copyright (C) 1999, 2000 Hugh Blemings & Pavel JanÃk ml.
9 Released under the terms of the GNU GPL, see file COPYING for more details.
14 Revision 1.1.1.1.4.1 2001/11/27 20:19:50 short
15 Update: orig2001_11_25_22_56 -> orig2001_11_27_05_17
18 Revision 1.1.1.1.2.1 2001/11/27 04:37:59 short
19 Update: orig2001_11_25_22_56 -> orig2001_11_27_05_17
21 Revision 1.1.1.2 2001/11/27 04:19:24 short
22 :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Tue Nov 27 05:17 CET 2001
24 Revision 1.20 2001/11/26 18:06:08 pkot
25 Checking for *printf functions, N_(x) for localization, generic ARRAY_LEN, SAFE_STRNCPY, G_GNUC_PRINTF (Jan Kratochvil)
27 Revision 1.19 2001/11/22 17:56:53 pkot
28 smslib update. sms sending
30 Revision 1.18 2001/09/09 21:45:49 machek
31 Cleanups from Ladislav Michl <ladis@psi.cz>:
33 *) do *not* internationalize debug messages
35 *) some whitespace fixes, do not use //
37 *) break is unneccessary after return
39 Revision 1.17 2001/08/09 12:34:34 pkot
40 3330 and 6250 support - I have no idea if it does work (mygnokii)
42 Revision 1.16 2001/03/21 23:36:04 chris
43 Added the statemachine
44 This will break gnokii --identify and --monitor except for 6210/7110
46 Revision 1.15 2001/03/06 10:38:52 machek
47 Dancall models added to the global list.
49 Revision 1.14 2001/02/06 13:55:23 pkot
50 Enabled authentication in 51xx models
52 Revision 1.13 2001/02/02 08:09:56 ja
53 New dialogs for 6210/7110 in xgnokii. Fixed the smsd for new capabilty code.
62 int GetLine(FILE *File, char *Line, int count)
66 if (fgets(Line, count, File)) {
67 ptr = Line + strlen(Line) - 1;
69 while ( (*ptr == '\n' || *ptr == '\r') && ptr >= Line)
78 static PhoneModel models[] = {
80 {"2711", "?????", PM_SMS }, /* Dancall */
81 {"2731", "?????", PM_SMS },
82 {"1611", "NHE-5", 0 },
83 {"2110i", "NHE-4", PM_SMS },
84 {"2148i", "NHK-4", 0 },
85 {"3110", "0310" , PM_SMS | PM_DTMF | PM_DATA }, /* NHE-8 */
86 {"3210", "NSE-8", PM_SMS | PM_DTMF },
87 {"3210", "NSE-9", PM_SMS | PM_DTMF },
88 {"3310", "NHM-5", PM_SMS | PM_DTMF },
89 {"3330", "NHM-6", PM_SMS | PM_DTMF },
90 {"3810", "0305" , PM_SMS | PM_DTMF | PM_DATA }, /* NHE-9 */
91 {"5110", "NSE-1", PM_NETMONITOR | PM_KEYBOARD | PM_SMS | PM_DTMF | PM_DATA | PM_SPEEDDIAL | PM_AUTHENTICATION },
92 {"5130", "NSK-1", PM_NETMONITOR | PM_KEYBOARD | PM_SMS | PM_DTMF | PM_DATA | PM_SPEEDDIAL | PM_AUTHENTICATION },
93 {"5160", "NSW-1", PM_NETMONITOR | PM_KEYBOARD | PM_SMS | PM_DTMF | PM_DATA | PM_SPEEDDIAL | PM_AUTHENTICATION },
94 {"5190", "NSB-1", PM_NETMONITOR | PM_KEYBOARD | PM_SMS | PM_DTMF | PM_DATA | PM_SPEEDDIAL | PM_AUTHENTICATION },
95 {"6110", "NSE-3", PM_CALLERGROUP | PM_CALENDAR | PM_NETMONITOR | PM_KEYBOARD | PM_SMS | PM_DTMF | PM_DATA | PM_SPEEDDIAL | PM_AUTHENTICATION },
96 {"6120", "NSC-3", PM_CALLERGROUP | PM_CALENDAR | PM_NETMONITOR | PM_KEYBOARD | PM_SMS | PM_DTMF | PM_DATA | PM_SPEEDDIAL | PM_AUTHENTICATION },
97 {"6130", "NSK-3", PM_CALLERGROUP | PM_CALENDAR | PM_NETMONITOR | PM_KEYBOARD | PM_SMS | PM_DTMF | PM_DATA | PM_SPEEDDIAL | PM_AUTHENTICATION },
98 {"6150", "NSM-1", PM_CALLERGROUP | PM_CALENDAR | PM_NETMONITOR | PM_KEYBOARD | PM_SMS | PM_DTMF | PM_DATA | PM_SPEEDDIAL | PM_AUTHENTICATION },
99 {"616x", "NSW-3", PM_CALLERGROUP | PM_CALENDAR | PM_NETMONITOR | PM_KEYBOARD | PM_SMS | PM_DTMF | PM_DATA | PM_SPEEDDIAL | PM_AUTHENTICATION },
100 {"6185", "NSD-3", PM_CALLERGROUP | PM_CALENDAR | PM_NETMONITOR | PM_KEYBOARD | PM_SMS | PM_DTMF | PM_DATA | PM_SPEEDDIAL | PM_AUTHENTICATION },
101 {"6190", "NSB-3", PM_CALLERGROUP | PM_CALENDAR | PM_NETMONITOR | PM_KEYBOARD | PM_SMS | PM_DTMF | PM_DATA | PM_SPEEDDIAL | PM_AUTHENTICATION },
102 {"6210", "NPE-3", PM_CALLERGROUP | PM_CALENDAR | PM_EXTPBK | PM_SMS},
103 {"6250", "NHM-3", PM_CALLERGROUP | PM_CALENDAR | PM_EXTPBK },
104 {"7110", "NSE-5", PM_CALLERGROUP | PM_SPEEDDIAL | PM_EXTPBK },
105 {"8810", "NSE-6", PM_SMS | PM_DTMF | PM_DATA },
106 {"8110i", "0423", PM_SMS | PM_DTMF | PM_DATA }, /* Guess for NHE-6 */
107 {"8110", "0423" , PM_SMS | PM_DTMF | PM_DATA }, /* NHE-6BX */
108 {"9000i", "RAE-4", 0 },
109 {"9110", "RAE-2", 0 },
110 {"550", "THF-10", 0 },
111 {"540", "THF-11", 0 },
112 {"650", "THF-12", 0 },
113 {"640", "THF-13", 0 },
117 PhoneModel *GetPhoneModel (const char *num)
121 while (models[i].number != NULL) {
122 if (strcmp (num, models[i].number) == 0) {
123 dprintf("Found model\n");
127 dprintf("comparing %s and %s\n", num, models[i].number);
135 inline char *GetModel (const char *num)
137 return (GetPhoneModel(num)->model);
140 #ifndef HAVE_VASPRINTF
141 /* Adapted from snprintf(3) man page: */
142 int gvasprintf(char **destp, const char *fmt, va_list ap)
147 if (!(p = malloc(size))) {
152 /* Try to print in the allocated space. */
153 n = gvsprintf(p, size, fmt, ap);
154 /* If that worked, return the string. */
155 if (n > -1 && n < size) {
159 /* Else try again with more space. */
160 if (n > -1) /* glibc 2.1 */
161 size = n + 1; /* precisely what is needed */
163 size *= 2; /* twice the old size */
164 if (!(pnew = realloc(p, size))) {
174 #ifndef HAVE_ASPRINTF
175 int gasprintf(char **destp, const char *fmt,...)
181 r = gvasprintf(destp, fmt, ap);