author | zautrix <zautrix> | 2004-10-05 11:13:51 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-05 11:13:51 (UTC) |
commit | 50ab40e1e02ad7c65c17a78d08116a808b1257aa (patch) (unidiff) | |
tree | 0d1939e2297fa7bbd8e1f2030f154463854164c6 /gammu/emb/common/phone | |
parent | cf8616f64f20e5448d4ff644f7cc15750cf3f85f (diff) | |
download | kdepimpi-50ab40e1e02ad7c65c17a78d08116a808b1257aa.zip kdepimpi-50ab40e1e02ad7c65c17a78d08116a808b1257aa.tar.gz kdepimpi-50ab40e1e02ad7c65c17a78d08116a808b1257aa.tar.bz2 |
updated to latest gammu version
21 files changed, 1071 insertions, 167 deletions
diff --git a/gammu/emb/common/phone/alcatel/alcatel.c b/gammu/emb/common/phone/alcatel/alcatel.c index f004ad4..3821f13 100644 --- a/gammu/emb/common/phone/alcatel/alcatel.c +++ b/gammu/emb/common/phone/alcatel/alcatel.c | |||
@@ -92,24 +92,25 @@ extern GSM_Error ATGEN_GetSecurityStatus (GSM_StateMachine *s, GSM_SecurityCodeT | |||
92 | extern GSM_Error ATGEN_ResetPhoneSettings(GSM_StateMachine *s, GSM_ResetSettingsType Type); | 92 | extern GSM_Error ATGEN_ResetPhoneSettings(GSM_StateMachine *s, GSM_ResetSettingsType Type); |
93 | extern GSM_Error ATGEN_SendDTMF (GSM_StateMachine *s, char *sequence); | 93 | extern GSM_Error ATGEN_SendDTMF (GSM_StateMachine *s, char *sequence); |
94 | extern GSM_Error ATGEN_GetSIMIMSI (GSM_StateMachine *s, char *IMSI); | 94 | extern GSM_Error ATGEN_GetSIMIMSI (GSM_StateMachine *s, char *IMSI); |
95 | extern GSM_Error ATGEN_HandleCMSError (GSM_StateMachine *s); | 95 | extern GSM_Error ATGEN_HandleCMSError (GSM_StateMachine *s); |
96 | extern GSM_Error ATGEN_GetNetworkInfo (GSM_StateMachine *s, GSM_NetworkInfo *netinfo); | 96 | extern GSM_Error ATGEN_GetNetworkInfo (GSM_StateMachine *s, GSM_NetworkInfo *netinfo); |
97 | extern GSM_Error ATGEN_Reset (GSM_StateMachine *s, bool hard); | 97 | extern GSM_Error ATGEN_Reset (GSM_StateMachine *s, bool hard); |
98 | extern GSM_Error ATGEN_PressKey (GSM_StateMachine *s, GSM_KeyCode Key, bool Press); | 98 | extern GSM_Error ATGEN_PressKey (GSM_StateMachine *s, GSM_KeyCode Key, bool Press); |
99 | extern GSM_Error ATGEN_GetDisplayStatus (GSM_StateMachine *s, GSM_DisplayFeatures *features); | 99 | extern GSM_Error ATGEN_GetDisplayStatus (GSM_StateMachine *s, GSM_DisplayFeatures *features); |
100 | extern GSM_Error ATGEN_SetAutoNetworkLogin(GSM_StateMachine *s); | 100 | extern GSM_Error ATGEN_SetAutoNetworkLogin(GSM_StateMachine *s); |
101 | extern GSM_Error ATGEN_DeleteAllMemory (GSM_StateMachine *s, GSM_MemoryType type); | 101 | extern GSM_Error ATGEN_DeleteAllMemory (GSM_StateMachine *s, GSM_MemoryType type); |
102 | 102 | ||
103 | extern GSM_Error ATGEN_DispatchMessage (GSM_StateMachine *s); | 103 | extern GSM_Error ATGEN_DispatchMessage (GSM_StateMachine *s); |
104 | extern GSM_Error ATGEN_SetFastSMSSending(GSM_StateMachine *s, bool enable); | ||
104 | extern GSM_Error ATGEN_SetIncomingCB (GSM_StateMachine *s, bool enable); | 105 | extern GSM_Error ATGEN_SetIncomingCB (GSM_StateMachine *s, bool enable); |
105 | extern GSM_Error ATGEN_SetIncomingSMS (GSM_StateMachine *s, bool enable); | 106 | extern GSM_Error ATGEN_SetIncomingSMS (GSM_StateMachine *s, bool enable); |
106 | 107 | ||
107 | /** | 108 | /** |
108 | * Alcatel uses some 8-bit characters in contacts, calendar etc.. This table | 109 | * Alcatel uses some 8-bit characters in contacts, calendar etc.. This table |
109 | * attempts to decode it, it is probably not complete, here are just chars | 110 | * attempts to decode it, it is probably not complete, here are just chars |
110 | * that I found... | 111 | * that I found... |
111 | */ | 112 | */ |
112 | unsigned char GSM_AlcatelAlphabet[] = | 113 | unsigned char GSM_AlcatelAlphabet[] = |
113 | { | 114 | { |
114 | /* in phone unicode description*/ | 115 | /* in phone unicode description*/ |
115 | 0x80, 0x00,0x20, /* empty */ | 116 | 0x80, 0x00,0x20, /* empty */ |
@@ -535,24 +536,26 @@ static GSM_Error ALCATEL_SetATMode(GSM_StateMachine *s) | |||
535 | if (Priv->Mode == ModeAT) return ERR_NONE; | 536 | if (Priv->Mode == ModeAT) return ERR_NONE; |
536 | 537 | ||
537 | error = ALCATEL_GoToBinaryState(s, StateAttached, 0, 0); | 538 | error = ALCATEL_GoToBinaryState(s, StateAttached, 0, 0); |
538 | if (error != ERR_NONE) return error; | 539 | if (error != ERR_NONE) return error; |
539 | 540 | ||
540 | error = s->Protocol.Functions->Terminate(s); | 541 | error = s->Protocol.Functions->Terminate(s); |
541 | if (error != ERR_NONE) return error; | 542 | if (error != ERR_NONE) return error; |
542 | 543 | ||
543 | dbgprintf ("Changing protocol to AT\n"); | 544 | dbgprintf ("Changing protocol to AT\n"); |
544 | s->Protocol.Functions = &ATProtocol; | 545 | s->Protocol.Functions = &ATProtocol; |
545 | s->Phone.Functions->ReplyFunctions= ATGENReplyFunctions; | 546 | s->Phone.Functions->ReplyFunctions= ATGENReplyFunctions; |
546 | Priv->Mode = ModeAT; | 547 | Priv->Mode = ModeAT; |
548 | s->Phone.Data.Priv.ATGEN.PBKCharset= 0; | ||
549 | s->Phone.Data.Priv.ATGEN.PBKMemory= 0; | ||
547 | 550 | ||
548 | my_sleep(100); | 551 | my_sleep(100); |
549 | 552 | ||
550 | /* In case we don't send AT command short after closing binary mode, | 553 | /* In case we don't send AT command short after closing binary mode, |
551 | * phone takes VERY long to react next time. The error code in | 554 | * phone takes VERY long to react next time. The error code in |
552 | * intetionally ignored. | 555 | * intetionally ignored. |
553 | */ | 556 | */ |
554 | GSM_WaitFor (s, "AT\r", 3, 0x00, 0, ID_IncomingFrame); | 557 | GSM_WaitFor (s, "AT\r", 3, 0x00, 0, ID_IncomingFrame); |
555 | 558 | ||
556 | return ERR_NONE; | 559 | return ERR_NONE; |
557 | } | 560 | } |
558 | 561 | ||
@@ -3813,24 +3816,32 @@ static GSM_Error ALCATEL_SetIncomingCB (GSM_StateMachine *s, bool enable) | |||
3813 | if ((error = ALCATEL_SetATMode(s))!= ERR_NONE) return error; | 3816 | if ((error = ALCATEL_SetATMode(s))!= ERR_NONE) return error; |
3814 | return ATGEN_SetIncomingCB(s, enable); | 3817 | return ATGEN_SetIncomingCB(s, enable); |
3815 | } | 3818 | } |
3816 | 3819 | ||
3817 | static GSM_Error ALCATEL_SetIncomingSMS (GSM_StateMachine *s, bool enable) | 3820 | static GSM_Error ALCATEL_SetIncomingSMS (GSM_StateMachine *s, bool enable) |
3818 | { | 3821 | { |
3819 | GSM_Error error; | 3822 | GSM_Error error; |
3820 | 3823 | ||
3821 | if ((error = ALCATEL_SetATMode(s))!= ERR_NONE) return error; | 3824 | if ((error = ALCATEL_SetATMode(s))!= ERR_NONE) return error; |
3822 | return ATGEN_SetIncomingSMS(s, enable); | 3825 | return ATGEN_SetIncomingSMS(s, enable); |
3823 | } | 3826 | } |
3824 | 3827 | ||
3828 | static GSM_Error ALCATEL_SetFastSMSSending(GSM_StateMachine *s, bool enable) | ||
3829 | { | ||
3830 | GSM_Error error; | ||
3831 | |||
3832 | if ((error = ALCATEL_SetATMode(s))!= ERR_NONE) return error; | ||
3833 | return ATGEN_SetFastSMSSending(s, enable); | ||
3834 | } | ||
3835 | |||
3825 | static GSM_Reply_Function ALCATELReplyFunctions[] = { | 3836 | static GSM_Reply_Function ALCATELReplyFunctions[] = { |
3826 | {ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelAttach }, | 3837 | {ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelAttach }, |
3827 | {ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelDetach }, | 3838 | {ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelDetach }, |
3828 | {ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelCommit }, | 3839 | {ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelCommit }, |
3829 | {ALCATEL_ReplyCommit, "\x02",0x00,0x00, ID_AlcatelCommit2 }, | 3840 | {ALCATEL_ReplyCommit, "\x02",0x00,0x00, ID_AlcatelCommit2 }, |
3830 | {ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelEnd }, | 3841 | {ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelEnd }, |
3831 | {ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelClose }, | 3842 | {ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelClose }, |
3832 | {ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelStart }, | 3843 | {ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelStart }, |
3833 | {ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelSelect1 }, | 3844 | {ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelSelect1 }, |
3834 | {ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelSelect2 }, | 3845 | {ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelSelect2 }, |
3835 | {ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelSelect3 }, | 3846 | {ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelSelect3 }, |
3836 | {ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelBegin1 }, | 3847 | {ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelBegin1 }, |
@@ -3904,24 +3915,25 @@ GSM_Phone_Functions ALCATELPhone = { | |||
3904 | NOTSUPPORTED, /* GetSpeedDial */ | 3915 | NOTSUPPORTED, /* GetSpeedDial */ |
3905 | NOTSUPPORTED, /* SetSpeedDial */ | 3916 | NOTSUPPORTED, /* SetSpeedDial */ |
3906 | ALCATEL_GetSMSC, | 3917 | ALCATEL_GetSMSC, |
3907 | ALCATEL_SetSMSC, | 3918 | ALCATEL_SetSMSC, |
3908 | ALCATEL_GetSMSStatus, | 3919 | ALCATEL_GetSMSStatus, |
3909 | ALCATEL_GetSMS, | 3920 | ALCATEL_GetSMS, |
3910 | ALCATEL_GetNextSMS, | 3921 | ALCATEL_GetNextSMS, |
3911 | NOTSUPPORTED, /* SetSMS */ | 3922 | NOTSUPPORTED, /* SetSMS */ |
3912 | ALCATEL_AddSMS, | 3923 | ALCATEL_AddSMS, |
3913 | ALCATEL_DeleteSMS, | 3924 | ALCATEL_DeleteSMS, |
3914 | ALCATEL_SendSMS, | 3925 | ALCATEL_SendSMS, |
3915 | ALCATEL_SendSavedSMS, | 3926 | ALCATEL_SendSavedSMS, |
3927 | ALCATEL_SetFastSMSSending, | ||
3916 | ALCATEL_SetIncomingSMS, | 3928 | ALCATEL_SetIncomingSMS, |
3917 | ALCATEL_SetIncomingCB, | 3929 | ALCATEL_SetIncomingCB, |
3918 | ALCATEL_GetSMSFolders, | 3930 | ALCATEL_GetSMSFolders, |
3919 | NOTSUPPORTED, /* AddSMSFolder */ | 3931 | NOTSUPPORTED, /* AddSMSFolder */ |
3920 | NOTSUPPORTED, /* DeleteSMSFolder */ | 3932 | NOTSUPPORTED, /* DeleteSMSFolder */ |
3921 | ALCATEL_DialVoice, | 3933 | ALCATEL_DialVoice, |
3922 | ALCATEL_AnswerCall, | 3934 | ALCATEL_AnswerCall, |
3923 | ALCATEL_CancelCall, | 3935 | ALCATEL_CancelCall, |
3924 | NOTSUPPORTED, /* HoldCall */ | 3936 | NOTSUPPORTED, /* HoldCall */ |
3925 | NOTSUPPORTED, /* UnholdCall */ | 3937 | NOTSUPPORTED, /* UnholdCall */ |
3926 | NOTSUPPORTED, /* ConferenceCall */ | 3938 | NOTSUPPORTED, /* ConferenceCall */ |
3927 | NOTSUPPORTED, /* SplitCall */ | 3939 | NOTSUPPORTED, /* SplitCall */ |
@@ -3958,25 +3970,25 @@ GSM_Phone_Functions ALCATELPhone = { | |||
3958 | ALCATEL_AddToDo, | 3970 | ALCATEL_AddToDo, |
3959 | ALCATEL_DeleteToDo, | 3971 | ALCATEL_DeleteToDo, |
3960 | ALCATEL_DeleteAllToDo, | 3972 | ALCATEL_DeleteAllToDo, |
3961 | ALCATEL_GetCalendarStatus, | 3973 | ALCATEL_GetCalendarStatus, |
3962 | ALCATEL_GetCalendar, | 3974 | ALCATEL_GetCalendar, |
3963 | ALCATEL_GetNextCalendar, | 3975 | ALCATEL_GetNextCalendar, |
3964 | ALCATEL_SetCalendar, | 3976 | ALCATEL_SetCalendar, |
3965 | ALCATEL_AddCalendar, | 3977 | ALCATEL_AddCalendar, |
3966 | ALCATEL_DeleteCalendar, | 3978 | ALCATEL_DeleteCalendar, |
3967 | ALCATEL_DeleteAllCalendar, | 3979 | ALCATEL_DeleteAllCalendar, |
3968 | NOTSUPPORTED, /* GetCalendarSettings*/ | 3980 | NOTSUPPORTED, /* GetCalendarSettings*/ |
3969 | NOTSUPPORTED, /* SetCalendarSettings*/ | 3981 | NOTSUPPORTED, /* SetCalendarSettings*/ |
3970 | NOTSUPPORTED, /* GetNote */ | 3982 | NOTSUPPORTED, /* GetNextNote */ |
3971 | NOTSUPPORTED, /* GetProfile */ | 3983 | NOTSUPPORTED, /* GetProfile */ |
3972 | NOTSUPPORTED, /* SetProfile */ | 3984 | NOTSUPPORTED, /* SetProfile */ |
3973 | NOTSUPPORTED, /* GetFMStation */ | 3985 | NOTSUPPORTED, /* GetFMStation */ |
3974 | NOTSUPPORTED, /* SetFMStation */ | 3986 | NOTSUPPORTED, /* SetFMStation */ |
3975 | NOTSUPPORTED, /* ClearFMStations */ | 3987 | NOTSUPPORTED, /* ClearFMStations */ |
3976 | NOTSUPPORTED, /* GetNextFileFolder*/ | 3988 | NOTSUPPORTED, /* GetNextFileFolder*/ |
3977 | NOTSUPPORTED, /* GetFilePart */ | 3989 | NOTSUPPORTED, /* GetFilePart */ |
3978 | NOTSUPPORTED, /* AddFilePart */ | 3990 | NOTSUPPORTED, /* AddFilePart */ |
3979 | NOTSUPPORTED, /* GetFileSystemStatus*/ | 3991 | NOTSUPPORTED, /* GetFileSystemStatus*/ |
3980 | NOTSUPPORTED, /* DeleteFile */ | 3992 | NOTSUPPORTED, /* DeleteFile */ |
3981 | NOTSUPPORTED, /* AddFolder */ | 3993 | NOTSUPPORTED, /* AddFolder */ |
3982 | NOTSUPPORTED, /* GetGPRSAccessPoint*/ | 3994 | NOTSUPPORTED, /* GetGPRSAccessPoint*/ |
diff --git a/gammu/emb/common/phone/at/atgen.c b/gammu/emb/common/phone/at/atgen.c index 1834f15..ba23eb2 100644 --- a/gammu/emb/common/phone/at/atgen.c +++ b/gammu/emb/common/phone/at/atgen.c | |||
@@ -3,55 +3,35 @@ | |||
3 | #include "../../gsmstate.h" | 3 | #include "../../gsmstate.h" |
4 | 4 | ||
5 | #ifdef GSM_ENABLE_ATGEN | 5 | #ifdef GSM_ENABLE_ATGEN |
6 | 6 | ||
7 | #include <string.h> | 7 | #include <string.h> |
8 | #include <time.h> | 8 | #include <time.h> |
9 | #include <ctype.h> | 9 | #include <ctype.h> |
10 | 10 | ||
11 | #include "../../gsmcomon.h" | 11 | #include "../../gsmcomon.h" |
12 | #include "../../misc/coding/coding.h" | 12 | #include "../../misc/coding/coding.h" |
13 | #include "../../service/sms/gsmsms.h" | 13 | #include "../../service/sms/gsmsms.h" |
14 | #include "../pfunc.h" | 14 | #include "../pfunc.h" |
15 | |||
15 | #include "atgen.h" | 16 | #include "atgen.h" |
16 | 17 | ||
18 | #include "samsung.h" | ||
19 | #include "siemens.h" | ||
20 | #include "sonyeric.h" | ||
21 | |||
17 | #ifdef GSM_ENABLE_ALCATEL | 22 | #ifdef GSM_ENABLE_ALCATEL |
18 | extern GSM_Error ALCATEL_ProtocolVersionReply(GSM_Protocol_Message msg, GSM_StateMachine *s); | 23 | GSM_Error ALCATEL_ProtocolVersionReply (GSM_Protocol_Message, GSM_StateMachine *); |
19 | #endif | 24 | #endif |
20 | 25 | ||
21 | extern GSM_Error ATGEN_CMS35ReplyGetBitmap(GSM_Protocol_Message msg, GSM_StateMachine *s); | ||
22 | extern GSM_Error ATGEN_CMS35ReplySetBitmap(GSM_Protocol_Message msg, GSM_StateMachine *s); | ||
23 | extern GSM_Error ATGEN_CMS35ReplyGetRingtone(GSM_Protocol_Message msg, GSM_StateMachine *s); | ||
24 | extern GSM_Error ATGEN_CMS35ReplySetRingtone(GSM_Protocol_Message msg, GSM_StateMachine *s); | ||
25 | extern GSM_Error ATGEN_CMS35ReplyGetNextCal(GSM_Protocol_Message msg, GSM_StateMachine *s); | ||
26 | extern GSM_Error ATGEN_CMS35ReplySetCalendar(GSM_Protocol_Message msg, GSM_StateMachine *s); | ||
27 | extern GSM_Error ATGEN_CMS35ReplyDeleteCalendar(GSM_Protocol_Message msg, GSM_StateMachine *s); | ||
28 | extern GSM_Error ATGEN_SL45ReplyGetMemory(GSM_Protocol_Message msg, GSM_StateMachine *s); | ||
29 | |||
30 | extern GSM_Error ATGEN_GetRingtone (GSM_StateMachine *s, GSM_Ringtone *Ringtone, bool PhoneRingtone); | ||
31 | extern GSM_Error ATGEN_SetRingtone (GSM_StateMachine *s, GSM_Ringtone *Ringtone, int *maxlength); | ||
32 | extern GSM_Error ATGEN_GetBitmap (GSM_StateMachine *s, GSM_Bitmap *Bitmap); | ||
33 | extern GSM_Error ATGEN_SetBitmap (GSM_StateMachine *s, GSM_Bitmap *Bitmap); | ||
34 | extern GSM_Error SIEMENS_GetNextCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Note, bool start); | ||
35 | extern GSM_Error SIEMENS_AddCalendarNote(GSM_StateMachine *s, GSM_CalendarEntry *Note); | ||
36 | extern GSM_Error SIEMENS_DelCalendarNote(GSM_StateMachine *s, GSM_CalendarEntry *Note); | ||
37 | |||
38 | extern GSM_Error SONYERIC_GetNextCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Note, bool start); | ||
39 | extern GSM_Error SONYERIC_GetNextToDo (GSM_StateMachine *s, GSM_ToDoEntry *ToDo, bool start); | ||
40 | extern GSM_Error SONYERIC_GetToDoStatus (GSM_StateMachine *s, GSM_ToDoStatus *status); | ||
41 | extern GSM_Error SONYERIC_AddCalendarNote(GSM_StateMachine *s, GSM_CalendarEntry *Note); | ||
42 | extern GSM_Error SONYERIC_AddToDo (GSM_StateMachine *s, GSM_ToDoEntry *ToDo); | ||
43 | extern GSM_Error SONYERIC_DeleteAllToDo (GSM_StateMachine *s); | ||
44 | extern GSM_Error SONYERIC_DelCalendarNote(GSM_StateMachine *s, GSM_CalendarEntry *Note); | ||
45 | extern GSM_Error SONYERIC_GetCalendarStatus(GSM_StateMachine *s, GSM_CalendarStatus *Status); | ||
46 | 26 | ||
47 | typedef struct { | 27 | typedef struct { |
48 | int Number; | 28 | int Number; |
49 | char Text[60]; | 29 | char Text[60]; |
50 | } ATErrorCode; | 30 | } ATErrorCode; |
51 | 31 | ||
52 | static ATErrorCode CMSErrorCodes[] = { | 32 | static ATErrorCode CMSErrorCodes[] = { |
53 | /* | 33 | /* |
54 | * Error codes not specified here were either undefined or reserved in my | 34 | * Error codes not specified here were either undefined or reserved in my |
55 | * copy of specifications, if you have newer one, please fill in the gaps. | 35 | * copy of specifications, if you have newer one, please fill in the gaps. |
56 | */ | 36 | */ |
57 | /* 0...127 from GSM 04.11 Annex E-2 */ | 37 | /* 0...127 from GSM 04.11 Annex E-2 */ |
@@ -166,24 +146,26 @@ GSM_Error ATGEN_HandleCMEError(GSM_StateMachine *s) | |||
166 | { | 146 | { |
167 | GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN; | 147 | GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN; |
168 | 148 | ||
169 | if (Priv->ErrorCode == 0) { | 149 | if (Priv->ErrorCode == 0) { |
170 | smprintf(s, "CME Error occured, but it's type not detected\n"); | 150 | smprintf(s, "CME Error occured, but it's type not detected\n"); |
171 | } else if (Priv->ErrorText == NULL) { | 151 | } else if (Priv->ErrorText == NULL) { |
172 | smprintf(s, "CME Error %i, no description available\n", Priv->ErrorCode); | 152 | smprintf(s, "CME Error %i, no description available\n", Priv->ErrorCode); |
173 | } else { | 153 | } else { |
174 | smprintf(s, "CME Error %i: \"%s\"\n", Priv->ErrorCode, Priv->ErrorText); | 154 | smprintf(s, "CME Error %i: \"%s\"\n", Priv->ErrorCode, Priv->ErrorText); |
175 | } | 155 | } |
176 | /* For error codes descriptions see table a bit above */ | 156 | /* For error codes descriptions see table a bit above */ |
177 | switch (Priv->ErrorCode) { | 157 | switch (Priv->ErrorCode) { |
158 | case -1: | ||
159 | return ERR_EMPTY; | ||
178 | case 3: | 160 | case 3: |
179 | return ERR_PERMISSION; | 161 | return ERR_PERMISSION; |
180 | case 4: | 162 | case 4: |
181 | return ERR_NOTSUPPORTED; | 163 | return ERR_NOTSUPPORTED; |
182 | case 5: | 164 | case 5: |
183 | case 11: | 165 | case 11: |
184 | case 12: | 166 | case 12: |
185 | case 16: | 167 | case 16: |
186 | case 17: | 168 | case 17: |
187 | case 18: | 169 | case 18: |
188 | return ERR_SECURITYERROR; | 170 | return ERR_SECURITYERROR; |
189 | case 20: | 171 | case 20: |
@@ -247,26 +229,34 @@ int ATGEN_ExtractOneParameter(unsigned char *input, unsigned char *output) | |||
247 | *output=*input; | 229 | *output=*input; |
248 | input++; | 230 | input++; |
249 | output++; | 231 | output++; |
250 | position++; | 232 | position++; |
251 | } | 233 | } |
252 | *output=0; | 234 | *output=0; |
253 | position++; | 235 | position++; |
254 | return position; | 236 | return position; |
255 | } | 237 | } |
256 | 238 | ||
257 | void ATGEN_DecodeDateTime(GSM_DateTime *dt, unsigned char *input) | 239 | void ATGEN_DecodeDateTime(GSM_DateTime *dt, unsigned char *input) |
258 | { | 240 | { |
259 | dt->Year=2000+(*input-'0')*10; input++; | 241 | /* Samsung phones report year as %d instead of %02d */ |
242 | if (input[2] == '/') { | ||
243 | dt->Year=(*input-'0')*10; | ||
244 | input++; | ||
245 | } else { | ||
246 | dt->Year=0; | ||
247 | } | ||
248 | |||
260 | dt->Year=dt->Year+(*input-'0'); input++; | 249 | dt->Year=dt->Year+(*input-'0'); input++; |
250 | dt->Year+=2000; | ||
261 | 251 | ||
262 | input++; | 252 | input++; |
263 | dt->Month=(*input-'0')*10; input++; | 253 | dt->Month=(*input-'0')*10; input++; |
264 | dt->Month=dt->Month+(*input-'0'); input++; | 254 | dt->Month=dt->Month+(*input-'0'); input++; |
265 | 255 | ||
266 | input++; | 256 | input++; |
267 | dt->Day=(*input-'0')*10; input++; | 257 | dt->Day=(*input-'0')*10; input++; |
268 | dt->Day=dt->Day+(*input-'0'); input++; | 258 | dt->Day=dt->Day+(*input-'0'); input++; |
269 | 259 | ||
270 | input++; | 260 | input++; |
271 | dt->Hour=(*input-'0')*10; input++; | 261 | dt->Hour=(*input-'0')*10; input++; |
272 | dt->Hour=dt->Hour+(*input-'0'); input++; | 262 | dt->Hour=dt->Hour+(*input-'0'); input++; |
@@ -313,24 +303,36 @@ GSM_Error ATGEN_DispatchMessage(GSM_StateMachine *s) | |||
313 | if (!strcmp(line,"OK")) Priv->ReplyState = AT_Reply_OK; | 303 | if (!strcmp(line,"OK")) Priv->ReplyState = AT_Reply_OK; |
314 | if (!strcmp(line,"> ")) Priv->ReplyState = AT_Reply_SMSEdit; | 304 | if (!strcmp(line,"> ")) Priv->ReplyState = AT_Reply_SMSEdit; |
315 | if (!strcmp(line,"CONNECT"))Priv->ReplyState = AT_Reply_Connect; | 305 | if (!strcmp(line,"CONNECT"))Priv->ReplyState = AT_Reply_Connect; |
316 | if (!strcmp(line,"ERROR" ))Priv->ReplyState = AT_Reply_Error; | 306 | if (!strcmp(line,"ERROR" ))Priv->ReplyState = AT_Reply_Error; |
317 | if (!strncmp(line,"+CME ERROR:",11)) { | 307 | if (!strncmp(line,"+CME ERROR:",11)) { |
318 | Priv->ReplyState = AT_Reply_CMEError; | 308 | Priv->ReplyState = AT_Reply_CMEError; |
319 | ErrorCodes = CMEErrorCodes; | 309 | ErrorCodes = CMEErrorCodes; |
320 | } | 310 | } |
321 | if (!strncmp(line,"+CMS ERROR:",11)) { | 311 | if (!strncmp(line,"+CMS ERROR:",11)) { |
322 | Priv->ReplyState = AT_Reply_CMSError; | 312 | Priv->ReplyState = AT_Reply_CMSError; |
323 | ErrorCodes = CMSErrorCodes; | 313 | ErrorCodes = CMSErrorCodes; |
324 | } | 314 | } |
315 | |||
316 | /* FIXME: Samsung phones can answer +CME ERROR:-1 meaning empty location */ | ||
317 | if (Priv->ReplyState == AT_Reply_CMEError && Priv->Manufacturer == AT_Samsung) { | ||
318 | err = line + 11; | ||
319 | Priv->ErrorCode = atoi(err); | ||
320 | |||
321 | if (Priv->ErrorCode == -1) { | ||
322 | Priv->ErrorText = "[Samsung] Empty location"; | ||
323 | return GSM_DispatchMessage(s); | ||
324 | } | ||
325 | } | ||
326 | |||
325 | if (Priv->ReplyState == AT_Reply_CMEError || Priv->ReplyState == AT_Reply_CMSError) { | 327 | if (Priv->ReplyState == AT_Reply_CMEError || Priv->ReplyState == AT_Reply_CMSError) { |
326 | j = 0; | 328 | j = 0; |
327 | /* One char behind +CM[SE] ERROR */ | 329 | /* One char behind +CM[SE] ERROR */ |
328 | err = line + 12; | 330 | err = line + 12; |
329 | while (err[j] && !isalnum(err[j])) j++; | 331 | while (err[j] && !isalnum(err[j])) j++; |
330 | if (isdigit(err[j])) { | 332 | if (isdigit(err[j])) { |
331 | Priv->ErrorCode = atoi(&(err[j])); | 333 | Priv->ErrorCode = atoi(&(err[j])); |
332 | k = 0; | 334 | k = 0; |
333 | while (ErrorCodes[k].Number != -1) { | 335 | while (ErrorCodes[k].Number != -1) { |
334 | if (ErrorCodes[k].Number == Priv->ErrorCode) { | 336 | if (ErrorCodes[k].Number == Priv->ErrorCode) { |
335 | Priv->ErrorText = (char *)&(ErrorCodes[k].Text); | 337 | Priv->ErrorText = (char *)&(ErrorCodes[k].Text); |
336 | break; | 338 | break; |
@@ -361,52 +363,90 @@ GSM_Error ATGEN_GenericReply(GSM_Protocol_Message msg, GSM_StateMachine *s) | |||
361 | case AT_Reply_Error: | 363 | case AT_Reply_Error: |
362 | return ERR_UNKNOWN; | 364 | return ERR_UNKNOWN; |
363 | case AT_Reply_CMSError: | 365 | case AT_Reply_CMSError: |
364 | return ATGEN_HandleCMSError(s); | 366 | return ATGEN_HandleCMSError(s); |
365 | case AT_Reply_CMEError: | 367 | case AT_Reply_CMEError: |
366 | return ATGEN_HandleCMEError(s); | 368 | return ATGEN_HandleCMEError(s); |
367 | default: | 369 | default: |
368 | break; | 370 | break; |
369 | } | 371 | } |
370 | return ERR_UNKNOWNRESPONSE; | 372 | return ERR_UNKNOWNRESPONSE; |
371 | } | 373 | } |
372 | 374 | ||
375 | GSM_Error ATGEN_ReplyGetUSSD(GSM_Protocol_Message msg, GSM_StateMachine *s) | ||
376 | { | ||
377 | unsigned char buffer[2000],buffer2[4000]; | ||
378 | int i = 10; | ||
379 | |||
380 | /* Ugly hack */ | ||
381 | while (msg.Buffer[i]!=13) i++; | ||
382 | i = i - 6; | ||
383 | memcpy(buffer,msg.Buffer+10,i-11); | ||
384 | buffer[i-11] = 0x00; | ||
385 | |||
386 | smprintf(s, "USSD reply: \"%s\"\n",buffer); | ||
387 | |||
388 | if (s->Phone.Data.EnableIncomingUSSD && s->User.IncomingUSSD!=NULL) { | ||
389 | EncodeUnicode(buffer2,buffer,strlen(buffer)); | ||
390 | s->User.IncomingUSSD(s->CurrentConfig->Device, buffer2); | ||
391 | } | ||
392 | |||
393 | return ERR_NONE; | ||
394 | } | ||
395 | |||
396 | GSM_Error ATGEN_SetIncomingUSSD(GSM_StateMachine *s, bool enable) | ||
397 | { | ||
398 | GSM_Error error; | ||
399 | |||
400 | if (enable) { | ||
401 | smprintf(s, "Enabling incoming USSD\n"); | ||
402 | error=GSM_WaitFor (s, "AT+CUSD=1\r", 10, 0x00, 3, ID_SetUSSD); | ||
403 | } else { | ||
404 | smprintf(s, "Disabling incoming USSD\n"); | ||
405 | error=GSM_WaitFor (s, "AT+CUSD=0\r", 10, 0x00, 3, ID_SetUSSD); | ||
406 | } | ||
407 | if (error==ERR_NONE) s->Phone.Data.EnableIncomingUSSD = enable; | ||
408 | return error; | ||
409 | } | ||
410 | |||
373 | GSM_Error ATGEN_ReplyGetModel(GSM_Protocol_Message msg, GSM_StateMachine *s) | 411 | GSM_Error ATGEN_ReplyGetModel(GSM_Protocol_Message msg, GSM_StateMachine *s) |
374 | { | 412 | { |
375 | GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN; | 413 | GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN; |
376 | GSM_Phone_Data *Data = &s->Phone.Data; | 414 | GSM_Phone_Data *Data = &s->Phone.Data; |
377 | 415 | ||
378 | if (s->Phone.Data.Priv.ATGEN.ReplyState != AT_Reply_OK) return ERR_NOTSUPPORTED; | 416 | if (s->Phone.Data.Priv.ATGEN.ReplyState != AT_Reply_OK) return ERR_NOTSUPPORTED; |
379 | 417 | ||
380 | if (strlen(GetLineString(msg.Buffer, Priv->Lines, 2)) <= MAX_MODEL_LENGTH) { | 418 | if (strlen(GetLineString(msg.Buffer, Priv->Lines, 2)) <= MAX_MODEL_LENGTH) { |
381 | CopyLineString(Data->Model, msg.Buffer, Priv->Lines, 2); | 419 | CopyLineString(Data->Model, msg.Buffer, Priv->Lines, 2); |
382 | 420 | ||
383 | /* Sometimes phone adds this before manufacturer (Sagem) */ | 421 | /* Sometimes phone adds this before manufacturer (Sagem) */ |
384 | if (strncmp("+CGMM: ", Data->Model, 7) == 0) { | 422 | if (strncmp("+CGMM: ", Data->Model, 7) == 0) { |
385 | memmove(Data->Model, Data->Model + 7, strlen(Data->Model + 7) + 1); | 423 | memmove(Data->Model, Data->Model + 7, strlen(Data->Model + 7) + 1); |
386 | } | 424 | } |
387 | 425 | ||
388 | Data->ModelInfo = GetModelData(NULL,Data->Model,NULL); | 426 | Data->ModelInfo = GetModelData(NULL,Data->Model,NULL); |
389 | if (Data->ModelInfo->number[0] == 0) Data->ModelInfo = GetModelData(NULL,NULL,Data->Model); | 427 | if (Data->ModelInfo->number[0] == 0) Data->ModelInfo = GetModelData(NULL,NULL,Data->Model); |
390 | if (Data->ModelInfo->number[0] == 0) Data->ModelInfo = GetModelData(Data->Model,NULL,NULL); | 428 | if (Data->ModelInfo->number[0] == 0) Data->ModelInfo = GetModelData(Data->Model,NULL,NULL); |
391 | 429 | ||
392 | if (Data->ModelInfo->number[0] != 0) strcpy(Data->Model,Data->ModelInfo->number); | 430 | if (Data->ModelInfo->number[0] != 0) strcpy(Data->Model,Data->ModelInfo->number); |
393 | 431 | ||
394 | if (strstr(msg.Buffer,"Nokia")) Priv->Manufacturer = AT_Nokia; | 432 | if (strstr(msg.Buffer,"Nokia")) Priv->Manufacturer = AT_Nokia; |
395 | else if (strstr(msg.Buffer,"M20")) Priv->Manufacturer = AT_Siemens; | 433 | else if (strstr(msg.Buffer,"M20")) Priv->Manufacturer = AT_Siemens; |
396 | else if (strstr(msg.Buffer,"MC35")) Priv->Manufacturer = AT_Siemens; | 434 | else if (strstr(msg.Buffer,"MC35")) Priv->Manufacturer = AT_Siemens; |
435 | else if (strstr(msg.Buffer,"TC35")) Priv->Manufacturer = AT_Siemens; | ||
397 | else if (strstr(msg.Buffer, "iPAQ")) Priv->Manufacturer = AT_HP; | 436 | else if (strstr(msg.Buffer, "iPAQ")) Priv->Manufacturer = AT_HP; |
398 | 437 | ||
399 | if (strstr(msg.Buffer,"M20")) strcpy(Data->Model,"M20"); | 438 | if (strstr(msg.Buffer,"M20")) strcpy(Data->Model,"M20"); |
400 | else if (strstr(msg.Buffer,"MC35")) strcpy(Data->Model,"MC35"); | 439 | else if (strstr(msg.Buffer,"MC35")) strcpy(Data->Model,"MC35"); |
440 | else if (strstr(msg.Buffer,"TC35")) strcpy(Data->Model,"TC35"); | ||
401 | else if (strstr(msg.Buffer, "iPAQ")) strcpy(Data->Model,"iPAQ"); | 441 | else if (strstr(msg.Buffer, "iPAQ")) strcpy(Data->Model,"iPAQ"); |
402 | } else { | 442 | } else { |
403 | smprintf(s, "WARNING: Model name too long, increase MAX_MODEL_LENGTH to at least %zd\n", strlen(GetLineString(msg.Buffer, Priv->Lines, 2))); | 443 | smprintf(s, "WARNING: Model name too long, increase MAX_MODEL_LENGTH to at least %zd\n", strlen(GetLineString(msg.Buffer, Priv->Lines, 2))); |
404 | } | 444 | } |
405 | 445 | ||
406 | return ERR_NONE; | 446 | return ERR_NONE; |
407 | } | 447 | } |
408 | 448 | ||
409 | GSM_Error ATGEN_GetModel(GSM_StateMachine *s) | 449 | GSM_Error ATGEN_GetModel(GSM_StateMachine *s) |
410 | { | 450 | { |
411 | GSM_Error error; | 451 | GSM_Error error; |
412 | 452 | ||
@@ -472,24 +512,29 @@ GSM_Error ATGEN_ReplyGetManufacturer(GSM_Protocol_Message msg, GSM_StateMachine | |||
472 | Priv->Manufacturer = AT_HP; | 512 | Priv->Manufacturer = AT_HP; |
473 | } | 513 | } |
474 | if (strstr(msg.Buffer,"ALCATEL")) { | 514 | if (strstr(msg.Buffer,"ALCATEL")) { |
475 | smprintf(s, "Alcatel\n"); | 515 | smprintf(s, "Alcatel\n"); |
476 | strcpy(s->Phone.Data.Manufacturer,"Alcatel"); | 516 | strcpy(s->Phone.Data.Manufacturer,"Alcatel"); |
477 | Priv->Manufacturer = AT_Alcatel; | 517 | Priv->Manufacturer = AT_Alcatel; |
478 | } | 518 | } |
479 | if (strstr(msg.Buffer,"SAGEM")) { | 519 | if (strstr(msg.Buffer,"SAGEM")) { |
480 | smprintf(s, "Sagem\n"); | 520 | smprintf(s, "Sagem\n"); |
481 | strcpy(s->Phone.Data.Manufacturer,"Sagem"); | 521 | strcpy(s->Phone.Data.Manufacturer,"Sagem"); |
482 | Priv->Manufacturer = AT_Sagem; | 522 | Priv->Manufacturer = AT_Sagem; |
483 | } | 523 | } |
524 | if (strstr(msg.Buffer,"Samsung")) { | ||
525 | smprintf(s, "Samsung\n"); | ||
526 | strcpy(s->Phone.Data.Manufacturer,"Samsung"); | ||
527 | Priv->Manufacturer = AT_Samsung; | ||
528 | } | ||
484 | return ERR_NONE; | 529 | return ERR_NONE; |
485 | case AT_Reply_CMSError: | 530 | case AT_Reply_CMSError: |
486 | return ATGEN_HandleCMSError(s); | 531 | return ATGEN_HandleCMSError(s); |
487 | default: | 532 | default: |
488 | break; | 533 | break; |
489 | } | 534 | } |
490 | return ERR_UNKNOWNRESPONSE; | 535 | return ERR_UNKNOWNRESPONSE; |
491 | } | 536 | } |
492 | 537 | ||
493 | GSM_Error ATGEN_GetManufacturer(GSM_StateMachine *s) | 538 | GSM_Error ATGEN_GetManufacturer(GSM_StateMachine *s) |
494 | { | 539 | { |
495 | if (s->Phone.Data.Manufacturer[0] != 0) return ERR_NONE; | 540 | if (s->Phone.Data.Manufacturer[0] != 0) return ERR_NONE; |
@@ -665,34 +710,44 @@ GSM_Error ATGEN_ReplyGetSMSMemories(GSM_Protocol_Message msg, GSM_StateMachine * | |||
665 | case AT_Reply_OK: | 710 | case AT_Reply_OK: |
666 | /* Reply here is: | 711 | /* Reply here is: |
667 | * (memories for reading)[, (memories for writing)[, (memories for storing received messages)]] | 712 | * (memories for reading)[, (memories for writing)[, (memories for storing received messages)]] |
668 | * each memory is in quotes, | 713 | * each memory is in quotes, |
669 | * Example: ("SM"), ("SM"), ("SM") | 714 | * Example: ("SM"), ("SM"), ("SM") |
670 | * | 715 | * |
671 | * We need to get from this supported memories. For this case | 716 | * We need to get from this supported memories. For this case |
672 | * we assume, that just appearence of memory makes it | 717 | * we assume, that just appearence of memory makes it |
673 | * available for everything. Then we need to find out whether | 718 | * available for everything. Then we need to find out whether |
674 | * phone supports writing to memory. This is done by searching | 719 | * phone supports writing to memory. This is done by searching |
675 | * for "), (", which will appear between lists. | 720 | * for "), (", which will appear between lists. |
676 | */ | 721 | */ |
677 | s->Phone.Data.Priv.ATGEN.CanSaveSMS = (strstr(msg.Buffer, "), (") != NULL); | 722 | s->Phone.Data.Priv.ATGEN.CanSaveSMS = false; |
723 | if (strstr(msg.Buffer, "), (") != NULL || strstr(msg.Buffer, "),(") != NULL) { | ||
724 | s->Phone.Data.Priv.ATGEN.CanSaveSMS = true; | ||
725 | } | ||
726 | |||
678 | if (strstr(msg.Buffer, "\"SM\"") != NULL) s->Phone.Data.Priv.ATGEN.SIMSMSMemory = AT_AVAILABLE; | 727 | if (strstr(msg.Buffer, "\"SM\"") != NULL) s->Phone.Data.Priv.ATGEN.SIMSMSMemory = AT_AVAILABLE; |
679 | else s->Phone.Data.Priv.ATGEN.SIMSMSMemory = AT_NOTAVAILABLE; | 728 | else s->Phone.Data.Priv.ATGEN.SIMSMSMemory = AT_NOTAVAILABLE; |
729 | |||
680 | if (strstr(msg.Buffer, "\"ME\"") != NULL) s->Phone.Data.Priv.ATGEN.PhoneSMSMemory = AT_AVAILABLE; | 730 | if (strstr(msg.Buffer, "\"ME\"") != NULL) s->Phone.Data.Priv.ATGEN.PhoneSMSMemory = AT_AVAILABLE; |
681 | else s->Phone.Data.Priv.ATGEN.PhoneSMSMemory = AT_NOTAVAILABLE; | 731 | else s->Phone.Data.Priv.ATGEN.PhoneSMSMemory = AT_NOTAVAILABLE; |
682 | smprintf(s, "Available SMS memories received, ME = %d, SM = %d\n", s->Phone.Data.Priv.ATGEN.PhoneSMSMemory, s->Phone.Data.Priv.ATGEN.SIMSMSMemory); | 732 | |
733 | smprintf(s, "Available SMS memories received, ME = %d, SM = %d, cansavesms =", s->Phone.Data.Priv.ATGEN.PhoneSMSMemory, s->Phone.Data.Priv.ATGEN.SIMSMSMemory); | ||
734 | if (s->Phone.Data.Priv.ATGEN.CanSaveSMS) smprintf(s, "true"); | ||
735 | smprintf(s, "\n"); | ||
683 | return ERR_NONE; | 736 | return ERR_NONE; |
684 | case AT_Reply_Error: | 737 | case AT_Reply_Error: |
685 | case AT_Reply_CMSError: | 738 | case AT_Reply_CMSError: |
686 | return ATGEN_HandleCMSError(s); | 739 | return ATGEN_HandleCMSError(s); |
740 | case AT_Reply_CMEError: | ||
741 | return ATGEN_HandleCMEError(s); | ||
687 | default: | 742 | default: |
688 | return ERR_UNKNOWNRESPONSE; | 743 | return ERR_UNKNOWNRESPONSE; |
689 | } | 744 | } |
690 | } | 745 | } |
691 | 746 | ||
692 | GSM_Error ATGEN_GetSMSMemories(GSM_StateMachine *s) | 747 | GSM_Error ATGEN_GetSMSMemories(GSM_StateMachine *s) |
693 | { | 748 | { |
694 | smprintf(s, "Getting available SMS memories\n"); | 749 | smprintf(s, "Getting available SMS memories\n"); |
695 | return GSM_WaitFor (s, "AT+CPMS=?\r", 10, 0x00, 4, ID_GetSMSMemories); | 750 | return GSM_WaitFor (s, "AT+CPMS=?\r", 10, 0x00, 4, ID_GetSMSMemories); |
696 | } | 751 | } |
697 | 752 | ||
698 | GSM_Error ATGEN_SetSMSMemory(GSM_StateMachine *s, bool SIM) | 753 | GSM_Error ATGEN_SetSMSMemory(GSM_StateMachine *s, bool SIM) |
@@ -849,26 +904,27 @@ GSM_Error ATGEN_ReplyGetSMSMessage(GSM_Protocol_Message msg, GSM_StateMachine *s | |||
849 | CopyLineString(buffer, msg.Buffer, Priv->Lines, 2); | 904 | CopyLineString(buffer, msg.Buffer, Priv->Lines, 2); |
850 | switch (buffer[7]) { | 905 | switch (buffer[7]) { |
851 | case '0': sms->State = SMS_UnRead; break; | 906 | case '0': sms->State = SMS_UnRead; break; |
852 | case '1': sms->State = SMS_Read;break; | 907 | case '1': sms->State = SMS_Read;break; |
853 | case '2': sms->State = SMS_UnSent;break; | 908 | case '2': sms->State = SMS_UnSent;break; |
854 | default : sms->State = SMS_Sent;break;//case '3' | 909 | default : sms->State = SMS_Sent;break;//case '3' |
855 | } | 910 | } |
856 | DecodeHexBin (buffer, GetLineString(msg.Buffer,Priv->Lines,3), strlen(GetLineString(msg.Buffer,Priv->Lines,3))); | 911 | DecodeHexBin (buffer, GetLineString(msg.Buffer,Priv->Lines,3), strlen(GetLineString(msg.Buffer,Priv->Lines,3))); |
857 | /* Siemens MC35 (only ?) */ | 912 | /* Siemens MC35 (only ?) */ |
858 | if (strstr(msg.Buffer,"+CMGR: 0,,0")!=NULL) return ERR_EMPTY; | 913 | if (strstr(msg.Buffer,"+CMGR: 0,,0")!=NULL) return ERR_EMPTY; |
859 | /* Siemens M20 */ | 914 | /* Siemens M20 */ |
860 | if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_M20SMS)) { | 915 | if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_M20SMS)) { |
861 | if (buffer[1]!=NUMBER_UNKNOWN && buffer[1]!=NUMBER_INTERNATIONAL && | 916 | /* we check for the most often visible */ |
862 | buffer[1]!=NUMBER_ALPHANUMERIC) { | 917 | if (buffer[1]!=NUMBER_UNKNOWN_NUMBERING_PLAN_ISDN && buffer[1]!=NUMBER_INTERNATIONAL_NUMBERING_PLAN_ISDN && |
918 | buffer[1]!=NUMBER_ALPHANUMERIC_NUMBERING_PLAN_UNKNOWN) { | ||
863 | /* Seems to be Delivery Report */ | 919 | /* Seems to be Delivery Report */ |
864 | smprintf(s, "SMS type - status report (M20 style)\n"); | 920 | smprintf(s, "SMS type - status report (M20 style)\n"); |
865 | sms->PDU = SMS_Status_Report; | 921 | sms->PDU = SMS_Status_Report; |
866 | sms->Folder = 1;/*INBOX SIM*/ | 922 | sms->Folder = 1;/*INBOX SIM*/ |
867 | sms->InboxFolder = true; | 923 | sms->InboxFolder = true; |
868 | 924 | ||
869 | smsframe[12]=buffer[current++]; | 925 | smsframe[12]=buffer[current++]; |
870 | smsframe[PHONE_SMSStatusReport.TPMR]=buffer[current++]; | 926 | smsframe[PHONE_SMSStatusReport.TPMR]=buffer[current++]; |
871 | current2=((buffer[current])+1)/2+1; | 927 | current2=((buffer[current])+1)/2+1; |
872 | for(i=0;i<current2+1;i++) smsframe[PHONE_SMSStatusReport.Number+i]=buffer[current++]; | 928 | for(i=0;i<current2+1;i++) smsframe[PHONE_SMSStatusReport.Number+i]=buffer[current++]; |
873 | for(i=0;i<7;i++) smsframe[PHONE_SMSStatusReport.DateTime+i]=buffer[current++]; | 929 | for(i=0;i<7;i++) smsframe[PHONE_SMSStatusReport.DateTime+i]=buffer[current++]; |
874 | smsframe[0] = 0; | 930 | smsframe[0] = 0; |
@@ -885,25 +941,25 @@ GSM_Error ATGEN_ReplyGetSMSMessage(GSM_Protocol_Message msg, GSM_StateMachine *s | |||
885 | switch (smsframe[12] & 0x03) { | 941 | switch (smsframe[12] & 0x03) { |
886 | case 0x00: | 942 | case 0x00: |
887 | smprintf(s, "SMS type - deliver\n"); | 943 | smprintf(s, "SMS type - deliver\n"); |
888 | sms->PDU = SMS_Deliver; | 944 | sms->PDU = SMS_Deliver; |
889 | if (Priv->SMSMemory == MEM_SM) { | 945 | if (Priv->SMSMemory == MEM_SM) { |
890 | sms->Folder = 1; /*INBOX SIM*/ | 946 | sms->Folder = 1; /*INBOX SIM*/ |
891 | } else { | 947 | } else { |
892 | sms->Folder = 3; /*INBOX ME*/ | 948 | sms->Folder = 3; /*INBOX ME*/ |
893 | } | 949 | } |
894 | sms->InboxFolder = true; | 950 | sms->InboxFolder = true; |
895 | current2=((buffer[current])+1)/2+1; | 951 | current2=((buffer[current])+1)/2+1; |
896 | if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_M20SMS)) { | 952 | if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_M20SMS)) { |
897 | if (buffer[current+1]==NUMBER_ALPHANUMERIC) { | 953 | if (buffer[current+1]==NUMBER_ALPHANUMERIC_NUMBERING_PLAN_UNKNOWN) { |
898 | smprintf(s, "Trying to read alphanumeric number\n"); | 954 | smprintf(s, "Trying to read alphanumeric number\n"); |
899 | for(i=0;i<4;i++) smsframe[PHONE_SMSDeliver.Number+i]=buffer[current++]; | 955 | for(i=0;i<4;i++) smsframe[PHONE_SMSDeliver.Number+i]=buffer[current++]; |
900 | current+=6; | 956 | current+=6; |
901 | for(i=0;i<current2-3;i++) smsframe[PHONE_SMSDeliver.Number+i+4]=buffer[current++]; | 957 | for(i=0;i<current2-3;i++) smsframe[PHONE_SMSDeliver.Number+i+4]=buffer[current++]; |
902 | } else { | 958 | } else { |
903 | for(i=0;i<current2+1;i++) smsframe[PHONE_SMSDeliver.Number+i]=buffer[current++]; | 959 | for(i=0;i<current2+1;i++) smsframe[PHONE_SMSDeliver.Number+i]=buffer[current++]; |
904 | } | 960 | } |
905 | } else { | 961 | } else { |
906 | for(i=0;i<current2+1;i++) smsframe[PHONE_SMSDeliver.Number+i]=buffer[current++]; | 962 | for(i=0;i<current2+1;i++) smsframe[PHONE_SMSDeliver.Number+i]=buffer[current++]; |
907 | } | 963 | } |
908 | smsframe[PHONE_SMSDeliver.TPPID] = buffer[current++]; | 964 | smsframe[PHONE_SMSDeliver.TPPID] = buffer[current++]; |
909 | smsframe[PHONE_SMSDeliver.TPDCS] = buffer[current++]; | 965 | smsframe[PHONE_SMSDeliver.TPDCS] = buffer[current++]; |
@@ -916,49 +972,49 @@ GSM_Error ATGEN_ReplyGetSMSMessage(GSM_Protocol_Message msg, GSM_StateMachine *s | |||
916 | smprintf(s, "SMS type - submit\n"); | 972 | smprintf(s, "SMS type - submit\n"); |
917 | sms->PDU = SMS_Submit; | 973 | sms->PDU = SMS_Submit; |
918 | if (Priv->SMSMemory == MEM_SM) { | 974 | if (Priv->SMSMemory == MEM_SM) { |
919 | sms->Folder = 2; /*OUTBOX SIM*/ | 975 | sms->Folder = 2; /*OUTBOX SIM*/ |
920 | smprintf(s, "Outbox SIM\n"); | 976 | smprintf(s, "Outbox SIM\n"); |
921 | } else { | 977 | } else { |
922 | sms->Folder = 4; /*OUTBOX ME*/ | 978 | sms->Folder = 4; /*OUTBOX ME*/ |
923 | } | 979 | } |
924 | sms->InboxFolder = false; | 980 | sms->InboxFolder = false; |
925 | smsframe[PHONE_SMSSubmit.TPMR] = buffer[current++]; | 981 | smsframe[PHONE_SMSSubmit.TPMR] = buffer[current++]; |
926 | current2=((buffer[current])+1)/2+1; | 982 | current2=((buffer[current])+1)/2+1; |
927 | if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_M20SMS)) { | 983 | if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_M20SMS)) { |
928 | if (buffer[current+1]==NUMBER_ALPHANUMERIC) { | 984 | if (buffer[current+1]==NUMBER_ALPHANUMERIC_NUMBERING_PLAN_UNKNOWN) { |
929 | smprintf(s, "Trying to read alphanumeric number\n"); | 985 | smprintf(s, "Trying to read alphanumeric number\n"); |
930 | for(i=0;i<4;i++) smsframe[PHONE_SMSSubmit.Number+i]=buffer[current++]; | 986 | for(i=0;i<4;i++) smsframe[PHONE_SMSSubmit.Number+i]=buffer[current++]; |
931 | current+=6; | 987 | current+=6; |
932 | for(i=0;i<current2-3;i++) smsframe[PHONE_SMSSubmit.Number+i+4]=buffer[current++]; | 988 | for(i=0;i<current2-3;i++) smsframe[PHONE_SMSSubmit.Number+i+4]=buffer[current++]; |
933 | } else { | 989 | } else { |
934 | for(i=0;i<current2+1;i++) smsframe[PHONE_SMSSubmit.Number+i]=buffer[current++]; | 990 | for(i=0;i<current2+1;i++) smsframe[PHONE_SMSSubmit.Number+i]=buffer[current++]; |
935 | } | 991 | } |
936 | } else { | 992 | } else { |
937 | for(i=0;i<current2+1;i++) smsframe[PHONE_SMSSubmit.Number+i]=buffer[current++]; | 993 | for(i=0;i<current2+1;i++) smsframe[PHONE_SMSSubmit.Number+i]=buffer[current++]; |
938 | } | 994 | } |
939 | smsframe[PHONE_SMSSubmit.TPPID] = buffer[current++]; | 995 | smsframe[PHONE_SMSSubmit.TPPID] = buffer[current++]; |
940 | smsframe[PHONE_SMSSubmit.TPDCS] = buffer[current++]; | 996 | smsframe[PHONE_SMSSubmit.TPDCS] = buffer[current++]; |
941 | /* See GSM 03.40 9.2.3.3 - TPVP can not exist in frame */ | 997 | /* See GSM 03.40 9.2.3.3 - TPVP can not exist in frame */ |
942 | if ((smsframe[12] & 0x18)!=0) current++; //TPVP is ignored now | 998 | if ((smsframe[12] & 0x18)!=0) current++; //TPVP is ignored now |
943 | smsframe[PHONE_SMSSubmit.TPUDL] = buffer[current++]; | 999 | smsframe[PHONE_SMSSubmit.TPUDL] = buffer[current++]; |
944 | for(i=0;i<smsframe[PHONE_SMSSubmit.TPUDL];i++) smsframe[i+PHONE_SMSSubmit.Text]=buffer[current++]; | 1000 | for(i=0;i<smsframe[PHONE_SMSSubmit.TPUDL];i++) smsframe[i+PHONE_SMSSubmit.Text]=buffer[current++]; |
945 | GSM_DecodeSMSFrame(sms,smsframe,PHONE_SMSSubmit); | 1001 | GSM_DecodeSMSFrame(sms,smsframe,PHONE_SMSSubmit); |
946 | return ERR_NONE; | 1002 | return ERR_NONE; |
947 | case 0x02: | 1003 | case 0x02: |
948 | smprintf(s, "SMS type - status report\n"); | 1004 | smprintf(s, "SMS type - status report\n"); |
949 | sms->PDU = SMS_Status_Report; | 1005 | sms->PDU = SMS_Status_Report; |
950 | sms->Folder = 1;/*INBOX SIM*/ | 1006 | sms->Folder = 1;/*INBOX SIM*/ |
951 | sms->InboxFolder = true; | 1007 | sms->InboxFolder = true; |
952 | smprintf(s, "TPMR is %02x\n",buffer[current]); | 1008 | smprintf(s, "TPMR is %d\n",buffer[current]); |
953 | smsframe[PHONE_SMSStatusReport.TPMR] = buffer[current++]; | 1009 | smsframe[PHONE_SMSStatusReport.TPMR] = buffer[current++]; |
954 | current2=((buffer[current])+1)/2+1; | 1010 | current2=((buffer[current])+1)/2+1; |
955 | for(i=0;i<current2+1;i++) smsframe[PHONE_SMSStatusReport.Number+i]=buffer[current++]; | 1011 | for(i=0;i<current2+1;i++) smsframe[PHONE_SMSStatusReport.Number+i]=buffer[current++]; |
956 | for(i=0;i<7;i++) smsframe[PHONE_SMSStatusReport.DateTime+i]=buffer[current++]; | 1012 | for(i=0;i<7;i++) smsframe[PHONE_SMSStatusReport.DateTime+i]=buffer[current++]; |
957 | for(i=0;i<7;i++) smsframe[PHONE_SMSStatusReport.SMSCTime+i]=buffer[current++]; | 1013 | for(i=0;i<7;i++) smsframe[PHONE_SMSStatusReport.SMSCTime+i]=buffer[current++]; |
958 | smsframe[PHONE_SMSStatusReport.TPStatus]=buffer[current]; | 1014 | smsframe[PHONE_SMSStatusReport.TPStatus]=buffer[current]; |
959 | GSM_DecodeSMSFrame(sms,smsframe,PHONE_SMSStatusReport); | 1015 | GSM_DecodeSMSFrame(sms,smsframe,PHONE_SMSStatusReport); |
960 | return ERR_NONE; | 1016 | return ERR_NONE; |
961 | } | 1017 | } |
962 | break; | 1018 | break; |
963 | case SMS_AT_TXT: | 1019 | case SMS_AT_TXT: |
964 | current = 0; | 1020 | current = 0; |
@@ -1631,35 +1687,35 @@ GSM_Error ATGEN_ReplySendSMS(GSM_Protocol_Message msg, GSM_StateMachine *s) | |||
1631 | if (s->Protocol.Data.AT.EditMode) { | 1687 | if (s->Protocol.Data.AT.EditMode) { |
1632 | if (s->Phone.Data.Priv.ATGEN.ReplyState != AT_Reply_SMSEdit) { | 1688 | if (s->Phone.Data.Priv.ATGEN.ReplyState != AT_Reply_SMSEdit) { |
1633 | return ERR_UNKNOWN; | 1689 | return ERR_UNKNOWN; |
1634 | } | 1690 | } |
1635 | s->Protocol.Data.AT.EditMode = false; | 1691 | s->Protocol.Data.AT.EditMode = false; |
1636 | return ERR_NONE; | 1692 | return ERR_NONE; |
1637 | } | 1693 | } |
1638 | 1694 | ||
1639 | switch (Priv->ReplyState) { | 1695 | switch (Priv->ReplyState) { |
1640 | case AT_Reply_OK: | 1696 | case AT_Reply_OK: |
1641 | smprintf(s, "SMS sent OK\n"); | 1697 | smprintf(s, "SMS sent OK\n"); |
1642 | if (s->User.SendSMSStatus!=NULL) { | 1698 | if (s->User.SendSMSStatus!=NULL) { |
1643 | start = strstr(msg.Buffer, "+CMGW: "); | 1699 | start = strstr(msg.Buffer, "+CMGS: "); |
1644 | if (start != NULL) { | 1700 | if (start != NULL) { |
1645 | s->User.SendSMSStatus(s->CurrentConfig->Device,0,atoi(start+7)); | 1701 | s->User.SendSMSStatus(s->CurrentConfig->Device,0,atoi(start+7)); |
1646 | } else { | 1702 | } else { |
1647 | s->User.SendSMSStatus(s->CurrentConfig->Device,0,0); | 1703 | s->User.SendSMSStatus(s->CurrentConfig->Device,0,-1); |
1648 | } | 1704 | } |
1649 | } | 1705 | } |
1650 | return ERR_NONE; | 1706 | return ERR_NONE; |
1651 | case AT_Reply_CMSError: | 1707 | case AT_Reply_CMSError: |
1652 | smprintf(s, "Error %i\n",Priv->ErrorCode); | 1708 | smprintf(s, "Error %i\n",Priv->ErrorCode); |
1653 | if (s->User.SendSMSStatus!=NULL) s->User.SendSMSStatus(s->CurrentConfig->Device,Priv->ErrorCode,0); | 1709 | if (s->User.SendSMSStatus!=NULL) s->User.SendSMSStatus(s->CurrentConfig->Device,Priv->ErrorCode,-1); |
1654 | return ATGEN_HandleCMSError(s); | 1710 | return ATGEN_HandleCMSError(s); |
1655 | case AT_Reply_Error: | 1711 | case AT_Reply_Error: |
1656 | return ERR_UNKNOWN; | 1712 | return ERR_UNKNOWN; |
1657 | default: | 1713 | default: |
1658 | return ERR_UNKNOWNRESPONSE; | 1714 | return ERR_UNKNOWNRESPONSE; |
1659 | } | 1715 | } |
1660 | } | 1716 | } |
1661 | 1717 | ||
1662 | GSM_Error ATGEN_SendSMS(GSM_StateMachine *s, GSM_SMSMessage *sms) | 1718 | GSM_Error ATGEN_SendSMS(GSM_StateMachine *s, GSM_SMSMessage *sms) |
1663 | { | 1719 | { |
1664 | GSM_Error error,error2; | 1720 | GSM_Error error,error2; |
1665 | int current, current2, Replies; | 1721 | int current, current2, Replies; |
@@ -1778,24 +1834,37 @@ GSM_Error ATGEN_SetDateTime(GSM_StateMachine *s, GSM_DateTime *date_time) | |||
1778 | GSM_Error ATGEN_GetAlarm(GSM_StateMachine *s, GSM_Alarm *alarm) | 1834 | GSM_Error ATGEN_GetAlarm(GSM_StateMachine *s, GSM_Alarm *alarm) |
1779 | { | 1835 | { |
1780 | if (alarm->Location != 1) return ERR_NOTSUPPORTED; | 1836 | if (alarm->Location != 1) return ERR_NOTSUPPORTED; |
1781 | 1837 | ||
1782 | alarm->Repeating = true; | 1838 | alarm->Repeating = true; |
1783 | alarm->Text[0] = 0; alarm->Text[1] = 0; | 1839 | alarm->Text[0] = 0; alarm->Text[1] = 0; |
1784 | 1840 | ||
1785 | s->Phone.Data.Alarm = alarm; | 1841 | s->Phone.Data.Alarm = alarm; |
1786 | smprintf(s, "Getting alarm\n"); | 1842 | smprintf(s, "Getting alarm\n"); |
1787 | return GSM_WaitFor (s, "AT+CALA?\r", 9, 0x00, 4, ID_GetAlarm); | 1843 | return GSM_WaitFor (s, "AT+CALA?\r", 9, 0x00, 4, ID_GetAlarm); |
1788 | } | 1844 | } |
1789 | 1845 | ||
1846 | /* R320 only takes HH:MM. Do other phones understand full date? */ | ||
1847 | GSM_Error ATGEN_SetAlarm(GSM_StateMachine *s, GSM_Alarm *alarm) | ||
1848 | { | ||
1849 | char req[20]; | ||
1850 | |||
1851 | if (alarm->Location != 1) return ERR_INVALIDLOCATION; | ||
1852 | |||
1853 | sprintf(req, "AT+CALA=\"%02i:%02i\"\r",alarm->DateTime.Hour,alarm->DateTime.Minute); | ||
1854 | |||
1855 | smprintf(s, "Setting Alarm\n"); | ||
1856 | return GSM_WaitFor (s, req, strlen(req), 0x00, 3, ID_SetAlarm); | ||
1857 | } | ||
1858 | |||
1790 | GSM_Error ATGEN_ReplyGetSMSC(GSM_Protocol_Message msg, GSM_StateMachine *s) | 1859 | GSM_Error ATGEN_ReplyGetSMSC(GSM_Protocol_Message msg, GSM_StateMachine *s) |
1791 | { | 1860 | { |
1792 | GSM_SMSC *SMSC = s->Phone.Data.SMSC; | 1861 | GSM_SMSC *SMSC = s->Phone.Data.SMSC; |
1793 | int current; | 1862 | int current; |
1794 | int len; | 1863 | int len; |
1795 | unsigned char buffer[100]; | 1864 | unsigned char buffer[100]; |
1796 | 1865 | ||
1797 | switch (s->Phone.Data.Priv.ATGEN.ReplyState) { | 1866 | switch (s->Phone.Data.Priv.ATGEN.ReplyState) { |
1798 | case AT_Reply_OK: | 1867 | case AT_Reply_OK: |
1799 | smprintf(s, "SMSC info received\n"); | 1868 | smprintf(s, "SMSC info received\n"); |
1800 | 1869 | ||
1801 | current = 0; | 1870 | current = 0; |
@@ -2193,24 +2262,26 @@ GSM_Error ATGEN_GetMemoryInfo(GSM_StateMachine *s, GSM_MemoryStatus *Status, GSM | |||
2193 | char req[20]; | 2262 | char req[20]; |
2194 | int start; | 2263 | int start; |
2195 | int end; | 2264 | int end; |
2196 | GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN; | 2265 | GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN; |
2197 | 2266 | ||
2198 | smprintf(s, "Getting memory information\n"); | 2267 | smprintf(s, "Getting memory information\n"); |
2199 | 2268 | ||
2200 | Priv->MemorySize = 0; | 2269 | Priv->MemorySize = 0; |
2201 | Priv->TextLength = 0; | 2270 | Priv->TextLength = 0; |
2202 | Priv->NumberLength = 0; | 2271 | Priv->NumberLength = 0; |
2203 | 2272 | ||
2204 | error = GSM_WaitFor (s, "AT+CPBR=?\r", 10, 0x00, 4, ID_GetMemoryStatus); | 2273 | error = GSM_WaitFor (s, "AT+CPBR=?\r", 10, 0x00, 4, ID_GetMemoryStatus); |
2274 | if (Priv->Manufacturer == AT_Samsung) | ||
2275 | error = GSM_WaitFor (s, "", 0, 0x00, 4, ID_GetMemoryStatus); | ||
2205 | if (error != ERR_NONE) return error; | 2276 | if (error != ERR_NONE) return error; |
2206 | if (NeededInfo == AT_Total || NeededInfo == AT_Sizes || NeededInfo == AT_First) return ERR_NONE; | 2277 | if (NeededInfo == AT_Total || NeededInfo == AT_Sizes || NeededInfo == AT_First) return ERR_NONE; |
2207 | 2278 | ||
2208 | smprintf(s, "Getting memory status by reading values\n"); | 2279 | smprintf(s, "Getting memory status by reading values\n"); |
2209 | 2280 | ||
2210 | s->Phone.Data.MemoryStatus= Status; | 2281 | s->Phone.Data.MemoryStatus= Status; |
2211 | Status->MemoryUsed = 0; | 2282 | Status->MemoryUsed = 0; |
2212 | Status->MemoryFree = 0; | 2283 | Status->MemoryFree = 0; |
2213 | start = Priv->FirstMemoryEntry; | 2284 | start = Priv->FirstMemoryEntry; |
2214 | Priv->NextMemoryEntry = 0; | 2285 | Priv->NextMemoryEntry = 0; |
2215 | while (1) { | 2286 | while (1) { |
2216 | end= start + 20; | 2287 | end= start + 20; |
@@ -2259,24 +2330,30 @@ GSM_Error ATGEN_SetPBKCharset(GSM_StateMachine *s, bool PreferUnicode) | |||
2259 | /* If we want unicode charset and we have it already or setting of it | 2330 | /* If we want unicode charset and we have it already or setting of it |
2260 | * failed, we have nothing to do. */ | 2331 | * failed, we have nothing to do. */ |
2261 | if (PreferUnicode && (Priv->PBKCharset==AT_PBK_UCS2 || Priv->UCS2CharsetFailed)) return ERR_NONE; | 2332 | if (PreferUnicode && (Priv->PBKCharset==AT_PBK_UCS2 || Priv->UCS2CharsetFailed)) return ERR_NONE; |
2262 | 2333 | ||
2263 | /* If we don't need unicode charset and we have some (or have unicode | 2334 | /* If we don't need unicode charset and we have some (or have unicode |
2264 | * charset when other failed), we have nothing to do. */ | 2335 | * charset when other failed), we have nothing to do. */ |
2265 | if (!PreferUnicode && (Priv->PBKCharset!=AT_PBK_UCS2 || Priv->NonUCS2CharsetFailed)) return ERR_NONE; | 2336 | if (!PreferUnicode && (Priv->PBKCharset!=AT_PBK_UCS2 || Priv->NonUCS2CharsetFailed)) return ERR_NONE; |
2266 | } | 2337 | } |
2267 | 2338 | ||
2268 | error=ATGEN_GetManufacturer(s); | 2339 | error=ATGEN_GetManufacturer(s); |
2269 | if (error != ERR_NONE) return error; | 2340 | if (error != ERR_NONE) return error; |
2270 | 2341 | ||
2342 | /* Samsung (and Sagem?) phones use only PCCP437? */ | ||
2343 | if (Priv->Manufacturer == AT_Samsung) { | ||
2344 | Priv->PBKCharset = AT_PBK_PCCP437; | ||
2345 | return ERR_NONE; | ||
2346 | } | ||
2347 | |||
2271 | if (PreferUnicode && !Priv->UCS2CharsetFailed) { | 2348 | if (PreferUnicode && !Priv->UCS2CharsetFailed) { |
2272 | smprintf(s, "Setting charset to UCS2\n"); | 2349 | smprintf(s, "Setting charset to UCS2\n"); |
2273 | error=GSM_WaitFor (s, "AT+CSCS=\"UCS2\"\r", 15, 0x00, 3, ID_SetMemoryCharset); | 2350 | error=GSM_WaitFor (s, "AT+CSCS=\"UCS2\"\r", 15, 0x00, 3, ID_SetMemoryCharset); |
2274 | if (error == ERR_NONE) { | 2351 | if (error == ERR_NONE) { |
2275 | Priv->PBKCharset = AT_PBK_UCS2; | 2352 | Priv->PBKCharset = AT_PBK_UCS2; |
2276 | return ERR_NONE; | 2353 | return ERR_NONE; |
2277 | } else { | 2354 | } else { |
2278 | Priv->UCS2CharsetFailed = true; | 2355 | Priv->UCS2CharsetFailed = true; |
2279 | } | 2356 | } |
2280 | } | 2357 | } |
2281 | 2358 | ||
2282 | smprintf(s, "Setting charset to HEX\n"); | 2359 | smprintf(s, "Setting charset to HEX\n"); |
@@ -2376,25 +2453,55 @@ GSM_Error ATGEN_ReplyGetMemory(GSM_Protocol_Message msg, GSM_StateMachine *s) | |||
2376 | Memory->Entries[1].EntryType=PBK_Text_Name; | 2453 | Memory->Entries[1].EntryType=PBK_Text_Name; |
2377 | switch (Priv->PBKCharset) { | 2454 | switch (Priv->PBKCharset) { |
2378 | case AT_PBK_HEX: | 2455 | case AT_PBK_HEX: |
2379 | DecodeHexBin(buffer2,buffer+1,strlen(buffer)-2); | 2456 | DecodeHexBin(buffer2,buffer+1,strlen(buffer)-2); |
2380 | DecodeDefault(Memory->Entries[1].Text,buffer2,strlen(buffer2),false,NULL); | 2457 | DecodeDefault(Memory->Entries[1].Text,buffer2,strlen(buffer2),false,NULL); |
2381 | break; | 2458 | break; |
2382 | case AT_PBK_GSM: | 2459 | case AT_PBK_GSM: |
2383 | DecodeDefault(Memory->Entries[1].Text,buffer+1,strlen(buffer)-2,false,NULL); | 2460 | DecodeDefault(Memory->Entries[1].Text,buffer+1,strlen(buffer)-2,false,NULL); |
2384 | break; | 2461 | break; |
2385 | case AT_PBK_UCS2: | 2462 | case AT_PBK_UCS2: |
2386 | DecodeHexUnicode(Memory->Entries[1].Text,buffer+1,strlen(buffer+1) - 1); | 2463 | DecodeHexUnicode(Memory->Entries[1].Text,buffer+1,strlen(buffer+1) - 1); |
2387 | break; | 2464 | break; |
2465 | case AT_PBK_PCCP437: | ||
2466 | /* FIXME: correctly decode PCCP437 */ | ||
2467 | DecodeDefault(Memory->Entries[1].Text,buffer+1,strlen(buffer)-2,false,NULL); | ||
2468 | break; | ||
2469 | } | ||
2470 | |||
2471 | /* Samsung number type */ | ||
2472 | if (Priv->Manufacturer == AT_Samsung) { | ||
2473 | int type; | ||
2474 | |||
2475 | pos += ATGEN_ExtractOneParameter(pos, buffer); | ||
2476 | smprintf(s, "Number type: %s\n",buffer); | ||
2477 | type = strtoul(buffer, NULL, 0); | ||
2478 | switch (type) { | ||
2479 | case 0: | ||
2480 | Memory->Entries[0].EntryType = PBK_Number_Mobile; | ||
2481 | break; | ||
2482 | case 1: | ||
2483 | Memory->Entries[0].EntryType = PBK_Number_Work; | ||
2484 | break; | ||
2485 | case 2: | ||
2486 | Memory->Entries[0].EntryType = PBK_Number_Home; | ||
2487 | break; | ||
2488 | case 3: | ||
2489 | Memory->Entries[0].EntryType = PBK_Text_Email; | ||
2490 | break; | ||
2491 | default: | ||
2492 | Memory->Entries[0].EntryType = PBK_Number_General; | ||
2493 | } | ||
2388 | } | 2494 | } |
2495 | |||
2389 | return ERR_NONE; | 2496 | return ERR_NONE; |
2390 | case AT_Reply_CMEError: | 2497 | case AT_Reply_CMEError: |
2391 | return ATGEN_HandleCMEError(s); | 2498 | return ATGEN_HandleCMEError(s); |
2392 | case AT_Reply_Error: | 2499 | case AT_Reply_Error: |
2393 | smprintf(s, "Error - too high location ?\n"); | 2500 | smprintf(s, "Error - too high location ?\n"); |
2394 | return ERR_INVALIDLOCATION; | 2501 | return ERR_INVALIDLOCATION; |
2395 | case AT_Reply_CMSError: | 2502 | case AT_Reply_CMSError: |
2396 | return ATGEN_HandleCMSError(s); | 2503 | return ATGEN_HandleCMSError(s); |
2397 | default: | 2504 | default: |
2398 | break; | 2505 | break; |
2399 | } | 2506 | } |
2400 | return ERR_UNKNOWNRESPONSE; | 2507 | return ERR_UNKNOWNRESPONSE; |
@@ -2553,24 +2660,26 @@ GSM_Error ATGEN_DialVoice(GSM_StateMachine *s, char *number, GSM_CallShowNumber | |||
2553 | 2660 | ||
2554 | GSM_Error ATGEN_ReplyEnterSecurityCode(GSM_Protocol_Message msg, GSM_StateMachine *s) | 2661 | GSM_Error ATGEN_ReplyEnterSecurityCode(GSM_Protocol_Message msg, GSM_StateMachine *s) |
2555 | { | 2662 | { |
2556 | switch (s->Phone.Data.Priv.ATGEN.ReplyState) { | 2663 | switch (s->Phone.Data.Priv.ATGEN.ReplyState) { |
2557 | case AT_Reply_OK: | 2664 | case AT_Reply_OK: |
2558 | smprintf(s, "Security code was OK\n"); | 2665 | smprintf(s, "Security code was OK\n"); |
2559 | return ERR_NONE; | 2666 | return ERR_NONE; |
2560 | case AT_Reply_Error: | 2667 | case AT_Reply_Error: |
2561 | smprintf(s, "Incorrect security code\n"); | 2668 | smprintf(s, "Incorrect security code\n"); |
2562 | return ERR_SECURITYERROR; | 2669 | return ERR_SECURITYERROR; |
2563 | case AT_Reply_CMSError: | 2670 | case AT_Reply_CMSError: |
2564 | return ATGEN_HandleCMSError(s); | 2671 | return ATGEN_HandleCMSError(s); |
2672 | case AT_Reply_CMEError: | ||
2673 | return ATGEN_HandleCMEError(s); | ||
2565 | default: | 2674 | default: |
2566 | break; | 2675 | break; |
2567 | } | 2676 | } |
2568 | return ERR_UNKNOWNRESPONSE; | 2677 | return ERR_UNKNOWNRESPONSE; |
2569 | } | 2678 | } |
2570 | 2679 | ||
2571 | GSM_Error ATGEN_EnterSecurityCode(GSM_StateMachine *s, GSM_SecurityCode Code) | 2680 | GSM_Error ATGEN_EnterSecurityCode(GSM_StateMachine *s, GSM_SecurityCode Code) |
2572 | { | 2681 | { |
2573 | unsigned char req[50]; | 2682 | unsigned char req[50]; |
2574 | 2683 | ||
2575 | switch (Code.Type) { | 2684 | switch (Code.Type) { |
2576 | case SEC_Pin : | 2685 | case SEC_Pin : |
@@ -2915,24 +3024,30 @@ GSM_Error ATGEN_PrivSetMemory(GSM_StateMachine *s, GSM_MemoryEntry *entry) | |||
2915 | EncodeHexBin(name, DecodeUnicodeString(entry->Entries[Name].Text), UnicodeLength(entry->Entries[Name].Text)); | 3024 | EncodeHexBin(name, DecodeUnicodeString(entry->Entries[Name].Text), UnicodeLength(entry->Entries[Name].Text)); |
2916 | len = strlen(name); | 3025 | len = strlen(name); |
2917 | break; | 3026 | break; |
2918 | case AT_PBK_GSM: | 3027 | case AT_PBK_GSM: |
2919 | smprintf(s, "str: %s\n", DecodeUnicodeString(entry->Entries[Name].Text)); | 3028 | smprintf(s, "str: %s\n", DecodeUnicodeString(entry->Entries[Name].Text)); |
2920 | len = UnicodeLength(entry->Entries[Name].Text); | 3029 | len = UnicodeLength(entry->Entries[Name].Text); |
2921 | EncodeDefault(name, entry->Entries[Name].Text, &len, true, NULL); | 3030 | EncodeDefault(name, entry->Entries[Name].Text, &len, true, NULL); |
2922 | break; | 3031 | break; |
2923 | case AT_PBK_UCS2: | 3032 | case AT_PBK_UCS2: |
2924 | EncodeHexUnicode(name, entry->Entries[Name].Text, UnicodeLength(entry->Entries[Name].Text)); | 3033 | EncodeHexUnicode(name, entry->Entries[Name].Text, UnicodeLength(entry->Entries[Name].Text)); |
2925 | len = strlen(name); | 3034 | len = strlen(name); |
2926 | break; | 3035 | break; |
3036 | case AT_PBK_PCCP437: | ||
3037 | /* FIXME: correctly decode PCCP437 */ | ||
3038 | smprintf(s, "str: %s\n", DecodeUnicodeString(entry->Entries[Name].Text)); | ||
3039 | len = UnicodeLength(entry->Entries[Name].Text); | ||
3040 | EncodeDefault(name, entry->Entries[Name].Text, &len, true, NULL); | ||
3041 | break; | ||
2927 | } | 3042 | } |
2928 | } else { | 3043 | } else { |
2929 | smprintf(s, "WARNING: No usable name found!\n"); | 3044 | smprintf(s, "WARNING: No usable name found!\n"); |
2930 | len = 0; | 3045 | len = 0; |
2931 | } | 3046 | } |
2932 | 3047 | ||
2933 | if (Number != -1) { | 3048 | if (Number != -1) { |
2934 | GSM_PackSemiOctetNumber(entry->Entries[Number].Text, number, false); | 3049 | GSM_PackSemiOctetNumber(entry->Entries[Number].Text, number, false); |
2935 | NumberType = number[0]; | 3050 | NumberType = number[0]; |
2936 | sprintf(number,"%s",DecodeUnicodeString(entry->Entries[Number].Text)); | 3051 | sprintf(number,"%s",DecodeUnicodeString(entry->Entries[Number].Text)); |
2937 | } else { | 3052 | } else { |
2938 | smprintf(s, "WARNING: No usable number found!\n"); | 3053 | smprintf(s, "WARNING: No usable number found!\n"); |
@@ -3243,24 +3358,61 @@ GSM_Error ATGEN_AddCalendarNote(GSM_StateMachine *s, GSM_CalendarEntry *Note) | |||
3243 | return ERR_NOTSUPPORTED; | 3358 | return ERR_NOTSUPPORTED; |
3244 | } | 3359 | } |
3245 | 3360 | ||
3246 | GSM_Error ATGEN_DelCalendarNote(GSM_StateMachine *s, GSM_CalendarEntry *Note) | 3361 | GSM_Error ATGEN_DelCalendarNote(GSM_StateMachine *s, GSM_CalendarEntry *Note) |
3247 | { | 3362 | { |
3248 | GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN; | 3363 | GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN; |
3249 | 3364 | ||
3250 | if (Priv->Manufacturer==AT_Siemens) return SIEMENS_DelCalendarNote(s, Note); | 3365 | if (Priv->Manufacturer==AT_Siemens) return SIEMENS_DelCalendarNote(s, Note); |
3251 | if (Priv->Manufacturer==AT_Ericsson) return SONYERIC_DelCalendarNote(s, Note); | 3366 | if (Priv->Manufacturer==AT_Ericsson) return SONYERIC_DelCalendarNote(s, Note); |
3252 | return ERR_NOTSUPPORTED; | 3367 | return ERR_NOTSUPPORTED; |
3253 | } | 3368 | } |
3254 | 3369 | ||
3370 | |||
3371 | GSM_Error ATGEN_GetBitmap(GSM_StateMachine *s, GSM_Bitmap *Bitmap) | ||
3372 | { | ||
3373 | GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; | ||
3374 | |||
3375 | if (Priv->Manufacturer==AT_Siemens) return SIEMENS_GetBitmap(s, Bitmap); | ||
3376 | if (Priv->Manufacturer==AT_Samsung) return SAMSUNG_GetBitmap(s, Bitmap); | ||
3377 | return ERR_NOTSUPPORTED; | ||
3378 | } | ||
3379 | |||
3380 | GSM_Error ATGEN_SetBitmap(GSM_StateMachine *s, GSM_Bitmap *Bitmap) | ||
3381 | { | ||
3382 | GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; | ||
3383 | |||
3384 | if (Priv->Manufacturer==AT_Siemens) return SIEMENS_SetBitmap(s, Bitmap); | ||
3385 | if (Priv->Manufacturer==AT_Samsung) return SAMSUNG_SetBitmap(s, Bitmap); | ||
3386 | return ERR_NOTSUPPORTED; | ||
3387 | } | ||
3388 | |||
3389 | GSM_Error ATGEN_GetRingtone(GSM_StateMachine *s, GSM_Ringtone *Ringtone, bool PhoneRingtone) | ||
3390 | { | ||
3391 | GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; | ||
3392 | |||
3393 | if (Priv->Manufacturer==AT_Siemens) return SIEMENS_GetRingtone(s, Ringtone, PhoneRingtone); | ||
3394 | if (Priv->Manufacturer==AT_Samsung) return SAMSUNG_GetRingtone(s, Ringtone, PhoneRingtone); | ||
3395 | return ERR_NOTSUPPORTED; | ||
3396 | } | ||
3397 | |||
3398 | GSM_Error ATGEN_SetRingtone(GSM_StateMachine *s, GSM_Ringtone *Ringtone, int *maxlength) | ||
3399 | { | ||
3400 | GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; | ||
3401 | |||
3402 | if (Priv->Manufacturer==AT_Siemens) return SIEMENS_SetRingtone(s, Ringtone, maxlength); | ||
3403 | if (Priv->Manufacturer==AT_Samsung) return SAMSUNG_SetRingtone(s, Ringtone, maxlength); | ||
3404 | return ERR_NOTSUPPORTED; | ||
3405 | } | ||
3406 | |||
3255 | GSM_Error ATGEN_PressKey(GSM_StateMachine *s, GSM_KeyCode Key, bool Press) | 3407 | GSM_Error ATGEN_PressKey(GSM_StateMachine *s, GSM_KeyCode Key, bool Press) |
3256 | { | 3408 | { |
3257 | GSM_Errorerror; | 3409 | GSM_Errorerror; |
3258 | unsigned char Frame[] = "AT+CKPD=\"?\"\r"; | 3410 | unsigned char Frame[] = "AT+CKPD=\"?\"\r"; |
3259 | 3411 | ||
3260 | if (Press) { | 3412 | if (Press) { |
3261 | switch (Key) { | 3413 | switch (Key) { |
3262 | case GSM_KEY_1 : Frame[9] = '1'; break; | 3414 | case GSM_KEY_1 : Frame[9] = '1'; break; |
3263 | case GSM_KEY_2 : Frame[9] = '2'; break; | 3415 | case GSM_KEY_2 : Frame[9] = '2'; break; |
3264 | case GSM_KEY_3 : Frame[9] = '3'; break; | 3416 | case GSM_KEY_3 : Frame[9] = '3'; break; |
3265 | case GSM_KEY_4 : Frame[9] = '4'; break; | 3417 | case GSM_KEY_4 : Frame[9] = '4'; break; |
3266 | case GSM_KEY_5 : Frame[9] = '5'; break; | 3418 | case GSM_KEY_5 : Frame[9] = '5'; break; |
@@ -3337,24 +3489,35 @@ GSM_Error ATGEN_SetIncomingCB(GSM_StateMachine *s, bool enable) | |||
3337 | return GSM_WaitFor(s, "AT+CNMI=3,,2\r", 13, 0x00, 4, ID_SetIncomingCB); | 3489 | return GSM_WaitFor(s, "AT+CNMI=3,,2\r", 13, 0x00, 4, ID_SetIncomingCB); |
3338 | } else { | 3490 | } else { |
3339 | smprintf(s, "Disabling incoming CB\n"); | 3491 | smprintf(s, "Disabling incoming CB\n"); |
3340 | return GSM_WaitFor(s, "AT+CNMI=3,,0\r", 13, 0x00, 4, ID_SetIncomingCB); | 3492 | return GSM_WaitFor(s, "AT+CNMI=3,,0\r", 13, 0x00, 4, ID_SetIncomingCB); |
3341 | } | 3493 | } |
3342 | } | 3494 | } |
3343 | return ERR_NONE; | 3495 | return ERR_NONE; |
3344 | #else | 3496 | #else |
3345 | return ERR_SOURCENOTAVAILABLE; | 3497 | return ERR_SOURCENOTAVAILABLE; |
3346 | #endif | 3498 | #endif |
3347 | } | 3499 | } |
3348 | 3500 | ||
3501 | GSM_Error ATGEN_SetFastSMSSending(GSM_StateMachine *s, bool enable) | ||
3502 | { | ||
3503 | if (enable) { | ||
3504 | smprintf(s, "Enabling fast SMS sending\n"); | ||
3505 | return GSM_WaitFor(s, "AT+CMMS=2\r", 10, 0x00, 4, ID_SetFastSMSSending); | ||
3506 | } else { | ||
3507 | smprintf(s, "Disabling fast SMS sending\n"); | ||
3508 | return GSM_WaitFor(s, "AT+CMMS=0\r", 10, 0x00, 4, ID_SetFastSMSSending); | ||
3509 | } | ||
3510 | } | ||
3511 | |||
3349 | GSM_Error ATGEN_IncomingSMSInfo(GSM_Protocol_Message msg, GSM_StateMachine *s) | 3512 | GSM_Error ATGEN_IncomingSMSInfo(GSM_Protocol_Message msg, GSM_StateMachine *s) |
3350 | { | 3513 | { |
3351 | smprintf(s, "Incoming SMS\n"); | 3514 | smprintf(s, "Incoming SMS\n"); |
3352 | return ERR_NONE; | 3515 | return ERR_NONE; |
3353 | } | 3516 | } |
3354 | 3517 | ||
3355 | GSM_Error ATGEN_IncomingSMSDeliver(GSM_Protocol_Message msg, GSM_StateMachine *s) | 3518 | GSM_Error ATGEN_IncomingSMSDeliver(GSM_Protocol_Message msg, GSM_StateMachine *s) |
3356 | { | 3519 | { |
3357 | GSM_Phone_Data *Data = &s->Phone.Data; | 3520 | GSM_Phone_Data *Data = &s->Phone.Data; |
3358 | GSM_SMSMessage sms; | 3521 | GSM_SMSMessage sms; |
3359 | int current = 0, current2, i=0; | 3522 | int current = 0, current2, i=0; |
3360 | unsigned char buffer[300],smsframe[800]; | 3523 | unsigned char buffer[300],smsframe[800]; |
@@ -3415,32 +3578,49 @@ GSM_Error ATGEN_SetIncomingSMS(GSM_StateMachine *s, bool enable) | |||
3415 | GSM_WaitFor(s, "AT+CNMI=3,,,1\r", 14, 0x00, 4, ID_SetIncomingSMS); | 3578 | GSM_WaitFor(s, "AT+CNMI=3,,,1\r", 14, 0x00, 4, ID_SetIncomingSMS); |
3416 | 3579 | ||
3417 | /* SMS deliver */ | 3580 | /* SMS deliver */ |
3418 | return GSM_WaitFor(s, "AT+CNMI=3,3\r", 12, 0x00, 4, ID_SetIncomingSMS); | 3581 | return GSM_WaitFor(s, "AT+CNMI=3,3\r", 12, 0x00, 4, ID_SetIncomingSMS); |
3419 | } else { | 3582 | } else { |
3420 | smprintf(s, "Disabling incoming SMS\n"); | 3583 | smprintf(s, "Disabling incoming SMS\n"); |
3421 | return GSM_WaitFor(s, "AT+CNMI=3,0\r", 12, 0x00, 4, ID_SetIncomingSMS); | 3584 | return GSM_WaitFor(s, "AT+CNMI=3,0\r", 12, 0x00, 4, ID_SetIncomingSMS); |
3422 | } | 3585 | } |
3423 | } | 3586 | } |
3424 | return ERR_NONE; | 3587 | return ERR_NONE; |
3425 | } | 3588 | } |
3426 | 3589 | ||
3590 | GSM_Error ATGEN_GetLocale(GSM_StateMachine *s, GSM_Locale *locale) | ||
3591 | { | ||
3592 | if (s->Phone.Data.Priv.ATGEN.Manufacturer==AT_Ericsson) return ERICSSON_GetLocale(s,locale); | ||
3593 | return ERR_NOTSUPPORTED; | ||
3594 | } | ||
3595 | |||
3596 | GSM_Error ATGEN_SetLocale(GSM_StateMachine *s, GSM_Locale *locale) | ||
3597 | { | ||
3598 | if (s->Phone.Data.Priv.ATGEN.Manufacturer==AT_Ericsson) return ERICSSON_SetLocale(s,locale); | ||
3599 | return ERR_NOTSUPPORTED; | ||
3600 | } | ||
3601 | |||
3427 | GSM_Reply_Function ATGENReplyFunctions[] = { | 3602 | GSM_Reply_Function ATGENReplyFunctions[] = { |
3428 | {ATGEN_GenericReply, "AT\r" ,0x00,0x00,ID_IncomingFrame }, | 3603 | {ATGEN_GenericReply, "AT\r" ,0x00,0x00,ID_IncomingFrame }, |
3429 | {ATGEN_GenericReply, "ATE1" ,0x00,0x00,ID_EnableEcho }, | 3604 | {ATGEN_GenericReply, "ATE1" ,0x00,0x00,ID_EnableEcho }, |
3430 | {ATGEN_GenericReply, "AT+CMEE=" ,0x00,0x00,ID_EnableErrorInfo }, | 3605 | {ATGEN_GenericReply, "AT+CMEE=" ,0x00,0x00,ID_EnableErrorInfo }, |
3431 | {ATGEN_GenericReply, "AT+CKPD=" ,0x00,0x00,ID_PressKey }, | 3606 | {ATGEN_GenericReply, "AT+CKPD=" ,0x00,0x00,ID_PressKey }, |
3432 | {ATGEN_ReplyGetSIMIMSI, "AT+CIMI" ,0x00,0x00,ID_GetSIMIMSI }, | 3607 | {ATGEN_ReplyGetSIMIMSI, "AT+CIMI" ,0x00,0x00,ID_GetSIMIMSI }, |
3433 | {ATGEN_GenericReply, "AT*EOBEX" ,0x00,0x00,ID_SetOBEX }, | 3608 | {ATGEN_GenericReply, "AT*EOBEX" ,0x00,0x00,ID_SetOBEX }, |
3434 | 3609 | ||
3610 | {ERICSSON_ReplyGetDateLocale, "*ESDF:" ,0x00,0x00,ID_GetLocale }, | ||
3611 | {ERICSSON_ReplyGetTimeLocale, "*ESTF:" ,0x00,0x00,ID_GetLocale }, | ||
3612 | {ATGEN_GenericReply, "AT*ESDF=" ,0x00,0x00,ID_SetLocale }, | ||
3613 | {ATGEN_GenericReply, "AT*ESTF=" ,0x00,0x00,ID_SetLocale }, | ||
3614 | |||
3435 | #ifdef GSM_ENABLE_CELLBROADCAST | 3615 | #ifdef GSM_ENABLE_CELLBROADCAST |
3436 | {ATGEN_ReplyIncomingCB, "+CBM:" ,0x00,0x00,ID_IncomingFrame }, | 3616 | {ATGEN_ReplyIncomingCB, "+CBM:" ,0x00,0x00,ID_IncomingFrame }, |
3437 | {ATGEN_GenericReply, "AT+CNMI" ,0x00,0x00,ID_SetIncomingCB }, | 3617 | {ATGEN_GenericReply, "AT+CNMI" ,0x00,0x00,ID_SetIncomingCB }, |
3438 | #endif | 3618 | #endif |
3439 | 3619 | ||
3440 | {ATGEN_IncomingBattery, "_OBS:" ,0x00,0x00,ID_IncomingFrame }, | 3620 | {ATGEN_IncomingBattery, "_OBS:" ,0x00,0x00,ID_IncomingFrame }, |
3441 | {ATGEN_ReplyGetBatteryCharge, "AT+CBC" ,0x00,0x00,ID_GetBatteryCharge }, | 3621 | {ATGEN_ReplyGetBatteryCharge, "AT+CBC" ,0x00,0x00,ID_GetBatteryCharge }, |
3442 | 3622 | ||
3443 | {ATGEN_ReplyGetModel, "AT+CGMM" ,0x00,0x00,ID_GetModel }, | 3623 | {ATGEN_ReplyGetModel, "AT+CGMM" ,0x00,0x00,ID_GetModel }, |
3444 | {ATGEN_ReplyGetManufacturer, "AT+CGMI" ,0x00,0x00,ID_GetManufacturer }, | 3624 | {ATGEN_ReplyGetManufacturer, "AT+CGMI" ,0x00,0x00,ID_GetManufacturer }, |
3445 | {ATGEN_ReplyGetFirmwareCGMR, "AT+CGMR" ,0x00,0x00,ID_GetFirmware }, | 3625 | {ATGEN_ReplyGetFirmwareCGMR, "AT+CGMR" ,0x00,0x00,ID_GetFirmware }, |
3446 | {ATGEN_ReplyGetFirmwareATI, "ATI" ,0x00,0x00,ID_GetFirmware }, | 3626 | {ATGEN_ReplyGetFirmwareATI, "ATI" ,0x00,0x00,ID_GetFirmware }, |
@@ -3453,122 +3633,134 @@ GSM_Reply_Function ATGENReplyFunctions[] = { | |||
3453 | {ATGEN_GenericReply, "AT+CSDH" ,0x00,0x00,ID_GetSMSMode }, | 3633 | {ATGEN_GenericReply, "AT+CSDH" ,0x00,0x00,ID_GetSMSMode }, |
3454 | {ATGEN_ReplyGetSMSMessage, "AT+CMGR" ,0x00,0x00,ID_GetSMSMessage }, | 3634 | {ATGEN_ReplyGetSMSMessage, "AT+CMGR" ,0x00,0x00,ID_GetSMSMessage }, |
3455 | {ATGEN_GenericReply, "AT+CPMS" ,0x00,0x00,ID_SetMemoryType }, | 3635 | {ATGEN_GenericReply, "AT+CPMS" ,0x00,0x00,ID_SetMemoryType }, |
3456 | {ATGEN_ReplyGetSMSStatus, "AT+CPMS" ,0x00,0x00,ID_GetSMSStatus }, | 3636 | {ATGEN_ReplyGetSMSStatus, "AT+CPMS" ,0x00,0x00,ID_GetSMSStatus }, |
3457 | {ATGEN_ReplyGetSMSMemories, "AT+CPMS=?" ,0x00,0x00,ID_GetSMSMemories }, | 3637 | {ATGEN_ReplyGetSMSMemories, "AT+CPMS=?" ,0x00,0x00,ID_GetSMSMemories }, |
3458 | {ATGEN_ReplyAddSMSMessage, "AT+CMGW" ,0x00,0x00,ID_SaveSMSMessage }, | 3638 | {ATGEN_ReplyAddSMSMessage, "AT+CMGW" ,0x00,0x00,ID_SaveSMSMessage }, |
3459 | {ATGEN_GenericReply, "AT+CSMP" ,0x00,0x00,ID_SetSMSParameters }, | 3639 | {ATGEN_GenericReply, "AT+CSMP" ,0x00,0x00,ID_SetSMSParameters }, |
3460 | {ATGEN_GenericReply, "AT+CSCA" ,0x00,0x00,ID_SetSMSC }, | 3640 | {ATGEN_GenericReply, "AT+CSCA" ,0x00,0x00,ID_SetSMSC }, |
3461 | {ATGEN_ReplyGetSMSC, "AT+CSCA?" ,0x00,0x00,ID_GetSMSC }, | 3641 | {ATGEN_ReplyGetSMSC, "AT+CSCA?" ,0x00,0x00,ID_GetSMSC }, |
3462 | {ATGEN_ReplyDeleteSMSMessage, "AT+CMGD" ,0x00,0x00,ID_DeleteSMSMessage }, | 3642 | {ATGEN_ReplyDeleteSMSMessage, "AT+CMGD" ,0x00,0x00,ID_DeleteSMSMessage }, |
3463 | {ATGEN_GenericReply, "ATE1" ,0x00,0x00,ID_SetSMSParameters }, | 3643 | {ATGEN_GenericReply, "ATE1" ,0x00,0x00,ID_SetSMSParameters }, |
3464 | {ATGEN_GenericReply, "\x1b\x0D" ,0x00,0x00,ID_SetSMSParameters }, | 3644 | {ATGEN_GenericReply, "\x1b\x0D" ,0x00,0x00,ID_SetSMSParameters }, |
3645 | {ATGEN_GenericReply, "AT+CMMS" ,0x00,0x00,ID_SetFastSMSSending }, | ||
3465 | {ATGEN_IncomingSMSInfo, "+CMTI:" ,0x00,0x00,ID_IncomingFrame }, | 3646 | {ATGEN_IncomingSMSInfo, "+CMTI:" ,0x00,0x00,ID_IncomingFrame }, |
3466 | {ATGEN_IncomingSMSDeliver, "+CMT:" ,0x00,0x00,ID_IncomingFrame }, | 3647 | {ATGEN_IncomingSMSDeliver, "+CMT:" ,0x00,0x00,ID_IncomingFrame }, |
3467 | {ATGEN_IncomingSMSReport, "+CDS:" ,0x00,0x00,ID_IncomingFrame }, | 3648 | {ATGEN_IncomingSMSReport, "+CDS:" ,0x00,0x00,ID_IncomingFrame }, |
3468 | {ATGEN_IncomingSMSCInfo, "^SCN:" ,0x00,0x00,ID_IncomingFrame }, | 3649 | {ATGEN_IncomingSMSCInfo, "^SCN:" ,0x00,0x00,ID_IncomingFrame }, |
3469 | 3650 | ||
3470 | {ATGEN_ReplyGetDateTime_Alarm, "AT+CCLK?" ,0x00,0x00,ID_GetDateTime }, | 3651 | {ATGEN_ReplyGetDateTime_Alarm, "AT+CCLK?" ,0x00,0x00,ID_GetDateTime }, |
3471 | {ATGEN_GenericReply, "AT+CCLK=" ,0x00,0x00,ID_SetDateTime }, | 3652 | {ATGEN_GenericReply, "AT+CCLK=" ,0x00,0x00,ID_SetDateTime }, |
3653 | {ATGEN_GenericReply, "AT+CALA=" ,0x00,0x00,ID_SetAlarm }, | ||
3472 | {ATGEN_ReplyGetDateTime_Alarm, "AT+CALA?" ,0x00,0x00,ID_GetAlarm }, | 3654 | {ATGEN_ReplyGetDateTime_Alarm, "AT+CALA?" ,0x00,0x00,ID_GetAlarm }, |
3473 | 3655 | ||
3474 | {ATGEN_ReplyGetNetworkLAC_CID, "AT+CREG?" ,0x00,0x00,ID_GetNetworkInfo }, | 3656 | {ATGEN_ReplyGetNetworkLAC_CID, "AT+CREG?" ,0x00,0x00,ID_GetNetworkInfo }, |
3475 | {ATGEN_GenericReply, "AT+CREG=2" ,0x00,0x00,ID_GetNetworkInfo }, | 3657 | {ATGEN_GenericReply, "AT+CREG=2" ,0x00,0x00,ID_GetNetworkInfo }, |
3476 | {ATGEN_GenericReply, "AT+COPS=" ,0x00,0x00,ID_GetNetworkInfo }, | 3658 | {ATGEN_GenericReply, "AT+COPS=" ,0x00,0x00,ID_GetNetworkInfo }, |
3477 | {ATGEN_GenericReply, "AT+COPS=" ,0x00,0x00,ID_SetAutoNetworkLogin}, | 3659 | {ATGEN_GenericReply, "AT+COPS=" ,0x00,0x00,ID_SetAutoNetworkLogin}, |
3478 | {ATGEN_ReplyGetNetworkCode, "AT+COPS" ,0x00,0x00,ID_GetNetworkInfo }, | 3660 | {ATGEN_ReplyGetNetworkCode, "AT+COPS" ,0x00,0x00,ID_GetNetworkInfo }, |
3479 | {ATGEN_ReplyGetSignalQuality, "AT+CSQ" ,0x00,0x00,ID_GetSignalQuality }, | 3661 | {ATGEN_ReplyGetSignalQuality, "AT+CSQ" ,0x00,0x00,ID_GetSignalQuality }, |
3480 | {ATGEN_IncomingNetworkLevel, "_OSIGQ:" ,0x00,0x00,ID_IncomingFrame }, | 3662 | {ATGEN_IncomingNetworkLevel, "_OSIGQ:" ,0x00,0x00,ID_IncomingFrame }, |
3481 | {ATGEN_IncomingGPRS, "+CGREG:" ,0x00,0x00,ID_IncomingFrame }, | 3663 | {ATGEN_IncomingGPRS, "+CGREG:" ,0x00,0x00,ID_IncomingFrame }, |
3482 | {ATGEN_ReplyGetNetworkLAC_CID, "+CREG:" ,0x00,0x00,ID_IncomingFrame }, | 3664 | {ATGEN_ReplyGetNetworkLAC_CID, "+CREG:" ,0x00,0x00,ID_IncomingFrame }, |
3483 | 3665 | ||
3484 | {ATGEN_ReplyGetPBKMemories, "AT+CPBS=?" ,0x00,0x00,ID_SetMemoryType }, | 3666 | {ATGEN_ReplyGetPBKMemories, "AT+CPBS=?" ,0x00,0x00,ID_SetMemoryType }, |
3485 | {ATGEN_GenericReply, "AT+CPBS=" ,0x00,0x00,ID_SetMemoryType }, | 3667 | {ATGEN_GenericReply, "AT+CPBS=" ,0x00,0x00,ID_SetMemoryType }, |
3486 | {ATGEN_ReplyGetCPBSMemoryStatus,"AT+CPBS?" ,0x00,0x00,ID_GetMemoryStatus }, | 3668 | {ATGEN_ReplyGetCPBSMemoryStatus,"AT+CPBS?" ,0x00,0x00,ID_GetMemoryStatus }, |
3669 | // /* Samsung phones reply +CPBR: after OK --claudio*/ | ||
3487 | {ATGEN_ReplyGetCPBRMemoryInfo, "AT+CPBR=?" ,0x00,0x00,ID_GetMemoryStatus }, | 3670 | {ATGEN_ReplyGetCPBRMemoryInfo, "AT+CPBR=?" ,0x00,0x00,ID_GetMemoryStatus }, |
3671 | {ATGEN_ReplyGetCPBRMemoryInfo, "+CPBR:" ,0x00,0x00,ID_GetMemoryStatus }, | ||
3488 | {ATGEN_ReplyGetCPBRMemoryStatus,"AT+CPBR=" ,0x00,0x00,ID_GetMemoryStatus }, | 3672 | {ATGEN_ReplyGetCPBRMemoryStatus,"AT+CPBR=" ,0x00,0x00,ID_GetMemoryStatus }, |
3489 | {ATGEN_GenericReply, "AT+CSCS=" ,0x00,0x00,ID_SetMemoryCharset }, | 3673 | {ATGEN_GenericReply, "AT+CSCS=" ,0x00,0x00,ID_SetMemoryCharset }, |
3490 | {ATGEN_ReplyGetMemory, "AT+CPBR=" ,0x00,0x00,ID_GetMemory }, | 3674 | {ATGEN_ReplyGetMemory, "AT+CPBR=" ,0x00,0x00,ID_GetMemory }, |
3491 | {ATGEN_GenericReply, "AT^SBNR=?" ,0x00,0x00,ID_GetMemory }, | 3675 | {ATGEN_GenericReply, "AT^SBNR=?" ,0x00,0x00,ID_GetMemory }, |
3492 | {ATGEN_SL45ReplyGetMemory, "AT^SBNR" ,0x00,0x00,ID_GetMemory }, | 3676 | {SIEMENS_ReplyGetMemory, "AT^SBNR" ,0x00,0x00,ID_GetMemory }, |
3493 | {ATGEN_ReplySetMemory, "AT+CPBW" ,0x00,0x00,ID_SetMemory }, | 3677 | {ATGEN_ReplySetMemory, "AT+CPBW" ,0x00,0x00,ID_SetMemory }, |
3494 | 3678 | ||
3495 | {ATGEN_CMS35ReplyGetBitmap, "AT^SBNR=\"bmp\"" ,0x00,0x00,ID_GetBitmap }, | 3679 | {SIEMENS_ReplyGetBitmap, "AT^SBNR=\"bmp\"" ,0x00,0x00,ID_GetBitmap }, |
3496 | {ATGEN_CMS35ReplySetBitmap, "AT^SBNW=\"bmp\"" ,0x00,0x00,ID_SetBitmap }, | 3680 | {SIEMENS_ReplySetBitmap, "AT^SBNW=\"bmp\"" ,0x00,0x00,ID_SetBitmap }, |
3497 | 3681 | ||
3498 | {ATGEN_CMS35ReplyGetRingtone, "AT^SBNR=\"mid\"" ,0x00,0x00,ID_GetRingtone }, | 3682 | {SIEMENS_ReplyGetRingtone, "AT^SBNR=\"mid\"" ,0x00,0x00,ID_GetRingtone }, |
3499 | {ATGEN_CMS35ReplySetRingtone, "AT^SBNW=\"mid\"" ,0x00,0x00,ID_SetRingtone }, | 3683 | {SIEMENS_ReplySetRingtone, "AT^SBNW=\"mid\"" ,0x00,0x00,ID_SetRingtone }, |
3500 | 3684 | ||
3501 | {ATGEN_CMS35ReplyGetNextCal, "AT^SBNR=\"vcs\"" ,0x00,0x00,ID_GetCalendarNote }, | 3685 | {SIEMENS_ReplyGetNextCalendar, "AT^SBNR=\"vcs\"" ,0x00,0x00,ID_GetCalendarNote }, |
3502 | {ATGEN_CMS35ReplySetCalendar, "AT^SBNW=\"vcs\"" ,0x00,0x00,ID_SetCalendarNote }, | 3686 | {SIEMENS_ReplyAddCalendarNote, "AT^SBNW=\"vcs\"" ,0x00,0x00,ID_SetCalendarNote }, |
3503 | {ATGEN_CMS35ReplyDeleteCalendar,"AT^SBNW=\"vcs\"",0x00,0x00,ID_DeleteCalendarNote }, | 3687 | {SIEMENS_ReplyDelCalendarNote, "AT^SBNW=\"vcs\"",0x00,0x00,ID_DeleteCalendarNote }, |
3504 | 3688 | ||
3505 | {ATGEN_ReplyEnterSecurityCode, "AT+CPIN=" ,0x00,0x00,ID_EnterSecurityCode }, | 3689 | {ATGEN_ReplyEnterSecurityCode, "AT+CPIN=" ,0x00,0x00,ID_EnterSecurityCode }, |
3506 | {ATGEN_ReplyEnterSecurityCode, "AT+CPIN2=" ,0x00,0x00,ID_EnterSecurityCode }, | 3690 | {ATGEN_ReplyEnterSecurityCode, "AT+CPIN2=" ,0x00,0x00,ID_EnterSecurityCode }, |
3507 | {ATGEN_ReplyGetSecurityStatus, "AT+CPIN?" ,0x00,0x00,ID_GetSecurityStatus }, | 3691 | {ATGEN_ReplyGetSecurityStatus, "AT+CPIN?" ,0x00,0x00,ID_GetSecurityStatus }, |
3508 | {ATGEN_ReplyOK, "OK" ,0x00,0x00,ID_IncomingFrame }, | 3692 | {ATGEN_ReplyOK, "OK" ,0x00,0x00,ID_IncomingFrame }, |
3509 | 3693 | ||
3510 | {ATGEN_GenericReply, "AT+VTS" ,0x00,0x00,ID_SendDTMF }, | 3694 | {ATGEN_GenericReply, "AT+VTS" ,0x00,0x00,ID_SendDTMF }, |
3511 | {ATGEN_ReplyCancelCall, "AT+CHUP" ,0x00,0x00,ID_CancelCall }, | 3695 | {ATGEN_ReplyCancelCall, "AT+CHUP" ,0x00,0x00,ID_CancelCall }, |
3512 | {ATGEN_ReplyDialVoice, "ATDT" ,0x00,0x00,ID_DialVoice }, | 3696 | {ATGEN_ReplyDialVoice, "ATDT" ,0x00,0x00,ID_DialVoice }, |
3513 | {ATGEN_ReplyCancelCall, "ATH" ,0x00,0x00,ID_CancelCall }, | 3697 | {ATGEN_ReplyCancelCall, "ATH" ,0x00,0x00,ID_CancelCall }, |
3698 | {ATGEN_GenericReply, "AT+CUSD" ,0x00,0x00,ID_SetUSSD }, | ||
3699 | {ATGEN_ReplyGetUSSD, "+CUSD" ,0x00,0x00,ID_IncomingFrame }, | ||
3514 | {ATGEN_GenericReply, "AT+CLIP=1" ,0x00,0x00,ID_IncomingFrame }, | 3700 | {ATGEN_GenericReply, "AT+CLIP=1" ,0x00,0x00,ID_IncomingFrame }, |
3515 | {ATGEN_ReplyIncomingCallInfo, "+CLIP" ,0x00,0x00,ID_IncomingFrame }, | 3701 | {ATGEN_ReplyIncomingCallInfo, "+CLIP" ,0x00,0x00,ID_IncomingFrame }, |
3516 | {ATGEN_ReplyIncomingCallInfo, "+COLP" ,0x00,0x00,ID_IncomingFrame }, | 3702 | {ATGEN_ReplyIncomingCallInfo, "+COLP" ,0x00,0x00,ID_IncomingFrame }, |
3517 | {ATGEN_ReplyIncomingCallInfo, "RING" ,0x00,0x00,ID_IncomingFrame }, | 3703 | {ATGEN_ReplyIncomingCallInfo, "RING" ,0x00,0x00,ID_IncomingFrame }, |
3518 | {ATGEN_ReplyIncomingCallInfo, "NO CARRIER" ,0x00,0x00,ID_IncomingFrame }, | 3704 | {ATGEN_ReplyIncomingCallInfo, "NO CARRIER" ,0x00,0x00,ID_IncomingFrame }, |
3519 | 3705 | ||
3520 | {ATGEN_ReplyReset, "AT^SRESET" ,0x00,0x00,ID_Reset }, | 3706 | {ATGEN_ReplyReset, "AT^SRESET" ,0x00,0x00,ID_Reset }, |
3521 | {ATGEN_ReplyReset, "AT+CFUN=1,1" ,0x00,0x00,ID_Reset }, | 3707 | {ATGEN_ReplyReset, "AT+CFUN=1,1" ,0x00,0x00,ID_Reset }, |
3522 | {ATGEN_ReplyResetPhoneSettings, "AT&F" ,0x00,0x00,ID_ResetPhoneSettings }, | 3708 | {ATGEN_ReplyResetPhoneSettings, "AT&F" ,0x00,0x00,ID_ResetPhoneSettings }, |
3523 | 3709 | ||
3710 | {SAMSUNG_ReplyGetBitmap, "AT+IMGR=" ,0x00,0x00,ID_GetBitmap }, | ||
3711 | {SAMSUNG_ReplySetBitmap, "SDNDCRC =" ,0x00,0x00,ID_SetBitmap }, | ||
3712 | |||
3713 | {SAMSUNG_ReplyGetRingtone, "AT+MELR=" ,0x00,0x00,ID_GetRingtone }, | ||
3714 | {SAMSUNG_ReplySetRingtone, "SDNDCRC =" ,0x00,0x00,ID_SetRingtone }, | ||
3715 | |||
3524 | #ifdef GSM_ENABLE_ALCATEL | 3716 | #ifdef GSM_ENABLE_ALCATEL |
3525 | /* Why do I give Alcatel specific things here? It's simple, Alcatel needs | 3717 | /* Why do I give Alcatel specific things here? It's simple, Alcatel needs |
3526 | * some AT commands to start it's binary mode, so this needs to be in AT | 3718 | * some AT commands to start it's binary mode, so this needs to be in AT |
3527 | * related stuff. | 3719 | * related stuff. |
3528 | * | 3720 | * |
3529 | * XXX: AT+IFC could later move outside this ifdef, because it is not Alcatel | 3721 | * XXX: AT+IFC could later move outside this ifdef, because it is not Alcatel |
3530 | * specific and it's part of ETSI specifications | 3722 | * specific and it's part of ETSI specifications |
3531 | */ | 3723 | */ |
3532 | {ATGEN_GenericReply, "AT+IFC" ,0x00,0x00,ID_SetFlowControl }, | 3724 | {ATGEN_GenericReply, "AT+IFC" ,0x00,0x00,ID_SetFlowControl }, |
3533 | {ALCATEL_ProtocolVersionReply, "AT+CPROT=?" ,0x00,0x00,ID_AlcatelProtocol }, | 3725 | {ALCATEL_ProtocolVersionReply, "AT+CPROT=?" ,0x00,0x00,ID_AlcatelProtocol }, |
3534 | {ATGEN_GenericReply, "AT+CPROT" ,0x00,0x00,ID_AlcatelConnect }, | 3726 | {ATGEN_GenericReply, "AT+CPROT" ,0x00,0x00,ID_AlcatelConnect }, |
3535 | #endif | 3727 | #endif |
3536 | 3728 | ||
3537 | {NULL, "\x00" ,0x00,0x00,ID_None } | 3729 | {NULL, "\x00" ,0x00,0x00,ID_None } |
3538 | }; | 3730 | }; |
3539 | 3731 | ||
3540 | GSM_Phone_Functions ATGENPhone = { | 3732 | GSM_Phone_Functions ATGENPhone = { |
3541 | "A2D|iPAQ|at|M20|S25|MC35|C35i|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", | 3733 | "A2D|iPAQ|at|M20|S25|MC35|TC35|C35i|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", |
3542 | ATGENReplyFunctions, | 3734 | ATGENReplyFunctions, |
3543 | ATGEN_Initialise, | 3735 | ATGEN_Initialise, |
3544 | ATGEN_Terminate, | 3736 | ATGEN_Terminate, |
3545 | ATGEN_DispatchMessage, | 3737 | ATGEN_DispatchMessage, |
3546 | NOTSUPPORTED, /* ShowStartInfo */ | 3738 | NOTSUPPORTED, /* ShowStartInfo */ |
3547 | ATGEN_GetManufacturer, | 3739 | ATGEN_GetManufacturer, |
3548 | ATGEN_GetModel, | 3740 | ATGEN_GetModel, |
3549 | ATGEN_GetFirmware, | 3741 | ATGEN_GetFirmware, |
3550 | ATGEN_GetIMEI, | 3742 | ATGEN_GetIMEI, |
3551 | NOTSUPPORTED, /* GetOriginalIMEI */ | 3743 | NOTSUPPORTED, /* GetOriginalIMEI */ |
3552 | NOTSUPPORTED, /* GetManufactureMonth*/ | 3744 | NOTSUPPORTED, /* GetManufactureMonth*/ |
3553 | NOTSUPPORTED, /* GetProductCode */ | 3745 | NOTSUPPORTED, /* GetProductCode */ |
3554 | NOTSUPPORTED, /* GetHardware */ | 3746 | NOTSUPPORTED, /* GetHardware */ |
3555 | NOTSUPPORTED, /* GetPPM */ | 3747 | NOTSUPPORTED, /* GetPPM */ |
3556 | ATGEN_GetSIMIMSI, | 3748 | ATGEN_GetSIMIMSI, |
3557 | ATGEN_GetDateTime, | 3749 | ATGEN_GetDateTime, |
3558 | ATGEN_SetDateTime, | 3750 | ATGEN_SetDateTime, |
3559 | ATGEN_GetAlarm, | 3751 | ATGEN_GetAlarm, |
3560 | NOTIMPLEMENTED, /* SetAlarm */ | 3752 | ATGEN_SetAlarm, |
3561 | NOTSUPPORTED, /* GetLocale */ | 3753 | ATGEN_GetLocale, |
3562 | NOTSUPPORTED, /* SetLocale */ | 3754 | ATGEN_SetLocale, |
3563 | ATGEN_PressKey, | 3755 | ATGEN_PressKey, |
3564 | ATGEN_Reset, | 3756 | ATGEN_Reset, |
3565 | ATGEN_ResetPhoneSettings, | 3757 | ATGEN_ResetPhoneSettings, |
3566 | ATGEN_EnterSecurityCode, | 3758 | ATGEN_EnterSecurityCode, |
3567 | ATGEN_GetSecurityStatus, | 3759 | ATGEN_GetSecurityStatus, |
3568 | ATGEN_GetDisplayStatus, | 3760 | ATGEN_GetDisplayStatus, |
3569 | ATGEN_SetAutoNetworkLogin, | 3761 | ATGEN_SetAutoNetworkLogin, |
3570 | ATGEN_GetBatteryCharge, | 3762 | ATGEN_GetBatteryCharge, |
3571 | ATGEN_GetSignalQuality, | 3763 | ATGEN_GetSignalQuality, |
3572 | ATGEN_GetNetworkInfo, | 3764 | ATGEN_GetNetworkInfo, |
3573 | NOTSUPPORTED, /* GetCategory */ | 3765 | NOTSUPPORTED, /* GetCategory */ |
3574 | NOTSUPPORTED, /* AddCategory */ | 3766 | NOTSUPPORTED, /* AddCategory */ |
@@ -3583,43 +3775,44 @@ GSM_Phone_Functions ATGENPhone = { | |||
3583 | NOTSUPPORTED, /* GetSpeedDial */ | 3775 | NOTSUPPORTED, /* GetSpeedDial */ |
3584 | NOTSUPPORTED, /* SetSpeedDial */ | 3776 | NOTSUPPORTED, /* SetSpeedDial */ |
3585 | ATGEN_GetSMSC, | 3777 | ATGEN_GetSMSC, |
3586 | ATGEN_SetSMSC, | 3778 | ATGEN_SetSMSC, |
3587 | ATGEN_GetSMSStatus, | 3779 | ATGEN_GetSMSStatus, |
3588 | ATGEN_GetSMS, | 3780 | ATGEN_GetSMS, |
3589 | ATGEN_GetNextSMS, | 3781 | ATGEN_GetNextSMS, |
3590 | NOTSUPPORTED, /* SetSMS */ | 3782 | NOTSUPPORTED, /* SetSMS */ |
3591 | ATGEN_AddSMS, | 3783 | ATGEN_AddSMS, |
3592 | ATGEN_DeleteSMS, | 3784 | ATGEN_DeleteSMS, |
3593 | ATGEN_SendSMS, | 3785 | ATGEN_SendSMS, |
3594 | ATGEN_SendSavedSMS, | 3786 | ATGEN_SendSavedSMS, |
3787 | ATGEN_SetFastSMSSending, | ||
3595 | ATGEN_SetIncomingSMS, | 3788 | ATGEN_SetIncomingSMS, |
3596 | ATGEN_SetIncomingCB, | 3789 | ATGEN_SetIncomingCB, |
3597 | ATGEN_GetSMSFolders, | 3790 | ATGEN_GetSMSFolders, |
3598 | NOTSUPPORTED, /* AddSMSFolder */ | 3791 | NOTSUPPORTED, /* AddSMSFolder */ |
3599 | NOTSUPPORTED, /* DeleteSMSFolder */ | 3792 | NOTSUPPORTED, /* DeleteSMSFolder */ |
3600 | ATGEN_DialVoice, | 3793 | ATGEN_DialVoice, |
3601 | ATGEN_AnswerCall, | 3794 | ATGEN_AnswerCall, |
3602 | ATGEN_CancelCall, | 3795 | ATGEN_CancelCall, |
3603 | NOTSUPPORTED, /* HoldCall */ | 3796 | NOTSUPPORTED, /* HoldCall */ |
3604 | NOTSUPPORTED, /* UnholdCall */ | 3797 | NOTSUPPORTED, /* UnholdCall */ |
3605 | NOTSUPPORTED, /* ConferenceCall */ | 3798 | NOTSUPPORTED, /* ConferenceCall */ |
3606 | NOTSUPPORTED, /* SplitCall */ | 3799 | NOTSUPPORTED, /* SplitCall */ |
3607 | NOTSUPPORTED, /* TransferCall */ | 3800 | NOTSUPPORTED, /* TransferCall */ |
3608 | NOTSUPPORTED, /* SwitchCall */ | 3801 | NOTSUPPORTED, /* SwitchCall */ |
3609 | NOTSUPPORTED, /* GetCallDivert */ | 3802 | NOTSUPPORTED, /* GetCallDivert */ |
3610 | NOTSUPPORTED, /* SetCallDivert */ | 3803 | NOTSUPPORTED, /* SetCallDivert */ |
3611 | NOTSUPPORTED, /* CancelAllDiverts*/ | 3804 | NOTSUPPORTED, /* CancelAllDiverts*/ |
3612 | NONEFUNCTION, /* SetIncomingCall */ | 3805 | NONEFUNCTION, /* SetIncomingCall */ |
3613 | NOTSUPPORTED, /* SetIncomingUSSD */ | 3806 | ATGEN_SetIncomingUSSD, |
3614 | ATGEN_SendDTMF, | 3807 | ATGEN_SendDTMF, |
3615 | ATGEN_GetRingtone, | 3808 | ATGEN_GetRingtone, |
3616 | ATGEN_SetRingtone, | 3809 | ATGEN_SetRingtone, |
3617 | NOTSUPPORTED, /* GetRingtonesInfo*/ | 3810 | NOTSUPPORTED, /* GetRingtonesInfo*/ |
3618 | NOTSUPPORTED, /* DeleteUserRingtones*/ | 3811 | NOTSUPPORTED, /* DeleteUserRingtones*/ |
3619 | NOTSUPPORTED, /* PlayTone */ | 3812 | NOTSUPPORTED, /* PlayTone */ |
3620 | NOTSUPPORTED, /* GetWAPBookmark */ | 3813 | NOTSUPPORTED, /* GetWAPBookmark */ |
3621 | NOTSUPPORTED, /* SetWAPBookmark */ | 3814 | NOTSUPPORTED, /* SetWAPBookmark */ |
3622 | NOTSUPPORTED, /* DeleteWAPBookmark */ | 3815 | NOTSUPPORTED, /* DeleteWAPBookmark */ |
3623 | NOTSUPPORTED, /* GetWAPSettings */ | 3816 | NOTSUPPORTED, /* GetWAPSettings */ |
3624 | NOTSUPPORTED, /* SetWAPSettings */ | 3817 | NOTSUPPORTED, /* SetWAPSettings */ |
3625 | NOTSUPPORTED, /* GetMMSSettings */ | 3818 | NOTSUPPORTED, /* GetMMSSettings */ |
@@ -3637,25 +3830,25 @@ GSM_Phone_Functions ATGENPhone = { | |||
3637 | SONYERIC_AddToDo, | 3830 | SONYERIC_AddToDo, |
3638 | NOTSUPPORTED, /* DeleteToDo */ | 3831 | NOTSUPPORTED, /* DeleteToDo */ |
3639 | SONYERIC_DeleteAllToDo, | 3832 | SONYERIC_DeleteAllToDo, |
3640 | SONYERIC_GetCalendarStatus, | 3833 | SONYERIC_GetCalendarStatus, |
3641 | NOTIMPLEMENTED, /* GetCalendar */ | 3834 | NOTIMPLEMENTED, /* GetCalendar */ |
3642 | ATGEN_GetNextCalendar, | 3835 | ATGEN_GetNextCalendar, |
3643 | NOTIMPLEMENTED, /* SetCalendar */ | 3836 | NOTIMPLEMENTED, /* SetCalendar */ |
3644 | ATGEN_AddCalendarNote, | 3837 | ATGEN_AddCalendarNote, |
3645 | ATGEN_DelCalendarNote, | 3838 | ATGEN_DelCalendarNote, |
3646 | NOTIMPLEMENTED, /* DeleteAllCalendar*/ | 3839 | NOTIMPLEMENTED, /* DeleteAllCalendar*/ |
3647 | NOTSUPPORTED, /* GetCalendarSettings*/ | 3840 | NOTSUPPORTED, /* GetCalendarSettings*/ |
3648 | NOTSUPPORTED, /* SetCalendarSettings*/ | 3841 | NOTSUPPORTED, /* SetCalendarSettings*/ |
3649 | NOTSUPPORTED, /* GetNote */ | 3842 | NOTSUPPORTED, /* GetNextNote */ |
3650 | NOTSUPPORTED, /* GetProfile */ | 3843 | NOTSUPPORTED, /* GetProfile */ |
3651 | NOTSUPPORTED, /* SetProfile */ | 3844 | NOTSUPPORTED, /* SetProfile */ |
3652 | NOTSUPPORTED, /* GetFMStation */ | 3845 | NOTSUPPORTED, /* GetFMStation */ |
3653 | NOTSUPPORTED, /* SetFMStation */ | 3846 | NOTSUPPORTED, /* SetFMStation */ |
3654 | NOTSUPPORTED, /* ClearFMStations */ | 3847 | NOTSUPPORTED, /* ClearFMStations */ |
3655 | NOTSUPPORTED, /* GetNextFileFolder*/ | 3848 | NOTSUPPORTED, /* GetNextFileFolder*/ |
3656 | NOTSUPPORTED, /* GetFilePart */ | 3849 | NOTSUPPORTED, /* GetFilePart */ |
3657 | NOTSUPPORTED, /* AddFile */ | 3850 | NOTSUPPORTED, /* AddFile */ |
3658 | NOTSUPPORTED, /* GetFileSystemStatus*/ | 3851 | NOTSUPPORTED, /* GetFileSystemStatus*/ |
3659 | NOTSUPPORTED, /* DeleteFile */ | 3852 | NOTSUPPORTED, /* DeleteFile */ |
3660 | NOTSUPPORTED, /* AddFolder */ | 3853 | NOTSUPPORTED, /* AddFolder */ |
3661 | NOTSUPPORTED, /* GetGPRSAccessPoint*/ | 3854 | NOTSUPPORTED, /* GetGPRSAccessPoint*/ |
diff --git a/gammu/emb/common/phone/at/atgen.h b/gammu/emb/common/phone/at/atgen.h index 0e08ee4..bb5c559 100644 --- a/gammu/emb/common/phone/at/atgen.h +++ b/gammu/emb/common/phone/at/atgen.h | |||
@@ -33,31 +33,33 @@ typedef enum { | |||
33 | AT_Reply_CMEError, | 33 | AT_Reply_CMEError, |
34 | AT_Reply_SMSEdit | 34 | AT_Reply_SMSEdit |
35 | } GSM_AT_Reply_State; | 35 | } GSM_AT_Reply_State; |
36 | 36 | ||
37 | typedef enum { | 37 | typedef enum { |
38 | AT_Nokia = 1, | 38 | AT_Nokia = 1, |
39 | AT_Alcatel, | 39 | AT_Alcatel, |
40 | AT_Siemens, | 40 | AT_Siemens, |
41 | AT_HP, | 41 | AT_HP, |
42 | AT_Falcom, | 42 | AT_Falcom, |
43 | AT_Ericsson, | 43 | AT_Ericsson, |
44 | AT_Sagem, | 44 | AT_Sagem, |
45 | AT_Samsung, | ||
45 | AT_Unknown | 46 | AT_Unknown |
46 | } GSM_AT_Manufacturer; | 47 | } GSM_AT_Manufacturer; |
47 | 48 | ||
48 | typedef enum { | 49 | typedef enum { |
49 | AT_PBK_HEX = 1, | 50 | AT_PBK_HEX = 1, |
50 | AT_PBK_GSM, | 51 | AT_PBK_GSM, |
51 | AT_PBK_UCS2 | 52 | AT_PBK_UCS2, |
53 | AT_PBK_PCCP437 | ||
52 | } GSM_AT_PBK_Charset; | 54 | } GSM_AT_PBK_Charset; |
53 | 55 | ||
54 | typedef enum { | 56 | typedef enum { |
55 | AT_AVAILABLE = 1, | 57 | AT_AVAILABLE = 1, |
56 | AT_NOTAVAILABLE | 58 | AT_NOTAVAILABLE |
57 | } GSM_AT_SMSMemory; | 59 | } GSM_AT_SMSMemory; |
58 | 60 | ||
59 | typedef enum { | 61 | typedef enum { |
60 | AT_SBNR_AVAILABLE = 1, | 62 | AT_SBNR_AVAILABLE = 1, |
61 | AT_SBNR_NOTAVAILABLE | 63 | AT_SBNR_NOTAVAILABLE |
62 | } GSM_AT_SBNR; | 64 | } GSM_AT_SBNR; |
63 | 65 | ||
@@ -94,17 +96,21 @@ typedef struct { | |||
94 | int LastSMSRead; | 96 | int LastSMSRead; |
95 | int FirstCalendarPos; | 97 | int FirstCalendarPos; |
96 | bool CanSaveSMS; | 98 | bool CanSaveSMS; |
97 | GSM_AT_SMSMemory PhoneSMSMemory; /* Is phone SMS memory available ? */ | 99 | GSM_AT_SMSMemory PhoneSMSMemory; /* Is phone SMS memory available ? */ |
98 | GSM_AT_SMSMemory SIMSMSMemory; /* Is SIM SMS memory available ? */ | 100 | GSM_AT_SMSMemory SIMSMSMemory; /* Is SIM SMS memory available ? */ |
99 | GSM_MemoryType SMSMemory; /* Last read SMS memory */ | 101 | GSM_MemoryType SMSMemory; /* Last read SMS memory */ |
100 | GSM_AT_SMS_Modes SMSMode; /* PDU or TEXT mode for SMS ? */ | 102 | GSM_AT_SMS_Modes SMSMode; /* PDU or TEXT mode for SMS ? */ |
101 | 103 | ||
102 | bool OBEX; | 104 | bool OBEX; |
103 | GSM_File file; | 105 | GSM_File file; |
104 | } GSM_Phone_ATGENData; | 106 | } GSM_Phone_ATGENData; |
105 | 107 | ||
108 | GSM_Error ATGEN_HandleCMSError(GSM_StateMachine *); | ||
109 | GSM_Error ATGEN_HandleCMEError(GSM_StateMachine *); | ||
110 | GSM_Error ATGEN_DispatchMessage(GSM_StateMachine *); | ||
111 | |||
106 | #endif | 112 | #endif |
107 | 113 | ||
108 | /* How should editor hadle tabs in this file? Add editor commands here. | 114 | /* How should editor hadle tabs in this file? Add editor commands here. |
109 | * vim: noexpandtab sw=8 ts=8 sts=8: | 115 | * vim: noexpandtab sw=8 ts=8 sts=8: |
110 | */ | 116 | */ |
diff --git a/gammu/emb/common/phone/at/samsung.c b/gammu/emb/common/phone/at/samsung.c new file mode 100644 index 0000000..55a42e5 --- a/dev/null +++ b/gammu/emb/common/phone/at/samsung.c | |||
@@ -0,0 +1,447 @@ | |||
1 | /* Samsung-specific functions | ||
2 | * Copyright (C) 2004 Claudio Matsuoka <cmatsuoka@gmail.com> | ||
3 | * Tested with S300 only! | ||
4 | */ | ||
5 | |||
6 | #include "../../gsmstate.h" | ||
7 | |||
8 | #ifdef GSM_ENABLE_ATGEN | ||
9 | |||
10 | #include <string.h> | ||
11 | #include <time.h> | ||
12 | #include <ctype.h> | ||
13 | |||
14 | #include "../../misc/coding/coding.h" | ||
15 | #include "../../gsmcomon.h" | ||
16 | #include "../../service/sms/gsmsms.h" | ||
17 | #include "../pfunc.h" | ||
18 | |||
19 | #include "atgen.h" | ||
20 | #include "samsung.h" | ||
21 | |||
22 | /* Binary frame size */ | ||
23 | #define BLKSZ 1024 | ||
24 | |||
25 | struct ModelRes { | ||
26 | char *model; | ||
27 | int width; | ||
28 | int height; | ||
29 | }; | ||
30 | |||
31 | static struct ModelRes modres[] = { | ||
32 | { "S100", 128, 128 }, | ||
33 | { "S200", 128, 113 }, | ||
34 | { "S300", 128, 97 }, | ||
35 | { "S500", 128, 128 }, | ||
36 | { "T100", 128, 128 }, | ||
37 | { "E700", 128, 128 }, | ||
38 | { NULL, 0, 0 } | ||
39 | }; | ||
40 | |||
41 | /* | ||
42 | * CRC functions from the Granch SBNI12 Linux driver by | ||
43 | * Denis I. Timofeev <timofeev@granch.ru> | ||
44 | */ | ||
45 | static unsigned int crc32tab[] = { | ||
46 | 0xD202EF8D, 0xA505DF1B, 0x3C0C8EA1, 0x4B0BBE37, | ||
47 | 0xD56F2B94, 0xA2681B02, 0x3B614AB8, 0x4C667A2E, | ||
48 | 0xDCD967BF, 0xABDE5729, 0x32D70693, 0x45D03605, | ||
49 | 0xDBB4A3A6, 0xACB39330, 0x35BAC28A, 0x42BDF21C, | ||
50 | 0xCFB5FFE9, 0xB8B2CF7F, 0x21BB9EC5, 0x56BCAE53, | ||
51 | 0xC8D83BF0, 0xBFDF0B66, 0x26D65ADC, 0x51D16A4A, | ||
52 | 0xC16E77DB, 0xB669474D, 0x2F6016F7, 0x58672661, | ||
53 | 0xC603B3C2, 0xB1048354, 0x280DD2EE, 0x5F0AE278, | ||
54 | 0xE96CCF45, 0x9E6BFFD3, 0x0762AE69, 0x70659EFF, | ||
55 | 0xEE010B5C, 0x99063BCA, 0x000F6A70, 0x77085AE6, | ||
56 | 0xE7B74777, 0x90B077E1, 0x09B9265B, 0x7EBE16CD, | ||
57 | 0xE0DA836E, 0x97DDB3F8, 0x0ED4E242, 0x79D3D2D4, | ||
58 | 0xF4DBDF21, 0x83DCEFB7, 0x1AD5BE0D, 0x6DD28E9B, | ||
59 | 0xF3B61B38, 0x84B12BAE, 0x1DB87A14, 0x6ABF4A82, | ||
60 | 0xFA005713, 0x8D076785, 0x140E363F, 0x630906A9, | ||
61 | 0xFD6D930A, 0x8A6AA39C, 0x1363F226, 0x6464C2B0, | ||
62 | 0xA4DEAE1D, 0xD3D99E8B, 0x4AD0CF31, 0x3DD7FFA7, | ||
63 | 0xA3B36A04, 0xD4B45A92, 0x4DBD0B28, 0x3ABA3BBE, | ||
64 | 0xAA05262F, 0xDD0216B9, 0x440B4703, 0x330C7795, | ||
65 | 0xAD68E236, 0xDA6FD2A0, 0x4366831A, 0x3461B38C, | ||
66 | 0xB969BE79, 0xCE6E8EEF, 0x5767DF55, 0x2060EFC3, | ||
67 | 0xBE047A60, 0xC9034AF6, 0x500A1B4C, 0x270D2BDA, | ||
68 | 0xB7B2364B, 0xC0B506DD, 0x59BC5767, 0x2EBB67F1, | ||
69 | 0xB0DFF252, 0xC7D8C2C4, 0x5ED1937E, 0x29D6A3E8, | ||
70 | 0x9FB08ED5, 0xE8B7BE43, 0x71BEEFF9, 0x06B9DF6F, | ||
71 | 0x98DD4ACC, 0xEFDA7A5A, 0x76D32BE0, 0x01D41B76, | ||
72 | 0x916B06E7, 0xE66C3671, 0x7F6567CB, 0x0862575D, | ||
73 | 0x9606C2FE, 0xE101F268, 0x7808A3D2, 0x0F0F9344, | ||
74 | 0x82079EB1, 0xF500AE27, 0x6C09FF9D, 0x1B0ECF0B, | ||
75 | 0x856A5AA8, 0xF26D6A3E, 0x6B643B84, 0x1C630B12, | ||
76 | 0x8CDC1683, 0xFBDB2615, 0x62D277AF, 0x15D54739, | ||
77 | 0x8BB1D29A, 0xFCB6E20C, 0x65BFB3B6, 0x12B88320, | ||
78 | 0x3FBA6CAD, 0x48BD5C3B, 0xD1B40D81, 0xA6B33D17, | ||
79 | 0x38D7A8B4, 0x4FD09822, 0xD6D9C998, 0xA1DEF90E, | ||
80 | 0x3161E49F, 0x4666D409, 0xDF6F85B3, 0xA868B525, | ||
81 | 0x360C2086, 0x410B1010, 0xD80241AA, 0xAF05713C, | ||
82 | 0x220D7CC9, 0x550A4C5F, 0xCC031DE5, 0xBB042D73, | ||
83 | 0x2560B8D0, 0x52678846, 0xCB6ED9FC, 0xBC69E96A, | ||
84 | 0x2CD6F4FB, 0x5BD1C46D, 0xC2D895D7, 0xB5DFA541, | ||
85 | 0x2BBB30E2, 0x5CBC0074, 0xC5B551CE, 0xB2B26158, | ||
86 | 0x04D44C65, 0x73D37CF3, 0xEADA2D49, 0x9DDD1DDF, | ||
87 | 0x03B9887C, 0x74BEB8EA, 0xEDB7E950, 0x9AB0D9C6, | ||
88 | 0x0A0FC457, 0x7D08F4C1, 0xE401A57B, 0x930695ED, | ||
89 | 0x0D62004E, 0x7A6530D8, 0xE36C6162, 0x946B51F4, | ||
90 | 0x19635C01, 0x6E646C97, 0xF76D3D2D, 0x806A0DBB, | ||
91 | 0x1E0E9818, 0x6909A88E, 0xF000F934, 0x8707C9A2, | ||
92 | 0x17B8D433, 0x60BFE4A5, 0xF9B6B51F, 0x8EB18589, | ||
93 | 0x10D5102A, 0x67D220BC, 0xFEDB7106, 0x89DC4190, | ||
94 | 0x49662D3D, 0x3E611DAB, 0xA7684C11, 0xD06F7C87, | ||
95 | 0x4E0BE924, 0x390CD9B2, 0xA0058808, 0xD702B89E, | ||
96 | 0x47BDA50F, 0x30BA9599, 0xA9B3C423, 0xDEB4F4B5, | ||
97 | 0x40D06116, 0x37D75180, 0xAEDE003A, 0xD9D930AC, | ||
98 | 0x54D13D59, 0x23D60DCF, 0xBADF5C75, 0xCDD86CE3, | ||
99 | 0x53BCF940, 0x24BBC9D6, 0xBDB2986C, 0xCAB5A8FA, | ||
100 | 0x5A0AB56B, 0x2D0D85FD, 0xB404D447, 0xC303E4D1, | ||
101 | 0x5D677172, 0x2A6041E4, 0xB369105E, 0xC46E20C8, | ||
102 | 0x72080DF5, 0x050F3D63, 0x9C066CD9, 0xEB015C4F, | ||
103 | 0x7565C9EC, 0x0262F97A, 0x9B6BA8C0, 0xEC6C9856, | ||
104 | 0x7CD385C7, 0x0BD4B551, 0x92DDE4EB, 0xE5DAD47D, | ||
105 | 0x7BBE41DE, 0x0CB97148, 0x95B020F2, 0xE2B71064, | ||
106 | 0x6FBF1D91, 0x18B82D07, 0x81B17CBD, 0xF6B64C2B, | ||
107 | 0x68D2D988, 0x1FD5E91E, 0x86DCB8A4, 0xF1DB8832, | ||
108 | 0x616495A3, 0x1663A535, 0x8F6AF48F, 0xF86DC419, | ||
109 | 0x660951BA, 0x110E612C, 0x88073096, 0xFF000000 | ||
110 | }; | ||
111 | |||
112 | static unsigned int GetCRC(char *data, int size) | ||
113 | { | ||
114 | unsigned int crc = 0; | ||
115 | |||
116 | while (size--) | ||
117 | crc = crc32tab[(crc ^ *data++) & 0xff] ^ ((crc >> 8) & 0x00FFFFFF); | ||
118 | |||
119 | return crc; | ||
120 | } | ||
121 | |||
122 | /* | ||
123 | * Frame transfer | ||
124 | */ | ||
125 | |||
126 | static GSM_Error WaitFor(GSM_StateMachine *s, char *t, int ttl) | ||
127 | { | ||
128 | char readbuf[100]; | ||
129 | int n; | ||
130 | unsigned int sec; | ||
131 | GSM_DateTime Date; | ||
132 | |||
133 | GSM_GetCurrentDateTime (&Date); | ||
134 | sec = Date.Second; | ||
135 | |||
136 | n = s->Device.Functions->ReadDevice(s, readbuf, 80); | ||
137 | readbuf[n] = 0; | ||
138 | while (strstr(readbuf, t) == NULL && (sec + ttl) >= Date.Second) { | ||
139 | my_sleep(5000); | ||
140 | n = s->Device.Functions->ReadDevice(s, readbuf, 80); | ||
141 | readbuf[n] = 0; | ||
142 | GSM_GetCurrentDateTime (&Date); | ||
143 | } | ||
144 | |||
145 | return (sec + ttl) >= Date.Second ? ERR_NONE : ERR_TIMEOUT; | ||
146 | } | ||
147 | |||
148 | static GSM_Error SetSamsungFrame(GSM_StateMachine *s, unsigned char *buff, int size, GSM_Phone_RequestID id) | ||
149 | { | ||
150 | GSM_Phone_Data *Phone = &s->Phone.Data; | ||
151 | GSM_Error error; | ||
152 | int i, count; | ||
153 | |||
154 | count = size / BLKSZ; | ||
155 | |||
156 | for (i = 0; i < count; i++) { | ||
157 | error = WaitFor(s, ">", 4); | ||
158 | if (error!=ERR_NONE) return error; | ||
159 | |||
160 | error = s->Protocol.Functions->WriteMessage(s, | ||
161 | buff + i * BLKSZ, BLKSZ, 0x00); | ||
162 | if (error!=ERR_NONE) return error; | ||
163 | } | ||
164 | |||
165 | error = WaitFor(s, ">", 4); | ||
166 | if (error!=ERR_NONE) return error; | ||
167 | error = s->Protocol.Functions->WriteMessage(s, | ||
168 | buff + i * BLKSZ, size%BLKSZ, 0x00); | ||
169 | if (error!=ERR_NONE) return error; | ||
170 | |||
171 | error = GSM_WaitFor(s, "", 0, 0x00, 4, id); | ||
172 | if (error!=ERR_NONE) return error; | ||
173 | |||
174 | return Phone->DispatchError; | ||
175 | } | ||
176 | |||
177 | /* Answer format for binary data transfer | ||
178 | * | ||
179 | * SDNDCRC = 0xa : RECEIVECRC = 0xcbf53a1c : BINSIZE = 5 | ||
180 | * CRCERR | ||
181 | */ | ||
182 | static GSM_Error ReplySetSamsungFrame(GSM_Protocol_Message msg, GSM_StateMachine *s) | ||
183 | { | ||
184 | unsigned long txcrc, rxcrc; | ||
185 | int binsize; | ||
186 | char *pos; | ||
187 | |||
188 | /* Parse SDNDCRC */ | ||
189 | pos = strchr(msg.Buffer, '='); | ||
190 | if (!pos) return ERR_UNKNOWN; | ||
191 | pos++; | ||
192 | txcrc = strtoul(pos, NULL, 0); | ||
193 | smprintf(s, "Sent CRC : 0x%lx\n", txcrc); | ||
194 | |||
195 | /* Parse RECEIVECRC */ | ||
196 | pos = strchr(pos, '='); | ||
197 | if (!pos) return ERR_UNKNOWN; | ||
198 | pos++; | ||
199 | rxcrc = strtoul(pos, NULL, 0); | ||
200 | smprintf(s, "Reveived CRC : 0x%lx\n", rxcrc); | ||
201 | |||
202 | /* Parse BINSIZE */ | ||
203 | pos = strchr(pos, '='); | ||
204 | if (!pos) return ERR_UNKNOWN; | ||
205 | pos++; | ||
206 | binsize = strtoul(pos, NULL, 0); | ||
207 | smprintf(s, "Binary size : %d\n", binsize); | ||
208 | |||
209 | return txcrc == rxcrc ? ERR_NONE : ERR_WRONGCRC; | ||
210 | } | ||
211 | |||
212 | /* | ||
213 | * Bitmaps | ||
214 | */ | ||
215 | |||
216 | GSM_Error SAMSUNG_ReplyGetBitmap(GSM_Protocol_Message msg, GSM_StateMachine *s) | ||
217 | { | ||
218 | GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN; | ||
219 | unsigned char buffer[32]; | ||
220 | char *pos; | ||
221 | int location, count; | ||
222 | |||
223 | switch (Priv->ReplyState) { | ||
224 | case AT_Reply_OK: | ||
225 | smprintf(s, "Bitmap info received\n"); | ||
226 | /* Parse +IMGR:location,name,0,0,0,0 */ | ||
227 | |||
228 | /* Parse location */ | ||
229 | pos = strchr(msg.Buffer, ':'); | ||
230 | if (!pos) return ERR_UNKNOWN; | ||
231 | pos++; | ||
232 | location = atoi(pos); | ||
233 | smprintf(s, "Location : %d\n", location); | ||
234 | |||
235 | /* Parse name */ | ||
236 | pos = strchr(pos, '"'); | ||
237 | if (!pos) return ERR_UNKNOWN; | ||
238 | pos++; | ||
239 | for (count = 0; count < 31; count++) { | ||
240 | if (pos[count] == '"') | ||
241 | break; | ||
242 | buffer[count] = pos[count]; | ||
243 | } | ||
244 | buffer[count] = 0; | ||
245 | smprintf(s, "Name : %s\n", buffer); | ||
246 | s->Phone.Data.Bitmap->Name = malloc((strlen(buffer) + 1) * 2); | ||
247 | if (s->Phone.Data.Bitmap->Name == NULL) | ||
248 | return ERR_MOREMEMORY; | ||
249 | EncodeUnicode(s->Phone.Data.Bitmap->Name, buffer, strlen(buffer)); | ||
250 | |||
251 | s->Phone.Data.Bitmap->Location = location; | ||
252 | |||
253 | return ERR_NONE; | ||
254 | case AT_Reply_Error: | ||
255 | return ERR_UNKNOWN; | ||
256 | case AT_Reply_CMSError: | ||
257 | return ATGEN_HandleCMSError(s); | ||
258 | case AT_Reply_CMEError: | ||
259 | return ATGEN_HandleCMEError(s); | ||
260 | default: | ||
261 | return ERR_UNKNOWNRESPONSE; | ||
262 | } | ||
263 | } | ||
264 | |||
265 | GSM_Error SAMSUNG_ReplySetBitmap(GSM_Protocol_Message msg, GSM_StateMachine *s) | ||
266 | { | ||
267 | smprintf(s, "Bitmap sent\n"); | ||
268 | return ReplySetSamsungFrame(msg, s); | ||
269 | } | ||
270 | |||
271 | GSM_Error SAMSUNG_GetBitmap(GSM_StateMachine *s, GSM_Bitmap *Bitmap) | ||
272 | { | ||
273 | unsigned char req[100]; | ||
274 | |||
275 | s->Phone.Data.Bitmap=Bitmap; | ||
276 | smprintf(s, "Getting bitmap\n"); | ||
277 | sprintf(req, "AT+IMGR=%d\r", Bitmap->Location-1); | ||
278 | return GSM_WaitFor (s, req, strlen(req), 0x00, 4, ID_GetBitmap); | ||
279 | } | ||
280 | |||
281 | GSM_Error SAMSUNG_SetBitmap(GSM_StateMachine *s, GSM_Bitmap *Bitmap) | ||
282 | { | ||
283 | unsigned charreq[100]; | ||
284 | unsigned longcrc; | ||
285 | GSM_Errorerror; | ||
286 | char name[50], *dot, *model; | ||
287 | GSM_Phone_Data *Data = &s->Phone.Data; | ||
288 | int i; | ||
289 | |||
290 | s->Phone.Data.Bitmap = Bitmap; | ||
291 | smprintf(s, "Setting bitmap\n"); | ||
292 | |||
293 | if (Bitmap->Type != GSM_PictureBinary) { | ||
294 | smprintf(s, "Invalid picture type\n"); | ||
295 | return ERR_INVALIDDATA; | ||
296 | } | ||
297 | |||
298 | if (Bitmap->BinaryPic.Type != PICTURE_GIF) { | ||
299 | smprintf(s, "Invalid binary picture type\n"); | ||
300 | return ERR_INVALIDDATA; | ||
301 | } | ||
302 | |||
303 | /* Check if picture size matches phone model */ | ||
304 | model = GetModelData(NULL,Data->Model,NULL)->model; | ||
305 | smprintf(s, "Checking picture size for %s\n", model); | ||
306 | for (i = 0; modres[i].model; i++) { | ||
307 | if (!strcmp(model, modres[i].model)) { | ||
308 | if (Bitmap->BitmapWidth != modres[i].width || | ||
309 | Bitmap->BitmapHeight != modres[i].height) { | ||
310 | smprintf(s, "Model %s must use %d x %d picture size\n", | ||
311 | modres[i].model, modres[i].width, | ||
312 | modres[i].height); | ||
313 | return ERR_INVALIDDATA; | ||
314 | } | ||
315 | break; | ||
316 | } | ||
317 | } | ||
318 | if (modres[i].model == NULL) { | ||
319 | smprintf(s, "Model \"%s\" is not supported.\n", Data->Model); | ||
320 | return ERR_NOTSUPPORTED; | ||
321 | } | ||
322 | |||
323 | crc = GetCRC(Bitmap->BinaryPic.Buffer, Bitmap->BinaryPic.Length); | ||
324 | |||
325 | /* Remove extension from file name */ | ||
326 | strncpy(name, DecodeUnicodeString(Bitmap->Name), 50); | ||
327 | if ((dot = strrchr(name, '.')) != NULL) | ||
328 | *dot = 0; | ||
329 | |||
330 | sprintf(req, "AT+IMGW=0,\"%s\",2,0,0,0,0,100,%d,%u\r", name, | ||
331 | Bitmap->BinaryPic.Length, (unsigned int)crc); | ||
332 | |||
333 | error = s->Protocol.Functions->WriteMessage(s, req, strlen(req), 0x00); | ||
334 | if (error!=ERR_NONE) return error; | ||
335 | |||
336 | return SetSamsungFrame(s, Bitmap->BinaryPic.Buffer, | ||
337 | Bitmap->BinaryPic.Length, ID_SetBitmap); | ||
338 | } | ||
339 | |||
340 | /* | ||
341 | * Ringtones | ||
342 | */ | ||
343 | |||
344 | GSM_Error SAMSUNG_ReplyGetRingtone(GSM_Protocol_Message msg, GSM_StateMachine *s) | ||
345 | { | ||
346 | GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN; | ||
347 | unsigned char buffer[32]; | ||
348 | char *pos; | ||
349 | int location, length, count; | ||
350 | |||
351 | switch (Priv->ReplyState) { | ||
352 | case AT_Reply_OK: | ||
353 | smprintf(s, "Ringtone info received\n"); | ||
354 | /* Parse +MELR:location,name,size */ | ||
355 | |||
356 | /* Parse location */ | ||
357 | pos = strchr(msg.Buffer, ':'); | ||
358 | if (!pos) return ERR_UNKNOWN; | ||
359 | pos++; | ||
360 | location = atoi(pos); | ||
361 | smprintf(s, "Location : %d\n", location); | ||
362 | |||
363 | /* Parse name */ | ||
364 | pos = strchr(pos, '"'); | ||
365 | if (!pos) return ERR_UNKNOWN; | ||
366 | pos++; | ||
367 | /* Ringtone.Name size is 20 chars */ | ||
368 | for (count = 0; count < 19; count++) { | ||
369 | if (pos[count] == '"') | ||
370 | break; | ||
371 | buffer[count] = pos[count]; | ||
372 | } | ||
373 | buffer[count] = 0; | ||
374 | smprintf(s, "Name : %s\n", buffer); | ||
375 | EncodeUnicode(s->Phone.Data.Ringtone->Name,buffer,strlen(buffer)); | ||
376 | |||
377 | /* Parse ringtone length */ | ||
378 | pos = strchr(pos, ','); | ||
379 | if (!pos) return ERR_UNKNOWN; | ||
380 | pos++; | ||
381 | length = atoi(pos); | ||
382 | smprintf(s, "Length : %d\n", length); | ||
383 | |||
384 | /* S300 ringtones are always MMF */ | ||
385 | s->Phone.Data.Ringtone->Format = RING_MMF; | ||
386 | s->Phone.Data.Ringtone->Location = location; | ||
387 | s->Phone.Data.Ringtone->BinaryTone.Length = length; | ||
388 | |||
389 | return ERR_NONE; | ||
390 | case AT_Reply_Error: | ||
391 | return ERR_UNKNOWN; | ||
392 | case AT_Reply_CMSError: | ||
393 | return ATGEN_HandleCMSError(s); | ||
394 | case AT_Reply_CMEError: | ||
395 | return ATGEN_HandleCMEError(s); | ||
396 | default: | ||
397 | return ERR_UNKNOWNRESPONSE; | ||
398 | } | ||
399 | } | ||
400 | |||
401 | GSM_Error SAMSUNG_GetRingtone(GSM_StateMachine *s, GSM_Ringtone *Ringtone, bool PhoneRingtone) | ||
402 | { | ||
403 | unsigned char req[100]; | ||
404 | |||
405 | s->Phone.Data.Ringtone = Ringtone; | ||
406 | smprintf(s, "Getting ringtone\n"); | ||
407 | sprintf(req, "AT+MELR=%d\r", Ringtone->Location-1); | ||
408 | return GSM_WaitFor (s, req, strlen(req), 0x00, 4, ID_GetRingtone); | ||
409 | } | ||
410 | |||
411 | GSM_Error SAMSUNG_ReplySetRingtone(GSM_Protocol_Message msg, GSM_StateMachine *s) | ||
412 | { | ||
413 | smprintf(s, "Ringtone sent\n"); | ||
414 | return ReplySetSamsungFrame(msg, s); | ||
415 | } | ||
416 | |||
417 | GSM_Error SAMSUNG_SetRingtone(GSM_StateMachine *s, GSM_Ringtone *Ringtone, int *maxlength) | ||
418 | { | ||
419 | unsigned charreq[100]; | ||
420 | unsigned longcrc; | ||
421 | GSM_Errorerror; | ||
422 | char name[50], *dot; | ||
423 | |||
424 | s->Phone.Data.Ringtone = Ringtone; | ||
425 | smprintf(s, "Setting ringtone\n"); | ||
426 | |||
427 | if (Ringtone->Format != RING_MMF) { | ||
428 | smprintf(s, "Not MMF ringtone\n"); | ||
429 | return ERR_INVALIDDATA; | ||
430 | } | ||
431 | |||
432 | /* Remove extension from file name */ | ||
433 | strncpy(name, DecodeUnicodeString(Ringtone->Name), 50); | ||
434 | if ((dot = strrchr(name, '.')) != NULL) *dot = 0; | ||
435 | |||
436 | crc = GetCRC(Ringtone->BinaryTone.Buffer, Ringtone->BinaryTone.Length); | ||
437 | sprintf(req, "AT+MELW=0,\"%s\",4,%d,%u\r", name, | ||
438 | Ringtone->BinaryTone.Length, (unsigned int)crc); | ||
439 | |||
440 | error = s->Protocol.Functions->WriteMessage(s, req, strlen(req), 0x00); | ||
441 | if (error!=ERR_NONE) return error; | ||
442 | |||
443 | return SetSamsungFrame(s, Ringtone->BinaryTone.Buffer, | ||
444 | Ringtone->BinaryTone.Length, ID_SetRingtone); | ||
445 | } | ||
446 | |||
447 | #endif | ||
diff --git a/gammu/emb/common/phone/at/samsung.h b/gammu/emb/common/phone/at/samsung.h new file mode 100644 index 0000000..3b2947c --- a/dev/null +++ b/gammu/emb/common/phone/at/samsung.h | |||
@@ -0,0 +1,16 @@ | |||
1 | #ifndef samsung_h | ||
2 | #define samsung_h | ||
3 | |||
4 | #include "../../gsmstate.h" | ||
5 | |||
6 | GSM_Error SAMSUNG_ReplyGetRingtone(GSM_Protocol_Message, GSM_StateMachine *); | ||
7 | GSM_Error SAMSUNG_ReplySetRingtone(GSM_Protocol_Message, GSM_StateMachine *); | ||
8 | GSM_Error SAMSUNG_ReplyGetBitmap(GSM_Protocol_Message, GSM_StateMachine *); | ||
9 | GSM_Error SAMSUNG_ReplySetBitmap(GSM_Protocol_Message, GSM_StateMachine *); | ||
10 | GSM_Error SAMSUNG_GetRingtone (GSM_StateMachine *, GSM_Ringtone *, bool); | ||
11 | GSM_Error SAMSUNG_SetRingtone (GSM_StateMachine *, GSM_Ringtone *, int *); | ||
12 | GSM_Error SAMSUNG_GetBitmap (GSM_StateMachine *, GSM_Bitmap *); | ||
13 | GSM_Error SAMSUNG_SetBitmap (GSM_StateMachine *, GSM_Bitmap *); | ||
14 | GSM_Error SAMSUNG_GetCallLogs (GSM_StateMachine *, GSM_MemoryEntry *, int); | ||
15 | |||
16 | #endif | ||
diff --git a/gammu/emb/common/phone/at/siemens.c b/gammu/emb/common/phone/at/siemens.c index ab7dd2c..7f66cf8 100644 --- a/gammu/emb/common/phone/at/siemens.c +++ b/gammu/emb/common/phone/at/siemens.c | |||
@@ -4,43 +4,29 @@ | |||
4 | 4 | ||
5 | #ifdef GSM_ENABLE_ATGEN | 5 | #ifdef GSM_ENABLE_ATGEN |
6 | 6 | ||
7 | #include <string.h> | 7 | #include <string.h> |
8 | #include <time.h> | 8 | #include <time.h> |
9 | #include <ctype.h> | 9 | #include <ctype.h> |
10 | 10 | ||
11 | #include "../../misc/coding/coding.h" | 11 | #include "../../misc/coding/coding.h" |
12 | #include "../../gsmcomon.h" | 12 | #include "../../gsmcomon.h" |
13 | #include "../../service/sms/gsmsms.h" | 13 | #include "../../service/sms/gsmsms.h" |
14 | #include "../pfunc.h" | 14 | #include "../pfunc.h" |
15 | 15 | ||
16 | extern GSM_Error ATGEN_HandleCMSError(GSM_StateMachine *s); | 16 | #include "atgen.h" |
17 | #include "siemens.h" | ||
17 | 18 | ||
18 | GSM_Error ATGEN_CMS35ReplySetFunction (GSM_Protocol_Message msg, GSM_StateMachine *s,char *function) | ||
19 | { | ||
20 | if (s->Protocol.Data.AT.EditMode) { | ||
21 | s->Protocol.Data.AT.EditMode = false; | ||
22 | return ERR_NONE; | ||
23 | } | ||
24 | dbgprintf ("Written %s",function); | ||
25 | if (s->Phone.Data.Priv.ATGEN.ReplyState == AT_Reply_OK){ | ||
26 | dbgprintf (" - OK\n"); | ||
27 | return ERR_NONE; | ||
28 | } else { | ||
29 | dbgprintf (" - error\n"); | ||
30 | return ERR_UNKNOWN; | ||
31 | } | ||
32 | } | ||
33 | 19 | ||
34 | GSM_Error GetSiemensFrame(GSM_Protocol_Message msg, GSM_StateMachine *s, char *templ, | 20 | static GSM_Error GetSiemensFrame(GSM_Protocol_Message msg, GSM_StateMachine *s, char *templ, |
35 | unsigned char *buffer, int *len) | 21 | unsigned char *buffer, int *len) |
36 | { | 22 | { |
37 | GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN; | 23 | GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN; |
38 | int i=2, pos=0, length=0; | 24 | int i=2, pos=0, length=0; |
39 | unsigned char buf[512]; | 25 | unsigned char buf[512]; |
40 | 26 | ||
41 | if (strstr(GetLineString(msg.Buffer,Priv->Lines,2),"OK")) return ERR_EMPTY; | 27 | if (strstr(GetLineString(msg.Buffer,Priv->Lines,2),"OK")) return ERR_EMPTY; |
42 | if (!strstr(GetLineString(msg.Buffer,Priv->Lines,2),templ)) return ERR_UNKNOWN; | 28 | if (!strstr(GetLineString(msg.Buffer,Priv->Lines,2),templ)) return ERR_UNKNOWN; |
43 | 29 | ||
44 | while (1) { | 30 | while (1) { |
45 | if (Priv->Lines.numbers[i*2+1]==0) break; | 31 | if (Priv->Lines.numbers[i*2+1]==0) break; |
46 | if ((!strstr(GetLineString(msg.Buffer,Priv->Lines,i+1),templ)) && | 32 | if ((!strstr(GetLineString(msg.Buffer,Priv->Lines,i+1),templ)) && |
@@ -48,25 +34,25 @@ GSM_Error GetSiemensFrame(GSM_Protocol_Message msg, GSM_StateMachine *s, char *t | |||
48 | length = strlen(GetLineString(msg.Buffer,Priv->Lines,i+1)); | 34 | length = strlen(GetLineString(msg.Buffer,Priv->Lines,i+1)); |
49 | DecodeHexBin(buf, GetLineString(msg.Buffer,Priv->Lines,i+1),length); | 35 | DecodeHexBin(buf, GetLineString(msg.Buffer,Priv->Lines,i+1),length); |
50 | length = length/2; | 36 | length = length/2; |
51 | memcpy (buffer+pos,buf,length); | 37 | memcpy (buffer+pos,buf,length); |
52 | pos+=length; | 38 | pos+=length; |
53 | } | 39 | } |
54 | i++; | 40 | i++; |
55 | } | 41 | } |
56 | *len = pos; | 42 | *len = pos; |
57 | return ERR_NONE; | 43 | return ERR_NONE; |
58 | } | 44 | } |
59 | 45 | ||
60 | GSM_Error SetSiemensFrame (GSM_StateMachine *s, unsigned char *buff, char *templ, | 46 | static GSM_Error SetSiemensFrame (GSM_StateMachine *s, unsigned char *buff, char *templ, |
61 | int Location, GSM_Phone_RequestID RequestID, int len) | 47 | int Location, GSM_Phone_RequestID RequestID, int len) |
62 | { | 48 | { |
63 | GSM_Phone_Data *Phone = &s->Phone.Data; | 49 | GSM_Phone_Data *Phone = &s->Phone.Data; |
64 | GSM_Error error; | 50 | GSM_Error error; |
65 | unsigned char req[20],req1[512],hexreq[2096]; | 51 | unsigned char req[20],req1[512],hexreq[2096]; |
66 | int MaxFrame,CurrentFrame,size,sz,pos=0; | 52 | int MaxFrame,CurrentFrame,size,sz,pos=0; |
67 | 53 | ||
68 | EncodeHexBin(hexreq,buff,len); | 54 | EncodeHexBin(hexreq,buff,len); |
69 | size = len * 2; | 55 | size = len * 2; |
70 | MaxFrame = size / 352; | 56 | MaxFrame = size / 352; |
71 | if (size % 352) MaxFrame++; | 57 | if (size % 352) MaxFrame++; |
72 | 58 | ||
@@ -81,125 +67,135 @@ GSM_Error SetSiemensFrame (GSM_StateMachine *s, unsigned char *buff, char *templ | |||
81 | if (error!=ERR_NONE) return error; | 67 | if (error!=ERR_NONE) return error; |
82 | memcpy (req1,hexreq+pos,sz); | 68 | memcpy (req1,hexreq+pos,sz); |
83 | error = s->Protocol.Functions->WriteMessage(s, req1, sz, 0x00); | 69 | error = s->Protocol.Functions->WriteMessage(s, req1, sz, 0x00); |
84 | if (error!=ERR_NONE) return error; | 70 | if (error!=ERR_NONE) return error; |
85 | error = s->Protocol.Functions->WriteMessage(s,"\x1A", 1, 0x00); | 71 | error = s->Protocol.Functions->WriteMessage(s,"\x1A", 1, 0x00); |
86 | if (error!=ERR_NONE) return error; | 72 | if (error!=ERR_NONE) return error; |
87 | error = GSM_WaitForOnce(s, NULL, 0x00, 0x00, 4); | 73 | error = GSM_WaitForOnce(s, NULL, 0x00, 0x00, 4); |
88 | if (error == ERR_TIMEOUT) return error; | 74 | if (error == ERR_TIMEOUT) return error; |
89 | } | 75 | } |
90 | return Phone->DispatchError; | 76 | return Phone->DispatchError; |
91 | } | 77 | } |
92 | 78 | ||
93 | GSM_Error ATGEN_CMS35ReplyGetBitmap(GSM_Protocol_Message msg, GSM_StateMachine *s) | 79 | GSM_Error SIEMENS_ReplyGetBitmap(GSM_Protocol_Message msg, GSM_StateMachine *s) |
94 | { | 80 | { |
95 | unsigned char buffer[4096]; | 81 | unsigned char buffer[4096]; |
96 | int length; | 82 | int length; |
97 | GSM_Error error; | 83 | GSM_Error error; |
98 | 84 | ||
99 | error = GetSiemensFrame(msg,s,"bmp",buffer,&length); | 85 | error = GetSiemensFrame(msg,s,"bmp",buffer,&length); |
100 | if (error!=ERR_NONE) return error; | 86 | if (error!=ERR_NONE) return error; |
101 | dbgprintf ("Operator logo received lenght=%i\n",length); | 87 | dbgprintf ("Operator logo received lenght=%i\n",length); |
102 | error = BMP2Bitmap (buffer,NULL,s->Phone.Data.Bitmap); | 88 | error = BMP2Bitmap (buffer,NULL,s->Phone.Data.Bitmap); |
103 | if (error==ERR_NONE) return error; | 89 | if (error==ERR_NONE) return error; |
104 | else return ERR_UNKNOWN; | 90 | else return ERR_UNKNOWN; |
105 | } | 91 | } |
106 | 92 | ||
107 | GSM_Error ATGEN_CMS35ReplySetBitmap(GSM_Protocol_Message msg, GSM_StateMachine *s) | 93 | GSM_Error SIEMENS_ReplySetFunction (GSM_Protocol_Message msg, GSM_StateMachine *s,char *function) |
108 | { | 94 | { |
109 | return ATGEN_CMS35ReplySetFunction (msg, s, "Operator Logo"); | 95 | if (s->Protocol.Data.AT.EditMode) { |
96 | s->Protocol.Data.AT.EditMode = false; | ||
97 | return ERR_NONE; | ||
98 | } | ||
99 | dbgprintf ("Written %s",function); | ||
100 | if (s->Phone.Data.Priv.ATGEN.ReplyState == AT_Reply_OK){ | ||
101 | dbgprintf (" - OK\n"); | ||
102 | return ERR_NONE; | ||
103 | } else { | ||
104 | dbgprintf (" - error\n"); | ||
105 | return ERR_UNKNOWN; | ||
106 | } | ||
110 | } | 107 | } |
111 | 108 | ||
112 | GSM_Error ATGEN_GetBitmap(GSM_StateMachine *s, GSM_Bitmap *Bitmap) | 109 | GSM_Error SIEMENS_ReplySetBitmap(GSM_Protocol_Message msg, GSM_StateMachine *s) |
110 | { | ||
111 | return SIEMENS_ReplySetFunction (msg, s, "Operator Logo"); | ||
112 | } | ||
113 | |||
114 | GSM_Error SIEMENS_GetBitmap(GSM_StateMachine *s, GSM_Bitmap *Bitmap) | ||
113 | { | 115 | { |
114 | unsigned char req[32]; | 116 | unsigned char req[32]; |
115 | 117 | ||
116 | if (s->Phone.Data.Priv.ATGEN.Manufacturer!=AT_Siemens) return ERR_NOTSUPPORTED; | ||
117 | if (Bitmap->Type!=GSM_OperatorLogo) return ERR_NOTSUPPORTED; | 118 | if (Bitmap->Type!=GSM_OperatorLogo) return ERR_NOTSUPPORTED; |
118 | if (Bitmap->Location-1 < 0) Bitmap->Location++; | 119 | if (Bitmap->Location-1 < 0) Bitmap->Location++; |
119 | s->Phone.Data.Bitmap=Bitmap; | 120 | s->Phone.Data.Bitmap=Bitmap; |
120 | sprintf(req, "AT^SBNR=\"bmp\",%i\r", Bitmap->Location-1); | 121 | sprintf(req, "AT^SBNR=\"bmp\",%i\r", Bitmap->Location-1); |
121 | smprintf(s, "Getting Bitmap\n"); | 122 | smprintf(s, "Getting Bitmap\n"); |
122 | return GSM_WaitFor (s, req, strlen(req), 0x00, 4, ID_GetBitmap); | 123 | return GSM_WaitFor (s, req, strlen(req), 0x00, 4, ID_GetBitmap); |
123 | } | 124 | } |
124 | 125 | ||
125 | GSM_Error ATGEN_SetBitmap(GSM_StateMachine *s, GSM_Bitmap *Bitmap) | 126 | GSM_Error SIEMENS_SetBitmap(GSM_StateMachine *s, GSM_Bitmap *Bitmap) |
126 | { | 127 | { |
127 | unsigned char buffer[4096]; | 128 | unsigned char buffer[4096]; |
128 | int length; | 129 | int length; |
129 | GSM_Errorerror; | 130 | GSM_Errorerror; |
130 | 131 | ||
131 | if (s->Phone.Data.Priv.ATGEN.Manufacturer!=AT_Siemens) return ERR_NOTSUPPORTED; | ||
132 | if (Bitmap->Type!=GSM_OperatorLogo) return ERR_NOTSUPPORTED; | 132 | if (Bitmap->Type!=GSM_OperatorLogo) return ERR_NOTSUPPORTED; |
133 | 133 | ||
134 | error = Bitmap2BMP (buffer,NULL,Bitmap); | 134 | error = Bitmap2BMP (buffer,NULL,Bitmap); |
135 | if (error!=ERR_NONE) return error; | 135 | if (error!=ERR_NONE) return error; |
136 | length = 0x100 * buffer[3] + buffer[2]; | 136 | length = 0x100 * buffer[3] + buffer[2]; |
137 | buffer[58]=0xff; buffer[59]=0xff; buffer[60]=0xff; | 137 | buffer[58]=0xff; buffer[59]=0xff; buffer[60]=0xff; |
138 | if (Bitmap->Location-1 < 0) Bitmap->Location++; | 138 | if (Bitmap->Location-1 < 0) Bitmap->Location++; |
139 | s->Phone.Data.Bitmap=Bitmap; | 139 | s->Phone.Data.Bitmap=Bitmap; |
140 | return SetSiemensFrame(s, buffer,"bmp",Bitmap->Location-1, | 140 | return SetSiemensFrame(s, buffer,"bmp",Bitmap->Location-1, |
141 | ID_SetBitmap,length); | 141 | ID_SetBitmap,length); |
142 | } | 142 | } |
143 | 143 | ||
144 | GSM_Error ATGEN_CMS35ReplyGetRingtone(GSM_Protocol_Message msg, GSM_StateMachine *s) | 144 | GSM_Error SIEMENS_ReplyGetRingtone(GSM_Protocol_Message msg, GSM_StateMachine *s) |
145 | { | 145 | { |
146 | unsigned char buffer[32]; | 146 | unsigned char buffer[32]; |
147 | int length; | 147 | int length; |
148 | GSM_Error error; | 148 | GSM_Error error; |
149 | 149 | ||
150 | error = GetSiemensFrame(msg,s,"mid",s->Phone.Data.Ringtone->NokiaBinary.Frame,&length); | 150 | error = GetSiemensFrame(msg,s,"mid",s->Phone.Data.Ringtone->NokiaBinary.Frame,&length); |
151 | if (error!=ERR_NONE) return error; | 151 | if (error!=ERR_NONE) return error; |
152 | dbgprintf ("Midi ringtone received\n"); | 152 | dbgprintf ("Midi ringtone received\n"); |
153 | 153 | ||
154 | s->Phone.Data.Ringtone->Format = RING_MIDI; | 154 | s->Phone.Data.Ringtone->Format = RING_MIDI; |
155 | s->Phone.Data.Ringtone->NokiaBinary.Length= length; | 155 | s->Phone.Data.Ringtone->NokiaBinary.Length= length; |
156 | sprintf(buffer,"Individual"); | 156 | sprintf(buffer,"Individual"); |
157 | EncodeUnicode (s->Phone.Data.Ringtone->Name,buffer,strlen(buffer)); | 157 | EncodeUnicode (s->Phone.Data.Ringtone->Name,buffer,strlen(buffer)); |
158 | return ERR_NONE; | 158 | return ERR_NONE; |
159 | } | 159 | } |
160 | 160 | ||
161 | GSM_Error ATGEN_GetRingtone(GSM_StateMachine *s, GSM_Ringtone *Ringtone, bool PhoneRingtone) | 161 | GSM_Error SIEMENS_GetRingtone(GSM_StateMachine *s, GSM_Ringtone *Ringtone, bool PhoneRingtone) |
162 | { | 162 | { |
163 | unsigned char req[32]; | 163 | unsigned char req[32]; |
164 | 164 | ||
165 | if (s->Phone.Data.Priv.ATGEN.Manufacturer!=AT_Siemens) return ERR_NOTSUPPORTED; | ||
166 | |||
167 | s->Phone.Data.Ringtone=Ringtone; | 165 | s->Phone.Data.Ringtone=Ringtone; |
168 | sprintf(req, "AT^SBNR=\"mid\",%i\r", Ringtone->Location-1); | 166 | sprintf(req, "AT^SBNR=\"mid\",%i\r", Ringtone->Location-1); |
169 | smprintf(s, "Getting RingTone\n"); | 167 | smprintf(s, "Getting RingTone\n"); |
170 | return GSM_WaitFor (s, req, strlen(req), 0x00, 4, ID_GetRingtone); | 168 | return GSM_WaitFor (s, req, strlen(req), 0x00, 4, ID_GetRingtone); |
171 | } | 169 | } |
172 | 170 | ||
173 | GSM_Error ATGEN_CMS35ReplySetRingtone(GSM_Protocol_Message msg, GSM_StateMachine *s) | 171 | GSM_Error SIEMENS_ReplySetRingtone(GSM_Protocol_Message msg, GSM_StateMachine *s) |
174 | { | 172 | { |
175 | return ATGEN_CMS35ReplySetFunction (msg, s, "Ringtone"); | 173 | return SIEMENS_ReplySetFunction (msg, s, "Ringtone"); |
176 | } | 174 | } |
177 | 175 | ||
178 | GSM_Error ATGEN_SetRingtone(GSM_StateMachine *s, GSM_Ringtone *Ringtone, int *maxlength) | 176 | GSM_Error SIEMENS_SetRingtone(GSM_StateMachine *s, GSM_Ringtone *Ringtone, int *maxlength) |
179 | { | 177 | { |
180 | GSM_Phone_Data *Phone = &s->Phone.Data; | 178 | GSM_Phone_Data *Phone = &s->Phone.Data; |
181 | 179 | ||
182 | if (s->Phone.Data.Priv.ATGEN.Manufacturer!=AT_Siemens) return ERR_NOTSUPPORTED; | ||
183 | |||
184 | if (Ringtone->Location==255) Ringtone->Location=1; | 180 | if (Ringtone->Location==255) Ringtone->Location=1; |
185 | if (Ringtone->Location-1 > 1) return ERR_INVALIDLOCATION; | 181 | if (Ringtone->Location-1 > 1) return ERR_INVALIDLOCATION; |
186 | 182 | ||
187 | s->Phone.Data.Ringtone= Ringtone; | 183 | s->Phone.Data.Ringtone= Ringtone; |
188 | Phone->Ringtone = Ringtone; | 184 | Phone->Ringtone = Ringtone; |
189 | return SetSiemensFrame(s, Ringtone->NokiaBinary.Frame,"mid",Ringtone->Location-1, | 185 | return SetSiemensFrame(s, Ringtone->NokiaBinary.Frame,"mid",Ringtone->Location-1, |
190 | ID_SetRingtone,Ringtone->NokiaBinary.Length); | 186 | ID_SetRingtone,Ringtone->NokiaBinary.Length); |
191 | } | 187 | } |
192 | 188 | ||
193 | GSM_Error ATGEN_CMS35ReplyGetNextCal(GSM_Protocol_Message msg, GSM_StateMachine *s) | 189 | GSM_Error SIEMENS_ReplyGetNextCalendar(GSM_Protocol_Message msg, GSM_StateMachine *s) |
194 | { | 190 | { |
195 | GSM_Phone_Data *Data = &s->Phone.Data; | 191 | GSM_Phone_Data *Data = &s->Phone.Data; |
196 | GSM_CalendarEntry*Calendar = Data->Cal; | 192 | GSM_CalendarEntry*Calendar = Data->Cal; |
197 | GSM_ToDoEntry ToDo; | 193 | GSM_ToDoEntry ToDo; |
198 | GSM_Error error; | 194 | GSM_Error error; |
199 | unsigned char buffer[354]; | 195 | unsigned char buffer[354]; |
200 | int len, pos=0; | 196 | int len, pos=0; |
201 | 197 | ||
202 | if (Data->Priv.ATGEN.ReplyState != AT_Reply_OK) return ERR_UNKNOWN; | 198 | if (Data->Priv.ATGEN.ReplyState != AT_Reply_OK) return ERR_UNKNOWN; |
203 | 199 | ||
204 | error = GetSiemensFrame(msg,s,"vcs",buffer,&len); | 200 | error = GetSiemensFrame(msg,s,"vcs",buffer,&len); |
205 | if (error!=ERR_NONE) return error; | 201 | if (error!=ERR_NONE) return error; |
@@ -226,30 +222,30 @@ GSM_Error SIEMENS_GetNextCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Note, | |||
226 | Location++; | 222 | Location++; |
227 | sprintf(req, "AT^SBNR=\"vcs\",%i\r",Location); | 223 | sprintf(req, "AT^SBNR=\"vcs\",%i\r",Location); |
228 | error = GSM_WaitFor (s, req, strlen(req), 0x00, 4, ID_GetCalendarNote); | 224 | error = GSM_WaitFor (s, req, strlen(req), 0x00, 4, ID_GetCalendarNote); |
229 | if ((error!=ERR_NONE) && (error!=ERR_EMPTY)) return ERR_INVALIDLOCATION; | 225 | if ((error!=ERR_NONE) && (error!=ERR_EMPTY)) return ERR_INVALIDLOCATION; |
230 | Note->Location = Location; | 226 | Note->Location = Location; |
231 | Priv->FirstCalendarPos = Location; | 227 | Priv->FirstCalendarPos = Location; |
232 | if (Location > MAX_VCALENDAR_LOCATION) return ERR_EMPTY; | 228 | if (Location > MAX_VCALENDAR_LOCATION) return ERR_EMPTY; |
233 | if (error==ERR_NONE) return error; | 229 | if (error==ERR_NONE) return error; |
234 | } | 230 | } |
235 | return error; | 231 | return error; |
236 | } | 232 | } |
237 | 233 | ||
238 | GSM_Error ATGEN_CMS35ReplySetCalendar(GSM_Protocol_Message msg, GSM_StateMachine *s) | 234 | GSM_Error SIEMENS_ReplyAddCalendarNote(GSM_Protocol_Message msg, GSM_StateMachine *s) |
239 | { | 235 | { |
240 | return ATGEN_CMS35ReplySetFunction (msg, s, "Calendar Note"); | 236 | return SIEMENS_ReplySetFunction (msg, s, "Calendar Note"); |
241 | } | 237 | } |
242 | 238 | ||
243 | GSM_Error ATGEN_CMS35ReplyDeleteCalendar(GSM_Protocol_Message msg, GSM_StateMachine *s) | 239 | GSM_Error SIEMENS_ReplyDelCalendarNote(GSM_Protocol_Message msg, GSM_StateMachine *s) |
244 | { | 240 | { |
245 | GSM_Phone_Data *Data = &s->Phone.Data; | 241 | GSM_Phone_Data *Data = &s->Phone.Data; |
246 | 242 | ||
247 | if (Data->Cal->Location > MAX_VCALENDAR_LOCATION) return ERR_UNKNOWN; | 243 | if (Data->Cal->Location > MAX_VCALENDAR_LOCATION) return ERR_UNKNOWN; |
248 | 244 | ||
249 | if (Data->Priv.ATGEN.ReplyState== AT_Reply_OK) { | 245 | if (Data->Priv.ATGEN.ReplyState== AT_Reply_OK) { |
250 | smprintf(s, "Calendar note deleted\n"); | 246 | smprintf(s, "Calendar note deleted\n"); |
251 | return ERR_NONE; | 247 | return ERR_NONE; |
252 | } else { | 248 | } else { |
253 | smprintf(s, "Can't delete calendar note\n"); | 249 | smprintf(s, "Can't delete calendar note\n"); |
254 | return ERR_UNKNOWN; | 250 | return ERR_UNKNOWN; |
255 | } | 251 | } |
@@ -274,25 +270,25 @@ GSM_Error SIEMENS_AddCalendarNote(GSM_StateMachine *s, GSM_CalendarEntry *Note) | |||
274 | int size=0; | 270 | int size=0; |
275 | 271 | ||
276 | if (Priv->Manufacturer!=AT_Siemens) return ERR_NOTSUPPORTED; | 272 | if (Priv->Manufacturer!=AT_Siemens) return ERR_NOTSUPPORTED; |
277 | // if (Note->Location==0x00) return ERR_INVALIDLOCATION; | 273 | // if (Note->Location==0x00) return ERR_INVALIDLOCATION; |
278 | 274 | ||
279 | s->Phone.Data.Cal = Note; | 275 | s->Phone.Data.Cal = Note; |
280 | error=GSM_EncodeVCALENDAR(req,&size,Note,true,Siemens_VCalendar); | 276 | error=GSM_EncodeVCALENDAR(req,&size,Note,true,Siemens_VCalendar); |
281 | 277 | ||
282 | return SetSiemensFrame (s,req,"vcs",Note->Location,ID_SetCalendarNote,size); | 278 | return SetSiemensFrame (s,req,"vcs",Note->Location,ID_SetCalendarNote,size); |
283 | } | 279 | } |
284 | 280 | ||
285 | /* (c) by Timo Teras */ | 281 | /* (c) by Timo Teras */ |
286 | GSM_Error ATGEN_SL45ReplyGetMemory(GSM_Protocol_Message msg, GSM_StateMachine *s) | 282 | GSM_Error SIEMENS_ReplyGetMemory(GSM_Protocol_Message msg, GSM_StateMachine *s) |
287 | { | 283 | { |
288 | #ifndef ENABLE_LGPL | 284 | #ifndef ENABLE_LGPL |
289 | GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN; | 285 | GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN; |
290 | GSM_MemoryEntry *Memory = s->Phone.Data.Memory; | 286 | GSM_MemoryEntry *Memory = s->Phone.Data.Memory; |
291 | unsigned char buffer[500],buffer2[500]; | 287 | unsigned char buffer[500],buffer2[500]; |
292 | 288 | ||
293 | switch (Priv->ReplyState) { | 289 | switch (Priv->ReplyState) { |
294 | case AT_Reply_OK: | 290 | case AT_Reply_OK: |
295 | smprintf(s, "Phonebook entry received\n"); | 291 | smprintf(s, "Phonebook entry received\n"); |
296 | CopyLineString(buffer, msg.Buffer, Priv->Lines, 3); | 292 | CopyLineString(buffer, msg.Buffer, Priv->Lines, 3); |
297 | DecodeHexBin(buffer2,buffer,strlen(buffer)); | 293 | DecodeHexBin(buffer2,buffer,strlen(buffer)); |
298 | Memory->EntriesNum = 0; | 294 | Memory->EntriesNum = 0; |
diff --git a/gammu/emb/common/phone/at/sonyeric.c b/gammu/emb/common/phone/at/sonyeric.c index 4b2670a..8eeb39b 100644 --- a/gammu/emb/common/phone/at/sonyeric.c +++ b/gammu/emb/common/phone/at/sonyeric.c | |||
@@ -2,35 +2,33 @@ | |||
2 | 2 | ||
3 | #include "../../gsmstate.h" | 3 | #include "../../gsmstate.h" |
4 | 4 | ||
5 | #ifdef GSM_ENABLE_ATGEN | 5 | #ifdef GSM_ENABLE_ATGEN |
6 | 6 | ||
7 | #include <string.h> | 7 | #include <string.h> |
8 | #include <time.h> | 8 | #include <time.h> |
9 | #include <ctype.h> | 9 | #include <ctype.h> |
10 | 10 | ||
11 | #include "../../gsmcomon.h" | 11 | #include "../../gsmcomon.h" |
12 | #include "../../misc/coding/coding.h" | 12 | #include "../../misc/coding/coding.h" |
13 | 13 | ||
14 | extern GSM_Reply_Function ATGENReplyFunctions[]; | 14 | #include "atgen.h" |
15 | extern GSM_Error ATGEN_DispatchMessage(GSM_StateMachine *s); | 15 | #include "sonyeric.h" |
16 | 16 | ||
17 | #ifdef GSM_ENABLE_OBEXGEN | 17 | #ifdef GSM_ENABLE_OBEXGEN |
18 | 18 | ||
19 | extern GSM_Reply_Function OBEXGENReplyFunctions[]; | 19 | #include "../obex/obexgen.h" |
20 | extern GSM_Error OBEXGEN_GetFilePart(GSM_StateMachine *s, GSM_File *File); | ||
21 | extern GSM_Error OBEXGEN_AddFilePart(GSM_StateMachine *s, GSM_File *File, int *Pos); | ||
22 | extern GSM_Error OBEXGEN_Disconnect(GSM_StateMachine *s); | ||
23 | 20 | ||
24 | #if defined(GSM_ENABLE_BLUEOBEX) || defined(GSM_ENABLE_IRDAOBEX) | 21 | extern GSM_Reply_FunctionOBEXGENReplyFunctions[]; |
22 | extern GSM_Reply_FunctionATGENReplyFunctions[]; | ||
25 | 23 | ||
26 | static GSM_Error SONYERIC_SetOBEXMode(GSM_StateMachine *s) | 24 | static GSM_Error SONYERIC_SetOBEXMode(GSM_StateMachine *s) |
27 | { | 25 | { |
28 | GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; | 26 | GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; |
29 | GSM_Error error; | 27 | GSM_Error error; |
30 | 28 | ||
31 | if (Priv->OBEX) return ERR_NONE; | 29 | if (Priv->OBEX) return ERR_NONE; |
32 | 30 | ||
33 | dbgprintf ("Changing to OBEX\n"); | 31 | dbgprintf ("Changing to OBEX\n"); |
34 | 32 | ||
35 | error=GSM_WaitFor (s, "AT*EOBEX\r", 9, 0x00, 4, ID_SetOBEX); | 33 | error=GSM_WaitFor (s, "AT*EOBEX\r", 9, 0x00, 4, ID_SetOBEX); |
36 | if (error != ERR_NONE) return error; | 34 | if (error != ERR_NONE) return error; |
@@ -117,25 +115,25 @@ static GSM_Error SONYERIC_SetFile(GSM_StateMachine *s, unsigned char *FileName, | |||
117 | error = ERR_NONE; | 115 | error = ERR_NONE; |
118 | while (error == ERR_NONE) error = OBEXGEN_AddFilePart(s,&File,&Pos); | 116 | while (error == ERR_NONE) error = OBEXGEN_AddFilePart(s,&File,&Pos); |
119 | free(File.Buffer); | 117 | free(File.Buffer); |
120 | if (error != ERR_EMPTY) return error; | 118 | if (error != ERR_EMPTY) return error; |
121 | 119 | ||
122 | return SONYERIC_SetATMode(s); | 120 | return SONYERIC_SetATMode(s); |
123 | } | 121 | } |
124 | 122 | ||
125 | #endif | 123 | #endif |
126 | 124 | ||
127 | GSM_Error SONYERIC_GetNextCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Note, bool start) | 125 | GSM_Error SONYERIC_GetNextCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Note, bool start) |
128 | { | 126 | { |
129 | #if defined(GSM_ENABLE_BLUEOBEX) || defined(GSM_ENABLE_IRDAOBEX) | 127 | #ifdef GSM_ENABLE_OBEXGEN |
130 | GSM_Error error; | 128 | GSM_Error error; |
131 | GSM_ToDoEntry ToDo; | 129 | GSM_ToDoEntry ToDo; |
132 | int Pos, num, Loc; | 130 | int Pos, num, Loc; |
133 | GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; | 131 | GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; |
134 | 132 | ||
135 | if (start) { | 133 | if (start) { |
136 | error = SONYERIC_GetFile(s, &Priv->file, "telecom/cal.vcs"); | 134 | error = SONYERIC_GetFile(s, &Priv->file, "telecom/cal.vcs"); |
137 | if (error != ERR_NONE) return error; | 135 | if (error != ERR_NONE) return error; |
138 | 136 | ||
139 | Note->Location = 1; | 137 | Note->Location = 1; |
140 | } else { | 138 | } else { |
141 | Note->Location++; | 139 | Note->Location++; |
@@ -153,25 +151,25 @@ GSM_Error SONYERIC_GetNextCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Note, | |||
153 | num++; | 151 | num++; |
154 | if (num == Loc) return ERR_NONE; | 152 | if (num == Loc) return ERR_NONE; |
155 | } | 153 | } |
156 | } | 154 | } |
157 | return ERR_EMPTY; | 155 | return ERR_EMPTY; |
158 | #else | 156 | #else |
159 | return ERR_SOURCENOTAVAILABLE; | 157 | return ERR_SOURCENOTAVAILABLE; |
160 | #endif | 158 | #endif |
161 | } | 159 | } |
162 | 160 | ||
163 | GSM_Error SONYERIC_GetNextToDo(GSM_StateMachine *s, GSM_ToDoEntry *ToDo, bool start) | 161 | GSM_Error SONYERIC_GetNextToDo(GSM_StateMachine *s, GSM_ToDoEntry *ToDo, bool start) |
164 | { | 162 | { |
165 | #if defined(GSM_ENABLE_BLUEOBEX) || defined(GSM_ENABLE_IRDAOBEX) | 163 | #ifdef GSM_ENABLE_OBEXGEN |
166 | GSM_Error error; | 164 | GSM_Error error; |
167 | GSM_CalendarEntryCalendar; | 165 | GSM_CalendarEntryCalendar; |
168 | int Pos, num, Loc; | 166 | int Pos, num, Loc; |
169 | GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; | 167 | GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; |
170 | 168 | ||
171 | if (Priv->Manufacturer!=AT_Ericsson) return ERR_NOTSUPPORTED; | 169 | if (Priv->Manufacturer!=AT_Ericsson) return ERR_NOTSUPPORTED; |
172 | 170 | ||
173 | if (start) { | 171 | if (start) { |
174 | error = SONYERIC_GetFile(s, &Priv->file, "telecom/cal.vcs"); | 172 | error = SONYERIC_GetFile(s, &Priv->file, "telecom/cal.vcs"); |
175 | if (error != ERR_NONE) return error; | 173 | if (error != ERR_NONE) return error; |
176 | 174 | ||
177 | ToDo->Location = 1; | 175 | ToDo->Location = 1; |
@@ -192,25 +190,25 @@ GSM_Error SONYERIC_GetNextToDo(GSM_StateMachine *s, GSM_ToDoEntry *ToDo, bool st | |||
192 | if (num == Loc) return ERR_NONE; | 190 | if (num == Loc) return ERR_NONE; |
193 | } | 191 | } |
194 | } | 192 | } |
195 | 193 | ||
196 | return ERR_EMPTY; | 194 | return ERR_EMPTY; |
197 | #else | 195 | #else |
198 | return ERR_SOURCENOTAVAILABLE; | 196 | return ERR_SOURCENOTAVAILABLE; |
199 | #endif | 197 | #endif |
200 | } | 198 | } |
201 | 199 | ||
202 | GSM_Error SONYERIC_GetToDoStatus(GSM_StateMachine *s, GSM_ToDoStatus *status) | 200 | GSM_Error SONYERIC_GetToDoStatus(GSM_StateMachine *s, GSM_ToDoStatus *status) |
203 | { | 201 | { |
204 | #if defined(GSM_ENABLE_BLUEOBEX) || defined(GSM_ENABLE_IRDAOBEX) | 202 | #ifdef GSM_ENABLE_OBEXGEN |
205 | GSM_Error error; | 203 | GSM_Error error; |
206 | GSM_ToDoEntry ToDo; | 204 | GSM_ToDoEntry ToDo; |
207 | GSM_CalendarEntry Calendar; | 205 | GSM_CalendarEntry Calendar; |
208 | int Pos; | 206 | int Pos; |
209 | GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; | 207 | GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; |
210 | 208 | ||
211 | if (Priv->Manufacturer!=AT_Ericsson) return ERR_NOTSUPPORTED; | 209 | if (Priv->Manufacturer!=AT_Ericsson) return ERR_NOTSUPPORTED; |
212 | 210 | ||
213 | smprintf(s,"Getting ToDo status\n"); | 211 | smprintf(s,"Getting ToDo status\n"); |
214 | 212 | ||
215 | error = SONYERIC_GetFile(s, &Priv->file, "telecom/cal.vcs"); | 213 | error = SONYERIC_GetFile(s, &Priv->file, "telecom/cal.vcs"); |
216 | if (error != ERR_NONE) return error; | 214 | if (error != ERR_NONE) return error; |
@@ -223,60 +221,60 @@ GSM_Error SONYERIC_GetToDoStatus(GSM_StateMachine *s, GSM_ToDoStatus *status) | |||
223 | if (error != ERR_NONE) return error; | 221 | if (error != ERR_NONE) return error; |
224 | if (ToDo.EntriesNum != 0) status->Used++; | 222 | if (ToDo.EntriesNum != 0) status->Used++; |
225 | } | 223 | } |
226 | 224 | ||
227 | return ERR_NONE; | 225 | return ERR_NONE; |
228 | #else | 226 | #else |
229 | return ERR_SOURCENOTAVAILABLE; | 227 | return ERR_SOURCENOTAVAILABLE; |
230 | #endif | 228 | #endif |
231 | } | 229 | } |
232 | 230 | ||
233 | GSM_Error SONYERIC_AddCalendarNote(GSM_StateMachine *s, GSM_CalendarEntry *Note) | 231 | GSM_Error SONYERIC_AddCalendarNote(GSM_StateMachine *s, GSM_CalendarEntry *Note) |
234 | { | 232 | { |
235 | #if defined(GSM_ENABLE_BLUEOBEX) || defined(GSM_ENABLE_IRDAOBEX) | 233 | #ifdef GSM_ENABLE_OBEXGEN |
236 | unsigned char req[5000]; | 234 | unsigned char req[5000]; |
237 | int size=0; | 235 | int size=0; |
238 | 236 | ||
239 | smprintf(s,"Adding calendar note\n"); | 237 | smprintf(s,"Adding calendar note\n"); |
240 | 238 | ||
241 | GSM_EncodeVCALENDAR(req,&size,Note,true,SonyEricsson_VCalendar); | 239 | GSM_EncodeVCALENDAR(req,&size,Note,true,SonyEricsson_VCalendar); |
242 | 240 | ||
243 | return SONYERIC_SetFile(s, "telecom/cal/luid/.vcs", req, size); | 241 | return SONYERIC_SetFile(s, "telecom/cal/luid/.vcs", req, size); |
244 | #else | 242 | #else |
245 | return ERR_SOURCENOTAVAILABLE; | 243 | return ERR_SOURCENOTAVAILABLE; |
246 | #endif | 244 | #endif |
247 | } | 245 | } |
248 | 246 | ||
249 | GSM_Error SONYERIC_AddToDo(GSM_StateMachine *s, GSM_ToDoEntry *ToDo) | 247 | GSM_Error SONYERIC_AddToDo(GSM_StateMachine *s, GSM_ToDoEntry *ToDo) |
250 | { | 248 | { |
251 | #if defined(GSM_ENABLE_BLUEOBEX) || defined(GSM_ENABLE_IRDAOBEX) | 249 | #ifdef GSM_ENABLE_OBEXGEN |
252 | GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; | 250 | GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; |
253 | unsigned char req[5000]; | 251 | unsigned char req[5000]; |
254 | int size=0; | 252 | int size=0; |
255 | 253 | ||
256 | if (Priv->Manufacturer!=AT_Ericsson) return ERR_NOTSUPPORTED; | 254 | if (Priv->Manufacturer!=AT_Ericsson) return ERR_NOTSUPPORTED; |
257 | 255 | ||
258 | smprintf(s,"Adding ToDo\n"); | 256 | smprintf(s,"Adding ToDo\n"); |
259 | 257 | ||
260 | GSM_EncodeVTODO(req,&size,ToDo,true,SonyEricsson_VToDo); | 258 | GSM_EncodeVTODO(req,&size,ToDo,true,SonyEricsson_VToDo); |
261 | 259 | ||
262 | return SONYERIC_SetFile(s, "telecom/cal/luid/.vcs", req, size); | 260 | return SONYERIC_SetFile(s, "telecom/cal/luid/.vcs", req, size); |
263 | #else | 261 | #else |
264 | return ERR_SOURCENOTAVAILABLE; | 262 | return ERR_SOURCENOTAVAILABLE; |
265 | #endif | 263 | #endif |
266 | } | 264 | } |
267 | 265 | ||
268 | GSM_Error SONYERIC_DeleteAllToDo(GSM_StateMachine *s) | 266 | GSM_Error SONYERIC_DeleteAllToDo(GSM_StateMachine *s) |
269 | { | 267 | { |
270 | #if defined(GSM_ENABLE_BLUEOBEX) || defined(GSM_ENABLE_IRDAOBEX) | 268 | #ifdef GSM_ENABLE_OBEXGEN |
271 | GSM_Error error; | 269 | GSM_Error error; |
272 | int Pos,Level = 0,Used; | 270 | int Pos,Level = 0,Used; |
273 | unsigned char *Buf; | 271 | unsigned char *Buf; |
274 | GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; | 272 | GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; |
275 | unsigned char Line[2000]; | 273 | unsigned char Line[2000]; |
276 | 274 | ||
277 | if (Priv->Manufacturer!=AT_Ericsson) return ERR_NOTSUPPORTED; | 275 | if (Priv->Manufacturer!=AT_Ericsson) return ERR_NOTSUPPORTED; |
278 | 276 | ||
279 | smprintf(s,"Deleting all ToDo\n"); | 277 | smprintf(s,"Deleting all ToDo\n"); |
280 | 278 | ||
281 | error = SONYERIC_GetFile(s, &Priv->file, "telecom/cal.vcs"); | 279 | error = SONYERIC_GetFile(s, &Priv->file, "telecom/cal.vcs"); |
282 | if (error != ERR_NONE) return error; | 280 | if (error != ERR_NONE) return error; |
@@ -310,25 +308,25 @@ GSM_Error SONYERIC_DeleteAllToDo(GSM_StateMachine *s) | |||
310 | } | 308 | } |
311 | 309 | ||
312 | error = SONYERIC_SetFile(s, "telecom/cal.vcs", Buf, Used); | 310 | error = SONYERIC_SetFile(s, "telecom/cal.vcs", Buf, Used); |
313 | //if (Buf != NULL) free(Buf); | 311 | //if (Buf != NULL) free(Buf); |
314 | return error; | 312 | return error; |
315 | #else | 313 | #else |
316 | return ERR_SOURCENOTAVAILABLE; | 314 | return ERR_SOURCENOTAVAILABLE; |
317 | #endif | 315 | #endif |
318 | } | 316 | } |
319 | 317 | ||
320 | GSM_Error SONYERIC_DelCalendarNote(GSM_StateMachine *s, GSM_CalendarEntry *Note) | 318 | GSM_Error SONYERIC_DelCalendarNote(GSM_StateMachine *s, GSM_CalendarEntry *Note) |
321 | { | 319 | { |
322 | #if defined(GSM_ENABLE_BLUEOBEX) || defined(GSM_ENABLE_IRDAOBEX) | 320 | #ifdef GSM_ENABLE_OBEXGEN |
323 | GSM_Error error; | 321 | GSM_Error error; |
324 | int Pos,Level = 0,Loc=0,Used; | 322 | int Pos,Level = 0,Loc=0,Used; |
325 | GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; | 323 | GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; |
326 | unsigned char Line[2000]; | 324 | unsigned char Line[2000]; |
327 | unsigned char *Buf; | 325 | unsigned char *Buf; |
328 | 326 | ||
329 | smprintf(s, "Deleting calendar note %i\n",Note->Location); | 327 | smprintf(s, "Deleting calendar note %i\n",Note->Location); |
330 | 328 | ||
331 | error = SONYERIC_GetFile(s, &Priv->file, "telecom/cal.vcs"); | 329 | error = SONYERIC_GetFile(s, &Priv->file, "telecom/cal.vcs"); |
332 | if (error != ERR_NONE) return error; | 330 | if (error != ERR_NONE) return error; |
333 | 331 | ||
334 | Pos = 0; | 332 | Pos = 0; |
@@ -365,25 +363,25 @@ GSM_Error SONYERIC_DelCalendarNote(GSM_StateMachine *s, GSM_CalendarEntry *Note) | |||
365 | DumpMessage(s->di.df, s->di.dl, Buf, Used); | 363 | DumpMessage(s->di.df, s->di.dl, Buf, Used); |
366 | 364 | ||
367 | error = SONYERIC_SetFile(s, "telecom/cal.vcs", Buf, Used); | 365 | error = SONYERIC_SetFile(s, "telecom/cal.vcs", Buf, Used); |
368 | if (Buf != NULL) free(Buf); | 366 | if (Buf != NULL) free(Buf); |
369 | return error; | 367 | return error; |
370 | #else | 368 | #else |
371 | return ERR_SOURCENOTAVAILABLE; | 369 | return ERR_SOURCENOTAVAILABLE; |
372 | #endif | 370 | #endif |
373 | } | 371 | } |
374 | 372 | ||
375 | GSM_Error SONYERIC_GetCalendarStatus(GSM_StateMachine *s, GSM_CalendarStatus *Status) | 373 | GSM_Error SONYERIC_GetCalendarStatus(GSM_StateMachine *s, GSM_CalendarStatus *Status) |
376 | { | 374 | { |
377 | #if defined(GSM_ENABLE_BLUEOBEX) || defined(GSM_ENABLE_IRDAOBEX) | 375 | #ifdef GSM_ENABLE_OBEXGEN |
378 | GSM_Error error; | 376 | GSM_Error error; |
379 | GSM_ToDoEntry ToDo; | 377 | GSM_ToDoEntry ToDo; |
380 | GSM_CalendarEntry Calendar; | 378 | GSM_CalendarEntry Calendar; |
381 | int Pos; | 379 | int Pos; |
382 | GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; | 380 | GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; |
383 | 381 | ||
384 | if (Priv->Manufacturer!=AT_Ericsson) return ERR_NOTSUPPORTED; | 382 | if (Priv->Manufacturer!=AT_Ericsson) return ERR_NOTSUPPORTED; |
385 | 383 | ||
386 | smprintf(s, "Getting calendar status\n"); | 384 | smprintf(s, "Getting calendar status\n"); |
387 | 385 | ||
388 | error = SONYERIC_GetFile(s, &Priv->file, "telecom/cal.vcs"); | 386 | error = SONYERIC_GetFile(s, &Priv->file, "telecom/cal.vcs"); |
389 | if (error != ERR_NONE) return error; | 387 | if (error != ERR_NONE) return error; |
@@ -394,18 +392,129 @@ GSM_Error SONYERIC_GetCalendarStatus(GSM_StateMachine *s, GSM_CalendarStatus *St | |||
394 | error = GSM_DecodeVCALENDAR_VTODO(Priv->file.Buffer, &Pos, &Calendar, &ToDo, SonyEricsson_VCalendar, SonyEricsson_VToDo); | 392 | error = GSM_DecodeVCALENDAR_VTODO(Priv->file.Buffer, &Pos, &Calendar, &ToDo, SonyEricsson_VCalendar, SonyEricsson_VToDo); |
395 | if (error == ERR_EMPTY) break; | 393 | if (error == ERR_EMPTY) break; |
396 | if (error != ERR_NONE) return error; | 394 | if (error != ERR_NONE) return error; |
397 | if (Calendar.EntriesNum != 0) Status->Used++; | 395 | if (Calendar.EntriesNum != 0) Status->Used++; |
398 | } | 396 | } |
399 | 397 | ||
400 | return ERR_NONE; | 398 | return ERR_NONE; |
401 | #else | 399 | #else |
402 | return ERR_SOURCENOTAVAILABLE; | 400 | return ERR_SOURCENOTAVAILABLE; |
403 | #endif | 401 | #endif |
404 | } | 402 | } |
405 | 403 | ||
406 | #endif | 404 | GSM_Error ERICSSON_ReplyGetDateLocale(GSM_Protocol_Message msg, GSM_StateMachine *s) |
405 | { /*Author: Peter Ondraska, based on code by Marcin Wiacek and Michal Cihar | ||
406 | License: Whatever the current maintainer of gammulib chooses, as long as there | ||
407 | is an easy way to obtain the source under GPL, otherwise the author's parts | ||
408 | of this function are GPL 2.0. | ||
409 | */ | ||
410 | GSM_Locale*locale = s->Phone.Data.Locale; | ||
411 | char format; | ||
412 | |||
413 | switch (s->Phone.Data.Priv.ATGEN.ReplyState) { | ||
414 | case AT_Reply_OK: | ||
415 | smprintf(s, "Date settings received\n"); | ||
416 | format=atoi(msg.Buffer); | ||
417 | switch (format) { | ||
418 | case 0: locale->DateFormat = GSM_Date_OFF; | ||
419 | locale->DateSeparator = 0; | ||
420 | break; | ||
421 | case 1: locale->DateFormat = GSM_Date_DDMMMYY; | ||
422 | locale->DateSeparator = '-'; | ||
423 | break; | ||
424 | case 2: locale->DateFormat = GSM_Date_DDMMYY; | ||
425 | locale->DateSeparator = '-'; | ||
426 | break; | ||
427 | case 3: locale->DateFormat = GSM_Date_MMDDYY; | ||
428 | locale->DateSeparator = '/'; | ||
429 | break; | ||
430 | case 4: locale->DateFormat = GSM_Date_DDMMYY; | ||
431 | locale->DateSeparator = '/'; | ||
432 | break; | ||
433 | case 5: locale->DateFormat = GSM_Date_DDMMYY; | ||
434 | locale->DateSeparator = '.'; | ||
435 | break; | ||
436 | case 6: locale->DateFormat = GSM_Date_YYMMDD; | ||
437 | locale->DateSeparator = 0; | ||
438 | break; | ||
439 | case 7: locale->DateFormat = GSM_Date_YYMMDD; | ||
440 | locale->DateSeparator = '-'; | ||
441 | break; | ||
442 | default:return ERR_UNKNOWNRESPONSE; | ||
443 | } | ||
444 | default: | ||
445 | return ERR_NOTSUPPORTED; | ||
446 | } | ||
447 | } | ||
448 | |||
449 | GSM_Error ERICSSON_ReplyGetTimeLocale(GSM_Protocol_Message msg, GSM_StateMachine *s) | ||
450 | { /*Author: Peter Ondraska | ||
451 | License: Whatever the current maintainer of gammulib chooses, as long as there | ||
452 | is an easy way to obtain the source under GPL, otherwise the author's parts | ||
453 | of this function are GPL 2.0. | ||
454 | */ | ||
455 | char format; | ||
456 | |||
457 | switch (s->Phone.Data.Priv.ATGEN.ReplyState) { | ||
458 | case AT_Reply_OK: | ||
459 | smprintf(s, "Time settings received\n"); | ||
460 | format=atoi(msg.Buffer); | ||
461 | switch (format) { | ||
462 | case 1: | ||
463 | case 2: s->Phone.Data.Locale->AMPMTime=(format==2); | ||
464 | return ERR_NONE; | ||
465 | default:return ERR_UNKNOWNRESPONSE; | ||
466 | } | ||
467 | default: return ERR_NOTSUPPORTED; | ||
468 | } | ||
469 | } | ||
470 | |||
471 | GSM_Error ERICSSON_GetLocale(GSM_StateMachine *s, GSM_Locale *locale) | ||
472 | { | ||
473 | GSM_Error error; | ||
474 | |||
475 | s->Phone.Data.Locale = locale; | ||
476 | |||
477 | smprintf(s, "Getting date format\n"); | ||
478 | error=GSM_WaitFor (s, "AT+ESDF?\r", 9, 0x00, 3, ID_GetLocale); | ||
479 | if (error!=ERR_NONE) return error; | ||
480 | |||
481 | smprintf(s, "Getting time format\n"); | ||
482 | return GSM_WaitFor (s, "AT+ESTF?\r", 9, 0x00, 3, ID_GetLocale); | ||
483 | } | ||
484 | |||
485 | |||
486 | GSM_Error ERICSSON_SetLocale(GSM_StateMachine *s, GSM_Locale *locale) | ||
487 | { /*Author: Peter Ondraska | ||
488 | License: Whatever the current maintainer of gammulib chooses, as long as there | ||
489 | is an easy way to obtain the source under GPL, otherwise the author's parts | ||
490 | of this function are GPL 2.0. | ||
491 | */ | ||
492 | /* this is not yet supported by gammu.c */ | ||
493 | intformat=0; | ||
494 | charreq[12]; | ||
495 | |||
496 | if (locale->DateFormat==GSM_Date_OFF) { format=0; } else | ||
497 | if ((locale->DateFormat==GSM_Date_DDMMMYY)&&(locale->DateSeparator=='-')) { format=1; } else | ||
498 | if ((locale->DateFormat==GSM_Date_DDMMYY)&&(locale->DateSeparator=='-')) { format=2; } else | ||
499 | if ((locale->DateFormat==GSM_Date_MMDDYY)&&(locale->DateSeparator=='/')) { format=3; } else | ||
500 | if ((locale->DateFormat==GSM_Date_DDMMYY)&&(locale->DateSeparator=='/')) { format=4; } else | ||
501 | if ((locale->DateFormat==GSM_Date_DDMMYY)&&(locale->DateSeparator=='.')) { format=5; } else | ||
502 | if ((locale->DateFormat==GSM_Date_YYMMDD)&&(locale->DateSeparator==0)) { format=6; } else | ||
503 | if ((locale->DateFormat==GSM_Date_YYMMDD)&&(locale->DateSeparator=='-')) { format=7; } | ||
504 | else { return ERR_NOTSUPPORTED; } /* ERR_WRONGINPUT */ | ||
505 | |||
506 | sprintf(req,"AT+ESDF=%i\r",format); | ||
507 | smprintf(s, "Setting date format\n"); | ||
508 | return GSM_WaitFor (s, req, strlen(req), 0x00, 3, ID_SetLocale); | ||
509 | |||
510 | if (locale->AMPMTime) { format=2; } else { format=1; } | ||
511 | sprintf(req,"AT+ESTF=%i\r",format); | ||
512 | smprintf(s, "Setting time format\n"); | ||
513 | return GSM_WaitFor (s, req, strlen(req), 0x00, 3, ID_SetLocale); | ||
514 | } | ||
515 | |||
407 | #endif | 516 | #endif |
408 | 517 | ||
409 | /* How should editor hadle tabs in this file? Add editor commands here. | 518 | /* How should editor hadle tabs in this file? Add editor commands here. |
410 | * vim: noexpandtab sw=8 ts=8 sts=8: | 519 | * vim: noexpandtab sw=8 ts=8 sts=8: |
411 | */ | 520 | */ |
diff --git a/gammu/emb/common/phone/nokia/dct3/dct3func.c b/gammu/emb/common/phone/nokia/dct3/dct3func.c index beef33c..17cd0a4 100644 --- a/gammu/emb/common/phone/nokia/dct3/dct3func.c +++ b/gammu/emb/common/phone/nokia/dct3/dct3func.c | |||
@@ -1,15 +1,18 @@ | |||
1 | /* (c) 2001-2004 by Marcin Wiacek */ | 1 | /* (c) 2001-2004 by Marcin Wiacek */ |
2 | /* based on some work from Markus Plail, Pavel Janik, others and Gnokii */ | ||
3 | /* resetting DCT4 phones settings (c) by Walek */ | 2 | /* resetting DCT4 phones settings (c) by Walek */ |
3 | /* based on some Markus Plail, Pavel Janik & others work from Gnokii (www.gnokii.org) | ||
4 | * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot | ||
5 | * GNU GPL version 2 or later | ||
6 | */ | ||
4 | 7 | ||
5 | #include <string.h> /* memcpy only */ | 8 | #include <string.h> /* memcpy only */ |
6 | #include <stdio.h> | 9 | #include <stdio.h> |
7 | #include <ctype.h> | 10 | #include <ctype.h> |
8 | 11 | ||
9 | #include "../../../gsmstate.h" | 12 | #include "../../../gsmstate.h" |
10 | #include "../../../misc/coding/coding.h" | 13 | #include "../../../misc/coding/coding.h" |
11 | #include "../../../service/sms/gsmsms.h" | 14 | #include "../../../service/sms/gsmsms.h" |
12 | #include "../../pfunc.h" | 15 | #include "../../pfunc.h" |
13 | #include "../nfunc.h" | 16 | #include "../nfunc.h" |
14 | #include "dct3func.h" | 17 | #include "dct3func.h" |
15 | 18 | ||
@@ -385,24 +388,25 @@ GSM_Error DCT3_ReplyGetSMSC(GSM_Protocol_Message msg, GSM_StateMachine *s) | |||
385 | switch (msg.Buffer[3]) { | 388 | switch (msg.Buffer[3]) { |
386 | case 0x34: | 389 | case 0x34: |
387 | smprintf(s, "SMSC received\n"); | 390 | smprintf(s, "SMSC received\n"); |
388 | Data->SMSC->Format = SMS_FORMAT_Text; | 391 | Data->SMSC->Format = SMS_FORMAT_Text; |
389 | switch (msg.Buffer[6]) { | 392 | switch (msg.Buffer[6]) { |
390 | case 0x00: Data->SMSC->Format = SMS_FORMAT_Text; break; | 393 | case 0x00: Data->SMSC->Format = SMS_FORMAT_Text; break; |
391 | case 0x22: Data->SMSC->Format = SMS_FORMAT_Fax; break; | 394 | case 0x22: Data->SMSC->Format = SMS_FORMAT_Fax; break; |
392 | case 0x26: Data->SMSC->Format = SMS_FORMAT_Pager;break; | 395 | case 0x26: Data->SMSC->Format = SMS_FORMAT_Pager;break; |
393 | case 0x32: Data->SMSC->Format = SMS_FORMAT_Email;break; | 396 | case 0x32: Data->SMSC->Format = SMS_FORMAT_Email;break; |
394 | } | 397 | } |
395 | Data->SMSC->Validity.Format = SMS_Validity_RelativeFormat; | 398 | Data->SMSC->Validity.Format = SMS_Validity_RelativeFormat; |
396 | Data->SMSC->Validity.Relative= msg.Buffer[8]; | 399 | Data->SMSC->Validity.Relative= msg.Buffer[8]; |
400 | if (msg.Buffer[8] == 0x00) Data->SMSC->Validity.Relative = SMS_VALID_Max_Time; | ||
397 | 401 | ||
398 | i=33; | 402 | i=33; |
399 | while (msg.Buffer[i]!=0) {i++;} | 403 | while (msg.Buffer[i]!=0) {i++;} |
400 | i=i-33; | 404 | i=i-33; |
401 | if (i>GSM_MAX_SMSC_NAME_LENGTH) { | 405 | if (i>GSM_MAX_SMSC_NAME_LENGTH) { |
402 | smprintf(s, "Too long name\n"); | 406 | smprintf(s, "Too long name\n"); |
403 | return ERR_UNKNOWNRESPONSE; | 407 | return ERR_UNKNOWNRESPONSE; |
404 | } | 408 | } |
405 | EncodeUnicode(Data->SMSC->Name,msg.Buffer+33,i); | 409 | EncodeUnicode(Data->SMSC->Name,msg.Buffer+33,i); |
406 | smprintf(s, "Name \"%s\"\n", DecodeUnicodeString(Data->SMSC->Name)); | 410 | smprintf(s, "Name \"%s\"\n", DecodeUnicodeString(Data->SMSC->Name)); |
407 | 411 | ||
408 | GSM_UnpackSemiOctetNumber(Data->SMSC->DefaultNumber,msg.Buffer+9,true); | 412 | GSM_UnpackSemiOctetNumber(Data->SMSC->DefaultNumber,msg.Buffer+9,true); |
@@ -450,26 +454,26 @@ GSM_Error DCT3_ReplyGetNetworkInfo(GSM_Protocol_Message msg, GSM_StateMachine *s | |||
450 | case 0x04: smprintf(s, "not registered in the network");break; | 454 | case 0x04: smprintf(s, "not registered in the network");break; |
451 | default : smprintf(s, "unknown"); | 455 | default : smprintf(s, "unknown"); |
452 | } | 456 | } |
453 | smprintf(s, "\n"); | 457 | smprintf(s, "\n"); |
454 | smprintf(s, "Network selection : %s\n", msg.Buffer[9]==1?"manual":"automatic"); | 458 | smprintf(s, "Network selection : %s\n", msg.Buffer[9]==1?"manual":"automatic"); |
455 | if (msg.Buffer[8]<0x03) { | 459 | if (msg.Buffer[8]<0x03) { |
456 | sprintf(NetInfo.CID, "%02x%02x", msg.Buffer[10], msg.Buffer[11]); | 460 | sprintf(NetInfo.CID, "%02x%02x", msg.Buffer[10], msg.Buffer[11]); |
457 | smprintf(s, "CID : %s\n", NetInfo.CID); | 461 | smprintf(s, "CID : %s\n", NetInfo.CID); |
458 | 462 | ||
459 | sprintf(NetInfo.LAC, "%02x%02x", msg.Buffer[12], msg.Buffer[13]); | 463 | sprintf(NetInfo.LAC, "%02x%02x", msg.Buffer[12], msg.Buffer[13]); |
460 | smprintf(s, "LAC : %s\n", NetInfo.LAC); | 464 | smprintf(s, "LAC : %s\n", NetInfo.LAC); |
461 | 465 | ||
462 | smprintf(s, "Network code : %s\n", NetInfo.NetworkCode); | ||
463 | NOKIA_DecodeNetworkCode(msg.Buffer+14,NetInfo.NetworkCode); | 466 | NOKIA_DecodeNetworkCode(msg.Buffer+14,NetInfo.NetworkCode); |
467 | smprintf(s, "Network code : %s\n", NetInfo.NetworkCode); | ||
464 | smprintf(s, "Network name for Gammu : %s ", | 468 | smprintf(s, "Network name for Gammu : %s ", |
465 | DecodeUnicodeString(GSM_GetNetworkName(NetInfo.NetworkCode))); | 469 | DecodeUnicodeString(GSM_GetNetworkName(NetInfo.NetworkCode))); |
466 | smprintf(s, "(%s)\n",DecodeUnicodeString(GSM_GetCountryName(NetInfo.NetworkCode))); | 470 | smprintf(s, "(%s)\n",DecodeUnicodeString(GSM_GetCountryName(NetInfo.NetworkCode))); |
467 | 471 | ||
468 | if (msg.Length>18) { | 472 | if (msg.Length>18) { |
469 | if (msg.Buffer[18]==0x00) { | 473 | if (msg.Buffer[18]==0x00) { |
470 | /* In 6210 name is in "normal" Unicode */ | 474 | /* In 6210 name is in "normal" Unicode */ |
471 | memcpy(name,msg.Buffer+18,msg.Buffer[17]*2); | 475 | memcpy(name,msg.Buffer+18,msg.Buffer[17]*2); |
472 | name[msg.Buffer[17]*2]=0x00; | 476 | name[msg.Buffer[17]*2]=0x00; |
473 | name[msg.Buffer[17]*2+1]=0x00; | 477 | name[msg.Buffer[17]*2+1]=0x00; |
474 | smprintf(s, "Network name for phone : %s\n",DecodeUnicodeString(name)); | 478 | smprintf(s, "Network name for phone : %s\n",DecodeUnicodeString(name)); |
475 | } else { | 479 | } else { |
@@ -1199,29 +1203,29 @@ GSM_Error DCT3_SetWAPSettings(GSM_StateMachine *s, GSM_MultiWAPSettings *setting | |||
1199 | } | 1203 | } |
1200 | error = DCT3DCT4_SetActiveConnectSet(s, settings); | 1204 | error = DCT3DCT4_SetActiveConnectSet(s, settings); |
1201 | if (error != ERR_NONE) return error; | 1205 | if (error != ERR_NONE) return error; |
1202 | 1206 | ||
1203 | return DCT3DCT4_DisableConnectionFunctions(s); | 1207 | return DCT3DCT4_DisableConnectionFunctions(s); |
1204 | } | 1208 | } |
1205 | 1209 | ||
1206 | GSM_Error DCT3_ReplySendSMSMessage(GSM_Protocol_Message msg, GSM_StateMachine *s) | 1210 | GSM_Error DCT3_ReplySendSMSMessage(GSM_Protocol_Message msg, GSM_StateMachine *s) |
1207 | { | 1211 | { |
1208 | switch (msg.Buffer[3]) { | 1212 | switch (msg.Buffer[3]) { |
1209 | case 0x02: | 1213 | case 0x02: |
1210 | smprintf(s, "SMS sent OK\n"); | 1214 | smprintf(s, "SMS sent OK\n"); |
1211 | if (s->User.SendSMSStatus!=NULL) s->User.SendSMSStatus(s->CurrentConfig->Device,0,0); | 1215 | if (s->User.SendSMSStatus!=NULL) s->User.SendSMSStatus(s->CurrentConfig->Device,0,msg.Buffer[5]); |
1212 | return ERR_NONE; | 1216 | return ERR_NONE; |
1213 | case 0x03: | 1217 | case 0x03: |
1214 | smprintf(s, "Error %i\n",msg.Buffer[6]); | 1218 | smprintf(s, "Error %i\n",msg.Buffer[6]); |
1215 | if (s->User.SendSMSStatus!=NULL) s->User.SendSMSStatus(s->CurrentConfig->Device,msg.Buffer[6],0); | 1219 | if (s->User.SendSMSStatus!=NULL) s->User.SendSMSStatus(s->CurrentConfig->Device,msg.Buffer[6],-1); |
1216 | return ERR_NONE; | 1220 | return ERR_NONE; |
1217 | } | 1221 | } |
1218 | return ERR_UNKNOWNRESPONSE; | 1222 | return ERR_UNKNOWNRESPONSE; |
1219 | } | 1223 | } |
1220 | 1224 | ||
1221 | GSM_Error DCT3_SendSMSMessage(GSM_StateMachine *s, GSM_SMSMessage *sms) | 1225 | GSM_Error DCT3_SendSMSMessage(GSM_StateMachine *s, GSM_SMSMessage *sms) |
1222 | { | 1226 | { |
1223 | int length; | 1227 | int length; |
1224 | GSM_Error error; | 1228 | GSM_Error error; |
1225 | unsigned char req[256] = {N6110_FRAME_HEADER, 0x01, 0x02, 0x00}; | 1229 | unsigned char req[256] = {N6110_FRAME_HEADER, 0x01, 0x02, 0x00}; |
1226 | 1230 | ||
1227 | error=PHONE_EncodeSMSFrame(s,sms,req+6,PHONE_SMSSubmit,&length, true); | 1231 | error=PHONE_EncodeSMSFrame(s,sms,req+6,PHONE_SMSSubmit,&length, true); |
diff --git a/gammu/emb/common/phone/nokia/dct3/dct3func.h b/gammu/emb/common/phone/nokia/dct3/dct3func.h index 66b67ec..18b2026 100644 --- a/gammu/emb/common/phone/nokia/dct3/dct3func.h +++ b/gammu/emb/common/phone/nokia/dct3/dct3func.h | |||
@@ -1,17 +1,19 @@ | |||
1 | /* (c) 2002-2003 by Marcin Wiacek */ | 1 | /* (c) 2002-2003 by Marcin Wiacek */ |
2 | 2 | ||
3 | #ifndef phone_nokia_dct3_h | 3 | #ifndef phone_nokia_dct3_h |
4 | #define phone_nokia_dct3_h | 4 | #define phone_nokia_dct3_h |
5 | 5 | ||
6 | #include "../ncommon.h" | ||
7 | |||
6 | GSM_Error DCT3_ReplyPressKey (GSM_Protocol_Message msg, GSM_StateMachine *s); | 8 | GSM_Error DCT3_ReplyPressKey (GSM_Protocol_Message msg, GSM_StateMachine *s); |
7 | GSM_Error DCT3_ReplyPlayTone (GSM_Protocol_Message msg, GSM_StateMachine *s); | 9 | GSM_Error DCT3_ReplyPlayTone (GSM_Protocol_Message msg, GSM_StateMachine *s); |
8 | GSM_Error DCT3_ReplyEnableSecurity(GSM_Protocol_Message msg, GSM_StateMachine *s); | 10 | GSM_Error DCT3_ReplyEnableSecurity(GSM_Protocol_Message msg, GSM_StateMachine *s); |
9 | GSM_Error DCT3_ReplyGetIMEI (GSM_Protocol_Message msg, GSM_StateMachine *s); | 11 | GSM_Error DCT3_ReplyGetIMEI (GSM_Protocol_Message msg, GSM_StateMachine *s); |
10 | GSM_Error DCT3_ReplyGetSMSC (GSM_Protocol_Message msg, GSM_StateMachine *s); | 12 | GSM_Error DCT3_ReplyGetSMSC (GSM_Protocol_Message msg, GSM_StateMachine *s); |
11 | GSM_Error DCT3_ReplySIMLogin (GSM_Protocol_Message msg, GSM_StateMachine *s); | 13 | GSM_Error DCT3_ReplySIMLogin (GSM_Protocol_Message msg, GSM_StateMachine *s); |
12 | GSM_Error DCT3_ReplySIMLogout (GSM_Protocol_Message msg, GSM_StateMachine *s); | 14 | GSM_Error DCT3_ReplySIMLogout (GSM_Protocol_Message msg, GSM_StateMachine *s); |
13 | GSM_Error DCT3_ReplyGetDateTime (GSM_Protocol_Message msg, GSM_StateMachine *s); | 15 | GSM_Error DCT3_ReplyGetDateTime (GSM_Protocol_Message msg, GSM_StateMachine *s); |
14 | GSM_Error DCT3_ReplyGetAlarm (GSM_Protocol_Message msg, GSM_StateMachine *s); | 16 | GSM_Error DCT3_ReplyGetAlarm (GSM_Protocol_Message msg, GSM_StateMachine *s); |
15 | GSM_Error DCT3_ReplySetDateTime (GSM_Protocol_Message msg, GSM_StateMachine *s); | 17 | GSM_Error DCT3_ReplySetDateTime (GSM_Protocol_Message msg, GSM_StateMachine *s); |
16 | GSM_Error DCT3_ReplySetAlarm (GSM_Protocol_Message msg, GSM_StateMachine *s); | 18 | GSM_Error DCT3_ReplySetAlarm (GSM_Protocol_Message msg, GSM_StateMachine *s); |
17 | GSM_Error DCT3_ReplyDialCommand (GSM_Protocol_Message msg, GSM_StateMachine *s); | 19 | GSM_Error DCT3_ReplyDialCommand (GSM_Protocol_Message msg, GSM_StateMachine *s); |
diff --git a/gammu/emb/common/phone/nokia/dct3/n6110.c b/gammu/emb/common/phone/nokia/dct3/n6110.c index 263d12b..dac6c12 100644 --- a/gammu/emb/common/phone/nokia/dct3/n6110.c +++ b/gammu/emb/common/phone/nokia/dct3/n6110.c | |||
@@ -1,16 +1,18 @@ | |||
1 | /* (c) 2001-2004 by Marcin Wiacek */ | 1 | /* (c) 2001-2004 by Marcin Wiacek */ |
2 | /* based on some work from Markus Plail and Gnokii */ | ||
3 | /* Authentication function (c) 1999 or earlier by Pavel Janik */ | ||
4 | /* 5210 calendar IDs by Frederick Ros */ | 2 | /* 5210 calendar IDs by Frederick Ros */ |
3 | /* based on some Markus Plail, Pavel Janik & others work from Gnokii (www.gnokii.org) | ||
4 | * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot | ||
5 | * GNU GPL version 2 or later | ||
6 | */ | ||
5 | 7 | ||
6 | #include "../../../gsmstate.h" | 8 | #include "../../../gsmstate.h" |
7 | 9 | ||
8 | #ifdef GSM_ENABLE_NOKIA6110 | 10 | #ifdef GSM_ENABLE_NOKIA6110 |
9 | 11 | ||
10 | #include <string.h> | 12 | #include <string.h> |
11 | 13 | ||
12 | #include "../../../../cfg/config.h" | 14 | #include "../../../../cfg/config.h" |
13 | #include "../../../misc/coding/coding.h" | 15 | #include "../../../misc/coding/coding.h" |
14 | #include "../../../service/sms/gsmsms.h" | 16 | #include "../../../service/sms/gsmsms.h" |
15 | #include "../../../gsmcomon.h" | 17 | #include "../../../gsmcomon.h" |
16 | #include "../../pfunc.h" | 18 | #include "../../pfunc.h" |
@@ -118,24 +120,25 @@ static void N6110_EncodeUnicode(GSM_StateMachine *s, unsigned char *dest, const | |||
118 | if (!found) { | 120 | if (!found) { |
119 | i_len += EncodeWithUnicodeAlphabet(&src[i_len], &wc); | 121 | i_len += EncodeWithUnicodeAlphabet(&src[i_len], &wc); |
120 | dest[o_len*2] = (wc >> 8) & 0xff; | 122 | dest[o_len*2] = (wc >> 8) & 0xff; |
121 | dest[(o_len*2)+1] = wc & 0xff; | 123 | dest[(o_len*2)+1] = wc & 0xff; |
122 | } | 124 | } |
123 | } | 125 | } |
124 | dest[o_len*2] = 0; | 126 | dest[o_len*2] = 0; |
125 | dest[(o_len*2)+1] = 0; | 127 | dest[(o_len*2)+1] = 0; |
126 | } | 128 | } |
127 | 129 | ||
128 | #ifndef ENABLE_LGPL | 130 | #ifndef ENABLE_LGPL |
129 | 131 | ||
132 | /* Pavel Janik */ | ||
130 | /* This function provides Nokia authentication protocol. | 133 | /* This function provides Nokia authentication protocol. |
131 | * Nokia authentication protocol is used in the communication between Nokia | 134 | * Nokia authentication protocol is used in the communication between Nokia |
132 | * mobile phones (e.g. Nokia 6110) and Nokia Cellular Data Suite software, | 135 | * mobile phones (e.g. Nokia 6110) and Nokia Cellular Data Suite software, |
133 | * commercially sold by Nokia Corp. | 136 | * commercially sold by Nokia Corp. |
134 | * The authentication scheme is based on the token send by the phone to the | 137 | * The authentication scheme is based on the token send by the phone to the |
135 | * software. The software does it's magic (see the function | 138 | * software. The software does it's magic (see the function |
136 | * N6110_GetNokiaAuthentication) and returns the result back to the phone. | 139 | * N6110_GetNokiaAuthentication) and returns the result back to the phone. |
137 | * If the result is correct the phone responds with the message "Accessory | 140 | * If the result is correct the phone responds with the message "Accessory |
138 | * connected!" displayed on the LCD. Otherwise it will display "Accessory not | 141 | * connected!" displayed on the LCD. Otherwise it will display "Accessory not |
139 | * supported" and some functions will not be available for use (?). | 142 | * supported" and some functions will not be available for use (?). |
140 | * The specification of the protocol is not publicly available, no comment. | 143 | * The specification of the protocol is not publicly available, no comment. |
141 | */ | 144 | */ |
@@ -815,24 +818,25 @@ static GSM_Error N6110_SetRingtone(GSM_StateMachine *s, GSM_Ringtone *Ringtone, | |||
815 | memcpy(reqBin+current,DecodeUnicodeString(Ringtone->Name),UnicodeLength(Ringtone->Name)); | 818 | memcpy(reqBin+current,DecodeUnicodeString(Ringtone->Name),UnicodeLength(Ringtone->Name)); |
816 | current += UnicodeLength(Ringtone->Name); | 819 | current += UnicodeLength(Ringtone->Name); |
817 | reqBin[current++] = 0x00; | 820 | reqBin[current++] = 0x00; |
818 | reqBin[current++] = 0x00; | 821 | reqBin[current++] = 0x00; |
819 | reqBin[current++] = 0x00;/*xxx*/ | 822 | reqBin[current++] = 0x00;/*xxx*/ |
820 | memcpy(reqBin+current,Ringtone->NokiaBinary.Frame,Ringtone->NokiaBinary.Length); | 823 | memcpy(reqBin+current,Ringtone->NokiaBinary.Frame,Ringtone->NokiaBinary.Length); |
821 | current=current+Ringtone->NokiaBinary.Length; | 824 | current=current+Ringtone->NokiaBinary.Length; |
822 | reqBin[3]=Ringtone->Location-1; | 825 | reqBin[3]=Ringtone->Location-1; |
823 | if (!strcmp(s->Phone.Data.ModelInfo->model,"3210")) reqBin[5]=0x10; | 826 | if (!strcmp(s->Phone.Data.ModelInfo->model,"3210")) reqBin[5]=0x10; |
824 | smprintf(s, "Setting binary ringtone\n"); | 827 | smprintf(s, "Setting binary ringtone\n"); |
825 | return GSM_WaitFor (s, reqBin, current, 0x40, 4, ID_SetRingtone); | 828 | return GSM_WaitFor (s, reqBin, current, 0x40, 4, ID_SetRingtone); |
826 | case RING_MIDI: | 829 | case RING_MIDI: |
830 | case RING_MMF: | ||
827 | return ERR_NOTSUPPORTED; | 831 | return ERR_NOTSUPPORTED; |
828 | } | 832 | } |
829 | return ERR_NOTSUPPORTED; | 833 | return ERR_NOTSUPPORTED; |
830 | } | 834 | } |
831 | 835 | ||
832 | static GSM_Error N6110_ReplyGetOpLogo(GSM_Protocol_Message msg, GSM_StateMachine *s) | 836 | static GSM_Error N6110_ReplyGetOpLogo(GSM_Protocol_Message msg, GSM_StateMachine *s) |
833 | { | 837 | { |
834 | int count=5; | 838 | int count=5; |
835 | GSM_Phone_Data *Data = &s->Phone.Data; | 839 | GSM_Phone_Data *Data = &s->Phone.Data; |
836 | 840 | ||
837 | smprintf(s, "Operator logo received\n"); | 841 | smprintf(s, "Operator logo received\n"); |
838 | NOKIA_DecodeNetworkCode(msg.Buffer+count,Data->Bitmap->NetworkCode); | 842 | NOKIA_DecodeNetworkCode(msg.Buffer+count,Data->Bitmap->NetworkCode); |
@@ -1515,24 +1519,25 @@ static GSM_Error N6110_ReplyGetRingtone(GSM_Protocol_Message msg, GSM_StateMachi | |||
1515 | } | 1519 | } |
1516 | i++; | 1520 | i++; |
1517 | if (i==msg.Length-3) return ERR_EMPTY; | 1521 | if (i==msg.Length-3) return ERR_EMPTY; |
1518 | } | 1522 | } |
1519 | /* Copying frame */ | 1523 | /* Copying frame */ |
1520 | memcpy(Data->Ringtone->NokiaBinary.Frame,msg.Buffer+start,end-start); | 1524 | memcpy(Data->Ringtone->NokiaBinary.Frame,msg.Buffer+start,end-start); |
1521 | Data->Ringtone->NokiaBinary.Length=end-start; | 1525 | Data->Ringtone->NokiaBinary.Length=end-start; |
1522 | #ifdef DEBUG | 1526 | #ifdef DEBUG |
1523 | if (di.dl == DL_TEXTALL || di.dl == DL_TEXTALLDATE) DumpMessage(di.df, di.dl, Data->Ringtone->NokiaBinary.Frame, Data->Ringtone->NokiaBinary.Length); | 1527 | if (di.dl == DL_TEXTALL || di.dl == DL_TEXTALLDATE) DumpMessage(di.df, di.dl, Data->Ringtone->NokiaBinary.Frame, Data->Ringtone->NokiaBinary.Length); |
1524 | #endif | 1528 | #endif |
1525 | return ERR_NONE; | 1529 | return ERR_NONE; |
1526 | case RING_MIDI: | 1530 | case RING_MIDI: |
1531 | case RING_MMF: | ||
1527 | return ERR_NOTSUPPORTED; | 1532 | return ERR_NOTSUPPORTED; |
1528 | } | 1533 | } |
1529 | smprintf(s, "Ringtone format is %i\n",Data->Ringtone->Format); | 1534 | smprintf(s, "Ringtone format is %i\n",Data->Ringtone->Format); |
1530 | break; | 1535 | break; |
1531 | default: | 1536 | default: |
1532 | smprintf(s, "Invalid location. Too high ?\n"); | 1537 | smprintf(s, "Invalid location. Too high ?\n"); |
1533 | return ERR_INVALIDLOCATION; | 1538 | return ERR_INVALIDLOCATION; |
1534 | } | 1539 | } |
1535 | return ERR_UNKNOWNRESPONSE; | 1540 | return ERR_UNKNOWNRESPONSE; |
1536 | } | 1541 | } |
1537 | 1542 | ||
1538 | static GSM_Error N6110_GetRingtone(GSM_StateMachine *s, GSM_Ringtone *Ringtone, bool PhoneRingtone) | 1543 | static GSM_Error N6110_GetRingtone(GSM_StateMachine *s, GSM_Ringtone *Ringtone, bool PhoneRingtone) |
@@ -1552,24 +1557,25 @@ static GSM_Error N6110_GetRingtone(GSM_StateMachine *s, GSM_Ringtone *Ringtone, | |||
1552 | Ringtone->Format = RING_NOKIABINARY; | 1557 | Ringtone->Format = RING_NOKIABINARY; |
1553 | } | 1558 | } |
1554 | } | 1559 | } |
1555 | 1560 | ||
1556 | switch (Ringtone->Format) { | 1561 | switch (Ringtone->Format) { |
1557 | case RING_NOTETONE: | 1562 | case RING_NOTETONE: |
1558 | if (!IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo,F_RING_SM)) return ERR_NOTSUPPORTED; | 1563 | if (!IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo,F_RING_SM)) return ERR_NOTSUPPORTED; |
1559 | break; | 1564 | break; |
1560 | case RING_NOKIABINARY: | 1565 | case RING_NOKIABINARY: |
1561 | if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo,F_RING_SM)) return ERR_NOTSUPPORTED; | 1566 | if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo,F_RING_SM)) return ERR_NOTSUPPORTED; |
1562 | break; | 1567 | break; |
1563 | case RING_MIDI: | 1568 | case RING_MIDI: |
1569 | case RING_MMF: | ||
1564 | return ERR_NOTSUPPORTED; | 1570 | return ERR_NOTSUPPORTED; |
1565 | } | 1571 | } |
1566 | 1572 | ||
1567 | error=DCT3_EnableSecurity (s, 0x01); | 1573 | error=DCT3_EnableSecurity (s, 0x01); |
1568 | if (error!=ERR_NONE) return error; | 1574 | if (error!=ERR_NONE) return error; |
1569 | 1575 | ||
1570 | req[3]=Ringtone->Location-1; | 1576 | req[3]=Ringtone->Location-1; |
1571 | s->Phone.Data.Ringtone=Ringtone; | 1577 | s->Phone.Data.Ringtone=Ringtone; |
1572 | smprintf(s, "Getting (binary) ringtone\n"); | 1578 | smprintf(s, "Getting (binary) ringtone\n"); |
1573 | return GSM_WaitFor (s, req, 4, 0x40, 4, ID_GetRingtone); | 1579 | return GSM_WaitFor (s, req, 4, 0x40, 4, ID_GetRingtone); |
1574 | } | 1580 | } |
1575 | 1581 | ||
@@ -2434,26 +2440,26 @@ static GSM_Error N6110_GetNextCalendarNote(GSM_StateMachine *s, GSM_CalendarEntr | |||
2434 | if (error == ERR_NONE && Note->Entries[Time].Date.Year == 2090) { | 2440 | if (error == ERR_NONE && Note->Entries[Time].Date.Year == 2090) { |
2435 | error=N6110_GetDateTime(s, &date_time); | 2441 | error=N6110_GetDateTime(s, &date_time); |
2436 | if (error == ERR_NONE) Note->Entries[Time].Date.Year = date_time.Year; | 2442 | if (error == ERR_NONE) Note->Entries[Time].Date.Year = date_time.Year; |
2437 | } | 2443 | } |
2438 | return error; | 2444 | return error; |
2439 | } | 2445 | } |
2440 | 2446 | ||
2441 | GSM_Error N6110_ReplyUSSDInfo(GSM_Protocol_Message msg, GSM_StateMachine *s) | 2447 | GSM_Error N6110_ReplyUSSDInfo(GSM_Protocol_Message msg, GSM_StateMachine *s) |
2442 | { | 2448 | { |
2443 | unsigned char buffer[2000],buffer2[4000]; | 2449 | unsigned char buffer[2000],buffer2[4000]; |
2444 | int tmp; | 2450 | int tmp; |
2445 | 2451 | ||
2446 | tmp=GSM_UnpackEightBitsToSeven(0, 82, 82, msg.Buffer+8, buffer); | 2452 | tmp=GSM_UnpackEightBitsToSeven(0, msg.Buffer[7], 82, msg.Buffer+8, buffer); |
2447 | msg.Buffer[tmp] = 0; | 2453 | buffer[tmp] = 0; |
2448 | 2454 | ||
2449 | smprintf(s, "USSD reply: \"%s\"\n",buffer); | 2455 | smprintf(s, "USSD reply: \"%s\"\n",buffer); |
2450 | 2456 | ||
2451 | if (s->Phone.Data.EnableIncomingUSSD && s->User.IncomingUSSD!=NULL) { | 2457 | if (s->Phone.Data.EnableIncomingUSSD && s->User.IncomingUSSD!=NULL) { |
2452 | EncodeUnicode(buffer2,buffer,strlen(buffer)); | 2458 | EncodeUnicode(buffer2,buffer,strlen(buffer)); |
2453 | s->User.IncomingUSSD(s->CurrentConfig->Device, buffer2); | 2459 | s->User.IncomingUSSD(s->CurrentConfig->Device, buffer2); |
2454 | } | 2460 | } |
2455 | 2461 | ||
2456 | return ERR_NONE; | 2462 | return ERR_NONE; |
2457 | } | 2463 | } |
2458 | 2464 | ||
2459 | GSM_Error N6110_AnswerCall(GSM_StateMachine *s, int ID, bool all) | 2465 | GSM_Error N6110_AnswerCall(GSM_StateMachine *s, int ID, bool all) |
@@ -2798,24 +2804,25 @@ GSM_Phone_Functions N6110Phone = { | |||
2798 | N6110_GetSpeedDial, | 2804 | N6110_GetSpeedDial, |
2799 | NOTIMPLEMENTED, /* SetSpeedDial */ | 2805 | NOTIMPLEMENTED, /* SetSpeedDial */ |
2800 | DCT3_GetSMSC, | 2806 | DCT3_GetSMSC, |
2801 | DCT3_SetSMSC, | 2807 | DCT3_SetSMSC, |
2802 | DCT3_GetSMSStatus, | 2808 | DCT3_GetSMSStatus, |
2803 | N6110_GetSMSMessage, | 2809 | N6110_GetSMSMessage, |
2804 | N6110_GetNextSMSMessage, | 2810 | N6110_GetNextSMSMessage, |
2805 | N6110_SetSMS, | 2811 | N6110_SetSMS, |
2806 | N6110_AddSMS, | 2812 | N6110_AddSMS, |
2807 | N6110_DeleteSMSMessage, | 2813 | N6110_DeleteSMSMessage, |
2808 | DCT3_SendSMSMessage, | 2814 | DCT3_SendSMSMessage, |
2809 | NOTSUPPORTED, /* SendSavedSMS */ | 2815 | NOTSUPPORTED, /* SendSavedSMS */ |
2816 | NOTSUPPORTED, /* SetFastSMSSending*/ | ||
2810 | NOKIA_SetIncomingSMS, | 2817 | NOKIA_SetIncomingSMS, |
2811 | DCT3_SetIncomingCB, | 2818 | DCT3_SetIncomingCB, |
2812 | PHONE_GetSMSFolders, | 2819 | PHONE_GetSMSFolders, |
2813 | NOTSUPPORTED, /* AddSMSFolder */ | 2820 | NOTSUPPORTED, /* AddSMSFolder */ |
2814 | NOTSUPPORTED, /* DeleteSMSFolder */ | 2821 | NOTSUPPORTED, /* DeleteSMSFolder */ |
2815 | N6110_DialVoice, | 2822 | N6110_DialVoice, |
2816 | N6110_AnswerCall, | 2823 | N6110_AnswerCall, |
2817 | DCT3_CancelCall, | 2824 | DCT3_CancelCall, |
2818 | N6110_HoldCall, | 2825 | N6110_HoldCall, |
2819 | N6110_UnholdCall, | 2826 | N6110_UnholdCall, |
2820 | N6110_ConferenceCall, | 2827 | N6110_ConferenceCall, |
2821 | N6110_SplitCall, | 2828 | N6110_SplitCall, |
@@ -2852,25 +2859,25 @@ GSM_Phone_Functions N6110Phone = { | |||
2852 | NOTSUPPORTED, /* AddToDo */ | 2859 | NOTSUPPORTED, /* AddToDo */ |
2853 | NOTSUPPORTED, /* DeleteToDo */ | 2860 | NOTSUPPORTED, /* DeleteToDo */ |
2854 | NOTSUPPORTED, /* DeleteAllToDo */ | 2861 | NOTSUPPORTED, /* DeleteAllToDo */ |
2855 | NOTIMPLEMENTED, /* GetCalendarStatus */ | 2862 | NOTIMPLEMENTED, /* GetCalendarStatus */ |
2856 | NOTIMPLEMENTED, /* GetCalendar */ | 2863 | NOTIMPLEMENTED, /* GetCalendar */ |
2857 | N6110_GetNextCalendarNote, | 2864 | N6110_GetNextCalendarNote, |
2858 | NOTIMPLEMENTED, /* SetCalendar */ | 2865 | NOTIMPLEMENTED, /* SetCalendar */ |
2859 | N6110_AddCalendarNote, | 2866 | N6110_AddCalendarNote, |
2860 | N6110_DeleteCalendarNote, | 2867 | N6110_DeleteCalendarNote, |
2861 | NOTIMPLEMENTED, /* DeleteAllCalendar */ | 2868 | NOTIMPLEMENTED, /* DeleteAllCalendar */ |
2862 | NOTSUPPORTED, /* GetCalendarSettings */ | 2869 | NOTSUPPORTED, /* GetCalendarSettings */ |
2863 | NOTSUPPORTED, /* SetCalendarSettings */ | 2870 | NOTSUPPORTED, /* SetCalendarSettings */ |
2864 | NOTSUPPORTED, /* GetNote */ | 2871 | NOTSUPPORTED, /* GetNextNote */ |
2865 | N6110_GetProfile, | 2872 | N6110_GetProfile, |
2866 | N6110_SetProfile, | 2873 | N6110_SetProfile, |
2867 | NOTSUPPORTED, /* GetFMStation */ | 2874 | NOTSUPPORTED, /* GetFMStation */ |
2868 | NOTSUPPORTED, /* SetFMStation */ | 2875 | NOTSUPPORTED, /* SetFMStation */ |
2869 | NOTSUPPORTED, /* ClearFMStations */ | 2876 | NOTSUPPORTED, /* ClearFMStations */ |
2870 | NOTSUPPORTED, /* GetNextFileFolder */ | 2877 | NOTSUPPORTED, /* GetNextFileFolder */ |
2871 | NOTSUPPORTED, /* GetFilePart */ | 2878 | NOTSUPPORTED, /* GetFilePart */ |
2872 | NOTSUPPORTED, /* AddFile */ | 2879 | NOTSUPPORTED, /* AddFile */ |
2873 | NOTSUPPORTED, /* GetFileSystemStatus */ | 2880 | NOTSUPPORTED, /* GetFileSystemStatus */ |
2874 | NOTSUPPORTED, /* DeleteFile */ | 2881 | NOTSUPPORTED, /* DeleteFile */ |
2875 | NOTSUPPORTED, /* AddFolder */ | 2882 | NOTSUPPORTED, /* AddFolder */ |
2876 | NOTSUPPORTED, /* GetGPRSAccessPoint */ | 2883 | NOTSUPPORTED, /* GetGPRSAccessPoint */ |
diff --git a/gammu/emb/common/phone/nokia/dct3/n7110.c b/gammu/emb/common/phone/nokia/dct3/n7110.c index 5a02c9c..b597f9b 100644 --- a/gammu/emb/common/phone/nokia/dct3/n7110.c +++ b/gammu/emb/common/phone/nokia/dct3/n7110.c | |||
@@ -1,14 +1,17 @@ | |||
1 | /* (c) 2001-2004 by Marcin Wiacek */ | 1 | /* (c) 2001-2004 by Marcin Wiacek */ |
2 | /* based on some work from Markus Plail and Gnokii */ | 2 | /* based on some Markus Plail work from Gnokii (www.gnokii.org) |
3 | * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot | ||
4 | * GNU GPL version 2 or later | ||
5 | */ | ||
3 | 6 | ||
4 | #include "../../../gsmstate.h" | 7 | #include "../../../gsmstate.h" |
5 | 8 | ||
6 | #ifdef GSM_ENABLE_NOKIA7110 | 9 | #ifdef GSM_ENABLE_NOKIA7110 |
7 | 10 | ||
8 | #include <string.h> | 11 | #include <string.h> |
9 | #include <time.h> | 12 | #include <time.h> |
10 | 13 | ||
11 | #include "../../../misc/coding/coding.h" | 14 | #include "../../../misc/coding/coding.h" |
12 | #include "../../../gsmcomon.h" | 15 | #include "../../../gsmcomon.h" |
13 | #include "../../../service/gsmlogo.h" | 16 | #include "../../../service/gsmlogo.h" |
14 | #include "../../pfunc.h" | 17 | #include "../../pfunc.h" |
@@ -517,24 +520,25 @@ static GSM_Error N7110_GetRingtone(GSM_StateMachine *s, GSM_Ringtone *Ringtone, | |||
517 | if (Ringtone->Format == 0x00) Ringtone->Format = RING_NOKIABINARY; | 520 | if (Ringtone->Format == 0x00) Ringtone->Format = RING_NOKIABINARY; |
518 | 521 | ||
519 | switch (Ringtone->Format) { | 522 | switch (Ringtone->Format) { |
520 | case RING_NOTETONE: | 523 | case RING_NOTETONE: |
521 | /* In the future get binary and convert */ | 524 | /* In the future get binary and convert */ |
522 | return ERR_NOTSUPPORTED; | 525 | return ERR_NOTSUPPORTED; |
523 | case RING_NOKIABINARY: | 526 | case RING_NOKIABINARY: |
524 | req[5]=N7110_ReturnBinaryRingtoneLocation(s->Phone.Data.Model)+Ringtone->Location; | 527 | req[5]=N7110_ReturnBinaryRingtoneLocation(s->Phone.Data.Model)+Ringtone->Location; |
525 | s->Phone.Data.Ringtone=Ringtone; | 528 | s->Phone.Data.Ringtone=Ringtone; |
526 | smprintf(s, "Getting binary ringtone\n"); | 529 | smprintf(s, "Getting binary ringtone\n"); |
527 | return GSM_WaitFor (s, req, 6, 0x1f, 4, ID_GetRingtone); | 530 | return GSM_WaitFor (s, req, 6, 0x1f, 4, ID_GetRingtone); |
528 | case RING_MIDI: | 531 | case RING_MIDI: |
532 | case RING_MMF: | ||
529 | return ERR_NOTSUPPORTED; | 533 | return ERR_NOTSUPPORTED; |
530 | } | 534 | } |
531 | return ERR_NOTSUPPORTED; | 535 | return ERR_NOTSUPPORTED; |
532 | } | 536 | } |
533 | 537 | ||
534 | static GSM_Error N7110_ReplyGetPictureImageInfo(GSM_Protocol_Message msg, GSM_StateMachine *s) | 538 | static GSM_Error N7110_ReplyGetPictureImageInfo(GSM_Protocol_Message msg, GSM_StateMachine *s) |
535 | { | 539 | { |
536 | int i; | 540 | int i; |
537 | GSM_Phone_N7110Data*Priv = &s->Phone.Data.Priv.N7110; | 541 | GSM_Phone_N7110Data*Priv = &s->Phone.Data.Priv.N7110; |
538 | 542 | ||
539 | smprintf(s, "Received info for Picture Images\n"); | 543 | smprintf(s, "Received info for Picture Images\n"); |
540 | smprintf(s, "Number : %i\n",msg.Buffer[4]*256+msg.Buffer[5]); | 544 | smprintf(s, "Number : %i\n",msg.Buffer[4]*256+msg.Buffer[5]); |
@@ -1638,24 +1642,25 @@ GSM_Phone_Functions N7110Phone = { | |||
1638 | N7110_GetSpeedDial, | 1642 | N7110_GetSpeedDial, |
1639 | NOTIMPLEMENTED, /* SetSpeedDial */ | 1643 | NOTIMPLEMENTED, /* SetSpeedDial */ |
1640 | DCT3_GetSMSC, | 1644 | DCT3_GetSMSC, |
1641 | DCT3_SetSMSC, | 1645 | DCT3_SetSMSC, |
1642 | N7110_GetSMSStatus, | 1646 | N7110_GetSMSStatus, |
1643 | N7110_GetSMSMessage, | 1647 | N7110_GetSMSMessage, |
1644 | N7110_GetNextSMSMessage, | 1648 | N7110_GetNextSMSMessage, |
1645 | N7110_SetSMS, | 1649 | N7110_SetSMS, |
1646 | N7110_AddSMS, | 1650 | N7110_AddSMS, |
1647 | N7110_DeleteSMS, | 1651 | N7110_DeleteSMS, |
1648 | DCT3_SendSMSMessage, | 1652 | DCT3_SendSMSMessage, |
1649 | NOTSUPPORTED, /* SendSavedSMS */ | 1653 | NOTSUPPORTED, /* SendSavedSMS */ |
1654 | NOTSUPPORTED, /* SetFastSMSSending*/ | ||
1650 | N7110_SetIncomingSMS, | 1655 | N7110_SetIncomingSMS, |
1651 | DCT3_SetIncomingCB, | 1656 | DCT3_SetIncomingCB, |
1652 | N7110_GetSMSFolders, | 1657 | N7110_GetSMSFolders, |
1653 | NOTIMPLEMENTED, /* AddSMSFolder */ | 1658 | NOTIMPLEMENTED, /* AddSMSFolder */ |
1654 | NOTIMPLEMENTED, /* DeleteSMSFolder */ | 1659 | NOTIMPLEMENTED, /* DeleteSMSFolder */ |
1655 | DCT3_DialVoice, | 1660 | DCT3_DialVoice, |
1656 | N7110_AnswerCall, | 1661 | N7110_AnswerCall, |
1657 | DCT3_CancelCall, | 1662 | DCT3_CancelCall, |
1658 | NOTIMPLEMENTED, /* HoldCall */ | 1663 | NOTIMPLEMENTED, /* HoldCall */ |
1659 | NOTIMPLEMENTED, /* UnholdCall */ | 1664 | NOTIMPLEMENTED, /* UnholdCall */ |
1660 | NOTIMPLEMENTED, /* ConferenceCall */ | 1665 | NOTIMPLEMENTED, /* ConferenceCall */ |
1661 | NOTIMPLEMENTED, /* SplitCall */ | 1666 | NOTIMPLEMENTED, /* SplitCall */ |
@@ -1692,25 +1697,25 @@ GSM_Phone_Functions N7110Phone = { | |||
1692 | NOTSUPPORTED, /* AddToDo */ | 1697 | NOTSUPPORTED, /* AddToDo */ |
1693 | NOTSUPPORTED, /* DeleteToDo */ | 1698 | NOTSUPPORTED, /* DeleteToDo */ |
1694 | NOTSUPPORTED, /* DeleteAllToDo */ | 1699 | NOTSUPPORTED, /* DeleteAllToDo */ |
1695 | N7110_GetCalendarStatus, | 1700 | N7110_GetCalendarStatus, |
1696 | NOTIMPLEMENTED, /* GetCalendar */ | 1701 | NOTIMPLEMENTED, /* GetCalendar */ |
1697 | N7110_GetNextCalendar, | 1702 | N7110_GetNextCalendar, |
1698 | NOTIMPLEMENTED, /* SetCalendar */ | 1703 | NOTIMPLEMENTED, /* SetCalendar */ |
1699 | N7110_AddCalendar, | 1704 | N7110_AddCalendar, |
1700 | N71_65_DelCalendar, | 1705 | N71_65_DelCalendar, |
1701 | NOTIMPLEMENTED, /* DeleteAllCalendar*/ | 1706 | NOTIMPLEMENTED, /* DeleteAllCalendar*/ |
1702 | NOTSUPPORTED, /* GetCalendarSettings*/ | 1707 | NOTSUPPORTED, /* GetCalendarSettings*/ |
1703 | NOTSUPPORTED, /* SetCalendarSettings*/ | 1708 | NOTSUPPORTED, /* SetCalendarSettings*/ |
1704 | NOTSUPPORTED, /* GetNote */ | 1709 | NOTSUPPORTED, /* GetNextNote */ |
1705 | N7110_GetProfile, | 1710 | N7110_GetProfile, |
1706 | N7110_SetProfile, | 1711 | N7110_SetProfile, |
1707 | NOTSUPPORTED, /* GetFMStation */ | 1712 | NOTSUPPORTED, /* GetFMStation */ |
1708 | NOTSUPPORTED, /* SetFMStation */ | 1713 | NOTSUPPORTED, /* SetFMStation */ |
1709 | NOTSUPPORTED, /* ClearFMStations */ | 1714 | NOTSUPPORTED, /* ClearFMStations */ |
1710 | NOTSUPPORTED, /* GetNextFileFolder*/ | 1715 | NOTSUPPORTED, /* GetNextFileFolder*/ |
1711 | NOTSUPPORTED, /* GetFilePart */ | 1716 | NOTSUPPORTED, /* GetFilePart */ |
1712 | NOTSUPPORTED, /* AddFile */ | 1717 | NOTSUPPORTED, /* AddFile */ |
1713 | NOTSUPPORTED, /* GetFileSystemStatus*/ | 1718 | NOTSUPPORTED, /* GetFileSystemStatus*/ |
1714 | NOTSUPPORTED, /* DeleteFile */ | 1719 | NOTSUPPORTED, /* DeleteFile */ |
1715 | NOTSUPPORTED, /* AddFolder */ | 1720 | NOTSUPPORTED, /* AddFolder */ |
1716 | NOTSUPPORTED, /* GetGPRSAccessPoint*/ | 1721 | NOTSUPPORTED, /* GetGPRSAccessPoint*/ |
diff --git a/gammu/emb/common/phone/nokia/dct3/n9210.c b/gammu/emb/common/phone/nokia/dct3/n9210.c index e82d530..ff71ad3 100644 --- a/gammu/emb/common/phone/nokia/dct3/n9210.c +++ b/gammu/emb/common/phone/nokia/dct3/n9210.c | |||
@@ -310,24 +310,25 @@ GSM_Phone_Functions N9210Phone = { | |||
310 | NOTIMPLEMENTED, /* GetSpeedDial */ | 310 | NOTIMPLEMENTED, /* GetSpeedDial */ |
311 | NOTIMPLEMENTED, /* SetSpeedDial */ | 311 | NOTIMPLEMENTED, /* SetSpeedDial */ |
312 | DCT3_GetSMSC, | 312 | DCT3_GetSMSC, |
313 | DCT3_SetSMSC, /* FIXME: test it */ | 313 | DCT3_SetSMSC, /* FIXME: test it */ |
314 | NOTIMPLEMENTED, /* GetSMSStatus */ | 314 | NOTIMPLEMENTED, /* GetSMSStatus */ |
315 | NOTIMPLEMENTED, /* GetSMS */ | 315 | NOTIMPLEMENTED, /* GetSMS */ |
316 | NOTIMPLEMENTED, /* GetNextSMS */ | 316 | NOTIMPLEMENTED, /* GetNextSMS */ |
317 | NOTIMPLEMENTED, /* SetSMS */ | 317 | NOTIMPLEMENTED, /* SetSMS */ |
318 | NOTIMPLEMENTED, /* AddSMS */ | 318 | NOTIMPLEMENTED, /* AddSMS */ |
319 | NOTIMPLEMENTED, /* DeleteSMS */ | 319 | NOTIMPLEMENTED, /* DeleteSMS */ |
320 | DCT3_SendSMSMessage, | 320 | DCT3_SendSMSMessage, |
321 | NOTSUPPORTED, /* SendSavedSMS */ | 321 | NOTSUPPORTED, /* SendSavedSMS */ |
322 | NOTSUPPORTED, /* SetFastSMSSending*/ | ||
322 | N9210_SetIncomingSMS, | 323 | N9210_SetIncomingSMS, |
323 | DCT3_SetIncomingCB, | 324 | DCT3_SetIncomingCB, |
324 | NOTIMPLEMENTED, /* GetSMSFolders */ | 325 | NOTIMPLEMENTED, /* GetSMSFolders */ |
325 | NOTSUPPORTED, /* AddSMSFolder */ | 326 | NOTSUPPORTED, /* AddSMSFolder */ |
326 | NOTSUPPORTED, /* DeleteSMSFolder */ | 327 | NOTSUPPORTED, /* DeleteSMSFolder */ |
327 | DCT3_DialVoice, | 328 | DCT3_DialVoice, |
328 | N9210_AnswerCall, | 329 | N9210_AnswerCall, |
329 | DCT3_CancelCall, | 330 | DCT3_CancelCall, |
330 | NOTSUPPORTED, /* HoldCall */ | 331 | NOTSUPPORTED, /* HoldCall */ |
331 | NOTSUPPORTED, /* UnholdCall */ | 332 | NOTSUPPORTED, /* UnholdCall */ |
332 | NOTSUPPORTED, /* ConferenceCall */ | 333 | NOTSUPPORTED, /* ConferenceCall */ |
333 | NOTSUPPORTED, /* SplitCall */ | 334 | NOTSUPPORTED, /* SplitCall */ |
@@ -364,25 +365,25 @@ GSM_Phone_Functions N9210Phone = { | |||
364 | NOTSUPPORTED, /* AddToDo */ | 365 | NOTSUPPORTED, /* AddToDo */ |
365 | NOTSUPPORTED, /* DeleteToDo */ | 366 | NOTSUPPORTED, /* DeleteToDo */ |
366 | NOTSUPPORTED, /* DeleteAllToDo */ | 367 | NOTSUPPORTED, /* DeleteAllToDo */ |
367 | NOTSUPPORTED, /* GetCalendarStatus*/ | 368 | NOTSUPPORTED, /* GetCalendarStatus*/ |
368 | NOTSUPPORTED, /* GetCalendar */ | 369 | NOTSUPPORTED, /* GetCalendar */ |
369 | NOTSUPPORTED, /* GetNextCalendar */ | 370 | NOTSUPPORTED, /* GetNextCalendar */ |
370 | NOTSUPPORTED, /* SetCalendar */ | 371 | NOTSUPPORTED, /* SetCalendar */ |
371 | NOTSUPPORTED, /* AddCalendar */ | 372 | NOTSUPPORTED, /* AddCalendar */ |
372 | NOTSUPPORTED, /* DeleteCalendar */ | 373 | NOTSUPPORTED, /* DeleteCalendar */ |
373 | NOTSUPPORTED, /* DeleteAllCalendar*/ | 374 | NOTSUPPORTED, /* DeleteAllCalendar*/ |
374 | NOTSUPPORTED, /* GetCalendarSettings*/ | 375 | NOTSUPPORTED, /* GetCalendarSettings*/ |
375 | NOTSUPPORTED, /* SetCalendarSettings*/ | 376 | NOTSUPPORTED, /* SetCalendarSettings*/ |
376 | NOTSUPPORTED, /* GetNote */ | 377 | NOTSUPPORTED, /* GetNextNote */ |
377 | NOTIMPLEMENTED, /* GetProfile */ | 378 | NOTIMPLEMENTED, /* GetProfile */ |
378 | NOTSUPPORTED, /* SetProfile */ | 379 | NOTSUPPORTED, /* SetProfile */ |
379 | NOTSUPPORTED, /* GetFMStation */ | 380 | NOTSUPPORTED, /* GetFMStation */ |
380 | NOTSUPPORTED, /* SetFMStation */ | 381 | NOTSUPPORTED, /* SetFMStation */ |
381 | NOTSUPPORTED, /* ClearFMStations */ | 382 | NOTSUPPORTED, /* ClearFMStations */ |
382 | NOTSUPPORTED, /* GetNextFileFolder*/ | 383 | NOTSUPPORTED, /* GetNextFileFolder*/ |
383 | NOTSUPPORTED, /* GetFilePart */ | 384 | NOTSUPPORTED, /* GetFilePart */ |
384 | NOTSUPPORTED, /* AddFile */ | 385 | NOTSUPPORTED, /* AddFile */ |
385 | NOTSUPPORTED, /* GetFileSystemStatus*/ | 386 | NOTSUPPORTED, /* GetFileSystemStatus*/ |
386 | NOTSUPPORTED, /* DeleteFile */ | 387 | NOTSUPPORTED, /* DeleteFile */ |
387 | NOTSUPPORTED, /* AddFolder */ | 388 | NOTSUPPORTED, /* AddFolder */ |
388 | NOTSUPPORTED, /* GetGPRSAccessPoint*/ | 389 | NOTSUPPORTED, /* GetGPRSAccessPoint*/ |
diff --git a/gammu/emb/common/phone/nokia/dct4/n3320.c b/gammu/emb/common/phone/nokia/dct4/n3320.c index 51e6f18..9b1d6cd 100644 --- a/gammu/emb/common/phone/nokia/dct4/n3320.c +++ b/gammu/emb/common/phone/nokia/dct4/n3320.c | |||
@@ -185,24 +185,25 @@ GSM_Phone_Functions N3320Phone = { | |||
185 | NOTSUPPORTED, /* GetSpeedDial */ | 185 | NOTSUPPORTED, /* GetSpeedDial */ |
186 | NOTSUPPORTED, /* SetSpeedDial */ | 186 | NOTSUPPORTED, /* SetSpeedDial */ |
187 | NOTSUPPORTED, /* GetSMSC */ | 187 | NOTSUPPORTED, /* GetSMSC */ |
188 | NOTSUPPORTED, /* SetSMSC */ | 188 | NOTSUPPORTED, /* SetSMSC */ |
189 | NOTSUPPORTED, /* GetSMSStatus */ | 189 | NOTSUPPORTED, /* GetSMSStatus */ |
190 | NOTSUPPORTED, /* GetSMS */ | 190 | NOTSUPPORTED, /* GetSMS */ |
191 | NOTSUPPORTED, /* GetNextSMS */ | 191 | NOTSUPPORTED, /* GetNextSMS */ |
192 | NOTSUPPORTED, /* SetSMS */ | 192 | NOTSUPPORTED, /* SetSMS */ |
193 | NOTSUPPORTED, /* AddSMS */ | 193 | NOTSUPPORTED, /* AddSMS */ |
194 | NOTSUPPORTED, /* DeleteSMS */ | 194 | NOTSUPPORTED, /* DeleteSMS */ |
195 | NOTSUPPORTED, /* SendSMS */ | 195 | NOTSUPPORTED, /* SendSMS */ |
196 | NOTSUPPORTED, /* SendSavedSMS */ | 196 | NOTSUPPORTED, /* SendSavedSMS */ |
197 | NOTSUPPORTED, /* SetFastSMSSending*/ | ||
197 | NOTSUPPORTED, /* SetIncomingSMS */ | 198 | NOTSUPPORTED, /* SetIncomingSMS */ |
198 | NOTSUPPORTED, /* SetIncomingCB */ | 199 | NOTSUPPORTED, /* SetIncomingCB */ |
199 | NOTSUPPORTED, /* GetSMSFolders */ | 200 | NOTSUPPORTED, /* GetSMSFolders */ |
200 | NOTSUPPORTED, /* AddSMSFolder */ | 201 | NOTSUPPORTED, /* AddSMSFolder */ |
201 | NOTSUPPORTED, /* DeleteSMSFolder */ | 202 | NOTSUPPORTED, /* DeleteSMSFolder */ |
202 | NOTIMPLEMENTED, /* DialVoice */ | 203 | NOTIMPLEMENTED, /* DialVoice */ |
203 | NOTIMPLEMENTED, /* AnswerCall */ | 204 | NOTIMPLEMENTED, /* AnswerCall */ |
204 | NOTIMPLEMENTED, /* CancelCall */ | 205 | NOTIMPLEMENTED, /* CancelCall */ |
205 | NOTIMPLEMENTED, /* HoldCall */ | 206 | NOTIMPLEMENTED, /* HoldCall */ |
206 | NOTIMPLEMENTED, /* UnholdCall */ | 207 | NOTIMPLEMENTED, /* UnholdCall */ |
207 | NOTIMPLEMENTED, /* ConferenceCall */ | 208 | NOTIMPLEMENTED, /* ConferenceCall */ |
208 | NOTIMPLEMENTED, /* SplitCall */ | 209 | NOTIMPLEMENTED, /* SplitCall */ |
@@ -239,25 +240,25 @@ GSM_Phone_Functions N3320Phone = { | |||
239 | NOTSUPPORTED, /* AddToDo */ | 240 | NOTSUPPORTED, /* AddToDo */ |
240 | NOTSUPPORTED, /* DeleteToDo */ | 241 | NOTSUPPORTED, /* DeleteToDo */ |
241 | NOTSUPPORTED, /* DeleteAllToDo */ | 242 | NOTSUPPORTED, /* DeleteAllToDo */ |
242 | N3320_GetCalendarStatus, | 243 | N3320_GetCalendarStatus, |
243 | NOTIMPLEMENTED, /* GetCalendar */ | 244 | NOTIMPLEMENTED, /* GetCalendar */ |
244 | N3320_GetNextCalendar, | 245 | N3320_GetNextCalendar, |
245 | NOTIMPLEMENTED, /* SetCalendar */ | 246 | NOTIMPLEMENTED, /* SetCalendar */ |
246 | NOTSUPPORTED, /* AddCalendar */ | 247 | NOTSUPPORTED, /* AddCalendar */ |
247 | NOTSUPPORTED, /* DeleteCalendar */ | 248 | NOTSUPPORTED, /* DeleteCalendar */ |
248 | NOTIMPLEMENTED, /* DeleteAllCalendar*/ | 249 | NOTIMPLEMENTED, /* DeleteAllCalendar*/ |
249 | NOTSUPPORTED, /* GetCalendarSettings*/ | 250 | NOTSUPPORTED, /* GetCalendarSettings*/ |
250 | NOTSUPPORTED, /* SetCalendarSettings*/ | 251 | NOTSUPPORTED, /* SetCalendarSettings*/ |
251 | NOTSUPPORTED, /* GetNote */ | 252 | NOTSUPPORTED, /* GetNextNote */ |
252 | NOTSUPPORTED, /* GetProfile */ | 253 | NOTSUPPORTED, /* GetProfile */ |
253 | NOTSUPPORTED, /* SetProfile */ | 254 | NOTSUPPORTED, /* SetProfile */ |
254 | NOTSUPPORTED, /* GetFMStation */ | 255 | NOTSUPPORTED, /* GetFMStation */ |
255 | NOTSUPPORTED, /* SetFMStation */ | 256 | NOTSUPPORTED, /* SetFMStation */ |
256 | NOTSUPPORTED, /* ClearFMStations */ | 257 | NOTSUPPORTED, /* ClearFMStations */ |
257 | NOTSUPPORTED, /* GetNextFileFolder*/ | 258 | NOTSUPPORTED, /* GetNextFileFolder*/ |
258 | NOTSUPPORTED, /* GetFilePart */ | 259 | NOTSUPPORTED, /* GetFilePart */ |
259 | NOTIMPLEMENTED, /* AddFilePart */ | 260 | NOTIMPLEMENTED, /* AddFilePart */ |
260 | NOTSUPPORTED, /* GetFileSystemStatus*/ | 261 | NOTSUPPORTED, /* GetFileSystemStatus*/ |
261 | NOTIMPLEMENTED, /* DeleteFile */ | 262 | NOTIMPLEMENTED, /* DeleteFile */ |
262 | NOTIMPLEMENTED, /* AddFolder */ | 263 | NOTIMPLEMENTED, /* AddFolder */ |
263 | NOTSUPPORTED, /* GetGPRSAccessPoint*/ | 264 | NOTSUPPORTED, /* GetGPRSAccessPoint*/ |
diff --git a/gammu/emb/common/phone/nokia/dct4/n3650.c b/gammu/emb/common/phone/nokia/dct4/n3650.c index 2da55bf..d4746a7 100644 --- a/gammu/emb/common/phone/nokia/dct4/n3650.c +++ b/gammu/emb/common/phone/nokia/dct4/n3650.c | |||
@@ -306,24 +306,25 @@ GSM_Phone_Functions N3650Phone = { | |||
306 | NOTSUPPORTED, /* GetSpeedDial */ | 306 | NOTSUPPORTED, /* GetSpeedDial */ |
307 | NOTSUPPORTED, /* SetSpeedDial */ | 307 | NOTSUPPORTED, /* SetSpeedDial */ |
308 | NOTSUPPORTED, /* GetSMSC */ | 308 | NOTSUPPORTED, /* GetSMSC */ |
309 | NOTSUPPORTED, /* SetSMSC */ | 309 | NOTSUPPORTED, /* SetSMSC */ |
310 | NOTSUPPORTED, /* GetSMSStatus */ | 310 | NOTSUPPORTED, /* GetSMSStatus */ |
311 | NOTSUPPORTED, /* GetSMS */ | 311 | NOTSUPPORTED, /* GetSMS */ |
312 | NOTSUPPORTED, /* GetNextSMS */ | 312 | NOTSUPPORTED, /* GetNextSMS */ |
313 | NOTSUPPORTED, /* SetSMS */ | 313 | NOTSUPPORTED, /* SetSMS */ |
314 | NOTSUPPORTED, /* AddSMS */ | 314 | NOTSUPPORTED, /* AddSMS */ |
315 | NOTSUPPORTED, /* DeleteSMS */ | 315 | NOTSUPPORTED, /* DeleteSMS */ |
316 | NOTSUPPORTED, /* SendSMS */ | 316 | NOTSUPPORTED, /* SendSMS */ |
317 | NOTSUPPORTED, /* SendSavedSMS */ | 317 | NOTSUPPORTED, /* SendSavedSMS */ |
318 | NOTSUPPORTED, /* SetFastSMSSending*/ | ||
318 | NOTSUPPORTED, /* SetIncomingSMS */ | 319 | NOTSUPPORTED, /* SetIncomingSMS */ |
319 | NOTSUPPORTED, /* SetIncomingCB */ | 320 | NOTSUPPORTED, /* SetIncomingCB */ |
320 | NOTSUPPORTED, /* GetSMSFolders */ | 321 | NOTSUPPORTED, /* GetSMSFolders */ |
321 | NOTSUPPORTED, /* AddSMSFolder */ | 322 | NOTSUPPORTED, /* AddSMSFolder */ |
322 | NOTSUPPORTED, /* DeleteSMSFolder */ | 323 | NOTSUPPORTED, /* DeleteSMSFolder */ |
323 | NOTIMPLEMENTED, /* DialVoice */ | 324 | NOTIMPLEMENTED, /* DialVoice */ |
324 | NOTIMPLEMENTED, /* AnswerCall */ | 325 | NOTIMPLEMENTED, /* AnswerCall */ |
325 | NOTIMPLEMENTED, /* CancelCall */ | 326 | NOTIMPLEMENTED, /* CancelCall */ |
326 | NOTIMPLEMENTED, /* HoldCall */ | 327 | NOTIMPLEMENTED, /* HoldCall */ |
327 | NOTIMPLEMENTED, /* UnholdCall */ | 328 | NOTIMPLEMENTED, /* UnholdCall */ |
328 | NOTIMPLEMENTED, /* ConferenceCall */ | 329 | NOTIMPLEMENTED, /* ConferenceCall */ |
329 | NOTIMPLEMENTED, /* SplitCall */ | 330 | NOTIMPLEMENTED, /* SplitCall */ |
@@ -360,25 +361,25 @@ GSM_Phone_Functions N3650Phone = { | |||
360 | NOTSUPPORTED, /* AddToDo */ | 361 | NOTSUPPORTED, /* AddToDo */ |
361 | NOTSUPPORTED, /* DeleteToDo */ | 362 | NOTSUPPORTED, /* DeleteToDo */ |
362 | NOTSUPPORTED, /* DeleteAllToDo */ | 363 | NOTSUPPORTED, /* DeleteAllToDo */ |
363 | NOTIMPLEMENTED, /* GetCalendarStatus*/ | 364 | NOTIMPLEMENTED, /* GetCalendarStatus*/ |
364 | NOTIMPLEMENTED, /* GetCalendar */ | 365 | NOTIMPLEMENTED, /* GetCalendar */ |
365 | NOTSUPPORTED, /* GetNextCalendar */ | 366 | NOTSUPPORTED, /* GetNextCalendar */ |
366 | NOTIMPLEMENTED, /* SetCalendar */ | 367 | NOTIMPLEMENTED, /* SetCalendar */ |
367 | NOTSUPPORTED, /* AddCalendar */ | 368 | NOTSUPPORTED, /* AddCalendar */ |
368 | NOTSUPPORTED, /* DeleteCalendar */ | 369 | NOTSUPPORTED, /* DeleteCalendar */ |
369 | NOTIMPLEMENTED, /* DeleteAllCalendar*/ | 370 | NOTIMPLEMENTED, /* DeleteAllCalendar*/ |
370 | NOTSUPPORTED, /* GetCalendarSettings*/ | 371 | NOTSUPPORTED, /* GetCalendarSettings*/ |
371 | NOTSUPPORTED, /* SetCalendarSettings*/ | 372 | NOTSUPPORTED, /* SetCalendarSettings*/ |
372 | NOTSUPPORTED, /* GetNote */ | 373 | NOTSUPPORTED, /* GetNextNote */ |
373 | NOTSUPPORTED, /* GetProfile */ | 374 | NOTSUPPORTED, /* GetProfile */ |
374 | NOTSUPPORTED, /* SetProfile */ | 375 | NOTSUPPORTED, /* SetProfile */ |
375 | NOTSUPPORTED, /* GetFMStation */ | 376 | NOTSUPPORTED, /* GetFMStation */ |
376 | NOTSUPPORTED, /* SetFMStation */ | 377 | NOTSUPPORTED, /* SetFMStation */ |
377 | NOTSUPPORTED, /* ClearFMStations */ | 378 | NOTSUPPORTED, /* ClearFMStations */ |
378 | N3650_GetNextFileFolder, | 379 | N3650_GetNextFileFolder, |
379 | N3650_GetFilePart, | 380 | N3650_GetFilePart, |
380 | NOTIMPLEMENTED, /* AddFilePart */ | 381 | NOTIMPLEMENTED, /* AddFilePart */ |
381 | NOTSUPPORTED, /* GetFileSystemStatus*/ | 382 | NOTSUPPORTED, /* GetFileSystemStatus*/ |
382 | NOTIMPLEMENTED, /* DeleteFile */ | 383 | NOTIMPLEMENTED, /* DeleteFile */ |
383 | NOTIMPLEMENTED, /* AddFolder */ | 384 | NOTIMPLEMENTED, /* AddFolder */ |
384 | NOTSUPPORTED, /* GetGPRSAccessPoint*/ | 385 | NOTSUPPORTED, /* GetGPRSAccessPoint*/ |
diff --git a/gammu/emb/common/phone/nokia/dct4/n6510.c b/gammu/emb/common/phone/nokia/dct4/n6510.c index 67fe492..2208def 100644 --- a/gammu/emb/common/phone/nokia/dct4/n6510.c +++ b/gammu/emb/common/phone/nokia/dct4/n6510.c | |||
@@ -1,14 +1,17 @@ | |||
1 | /* (c) 2002-2004 by Marcin Wiacek */ | 1 | /* (c) 2002-2004 by Marcin Wiacek */ |
2 | /* based on some work from Markus Plail, Pawel Kot and Gnokii */ | 2 | /* based on some Markus Plail, Pawel Kot work from Gnokii (www.gnokii.org) |
3 | * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot | ||
4 | * GNU GPL version 2 or later | ||
5 | */ | ||
3 | /* function for making CRC for filesystem (c) 2003 by Michael Schroeder */ | 6 | /* function for making CRC for filesystem (c) 2003 by Michael Schroeder */ |
4 | 7 | ||
5 | #include "../../../gsmstate.h" | 8 | #include "../../../gsmstate.h" |
6 | 9 | ||
7 | #ifdef GSM_ENABLE_NOKIA6510 | 10 | #ifdef GSM_ENABLE_NOKIA6510 |
8 | 11 | ||
9 | #include <string.h> | 12 | #include <string.h> |
10 | #include <time.h> | 13 | #include <time.h> |
11 | 14 | ||
12 | #include "../../../misc/coding/coding.h" | 15 | #include "../../../misc/coding/coding.h" |
13 | #include "../../../gsmcomon.h" | 16 | #include "../../../gsmcomon.h" |
14 | #include "../../../service/gsmlogo.h" | 17 | #include "../../../service/gsmlogo.h" |
@@ -110,24 +113,26 @@ static GSM_Error N6510_ReplyGetSMSC(GSM_Protocol_Message msg, GSM_StateMachine * | |||
110 | } | 113 | } |
111 | memset(Data->SMSC,0,sizeof(GSM_SMSC)); | 114 | memset(Data->SMSC,0,sizeof(GSM_SMSC)); |
112 | Data->SMSC->Location = msg.Buffer[8]; | 115 | Data->SMSC->Location = msg.Buffer[8]; |
113 | Data->SMSC->Format = SMS_FORMAT_Text; | 116 | Data->SMSC->Format = SMS_FORMAT_Text; |
114 | switch (msg.Buffer[10]) { | 117 | switch (msg.Buffer[10]) { |
115 | case 0x00: Data->SMSC->Format = SMS_FORMAT_Text; break; | 118 | case 0x00: Data->SMSC->Format = SMS_FORMAT_Text; break; |
116 | case 0x22: Data->SMSC->Format = SMS_FORMAT_Fax; break; | 119 | case 0x22: Data->SMSC->Format = SMS_FORMAT_Fax; break; |
117 | case 0x26: Data->SMSC->Format = SMS_FORMAT_Pager;break; | 120 | case 0x26: Data->SMSC->Format = SMS_FORMAT_Pager;break; |
118 | case 0x32: Data->SMSC->Format = SMS_FORMAT_Email;break; | 121 | case 0x32: Data->SMSC->Format = SMS_FORMAT_Email;break; |
119 | } | 122 | } |
120 | Data->SMSC->Validity.Format= SMS_Validity_RelativeFormat; | 123 | Data->SMSC->Validity.Format= SMS_Validity_RelativeFormat; |
121 | Data->SMSC->Validity.Relative= msg.Buffer[12]; | 124 | Data->SMSC->Validity.Relative= msg.Buffer[12]; |
125 | if (msg.Buffer[12] == 0x00) Data->SMSC->Validity.Relative = SMS_VALID_Max_Time; | ||
126 | |||
122 | current = 14; | 127 | current = 14; |
123 | for (i=0;i<msg.Buffer[13];i++) { | 128 | for (i=0;i<msg.Buffer[13];i++) { |
124 | switch (msg.Buffer[current]) { | 129 | switch (msg.Buffer[current]) { |
125 | case 0x81: | 130 | case 0x81: |
126 | j=current+4; | 131 | j=current+4; |
127 | while (msg.Buffer[j]!=0) {j++;} | 132 | while (msg.Buffer[j]!=0) {j++;} |
128 | j=j-33; | 133 | j=j-33; |
129 | if (j>GSM_MAX_SMSC_NAME_LENGTH) { | 134 | if (j>GSM_MAX_SMSC_NAME_LENGTH) { |
130 | smprintf(s, "Too long name\n"); | 135 | smprintf(s, "Too long name\n"); |
131 | return ERR_UNKNOWNRESPONSE; | 136 | return ERR_UNKNOWNRESPONSE; |
132 | } | 137 | } |
133 | CopyUnicodeString(Data->SMSC->Name,msg.Buffer+current+4); | 138 | CopyUnicodeString(Data->SMSC->Name,msg.Buffer+current+4); |
@@ -976,29 +981,29 @@ static GSM_Error N6510_GetBatteryCharge(GSM_StateMachine *s, GSM_BatteryCharge * | |||
976 | } | 981 | } |
977 | 982 | ||
978 | static GSM_Error N6510_ReplyGetWAPBookmark(GSM_Protocol_Message msg, GSM_StateMachine *s) | 983 | static GSM_Error N6510_ReplyGetWAPBookmark(GSM_Protocol_Message msg, GSM_StateMachine *s) |
979 | { | 984 | { |
980 | return DCT3DCT4_ReplyGetWAPBookmark (msg, s, true); | 985 | return DCT3DCT4_ReplyGetWAPBookmark (msg, s, true); |
981 | } | 986 | } |
982 | 987 | ||
983 | static GSM_Error N6510_ReplyGetOperatorLogo(GSM_Protocol_Message msg, GSM_StateMachine *s) | 988 | static GSM_Error N6510_ReplyGetOperatorLogo(GSM_Protocol_Message msg, GSM_StateMachine *s) |
984 | { | 989 | { |
985 | GSM_Phone_Data *Data = &s->Phone.Data; | 990 | GSM_Phone_Data *Data = &s->Phone.Data; |
986 | 991 | ||
987 | smprintf(s, "Operator logo received\n"); | 992 | smprintf(s, "Operator logo received\n"); |
993 | if (msg.Length == 18) return ERR_EMPTY; | ||
988 | NOKIA_DecodeNetworkCode(msg.Buffer+12,Data->Bitmap->NetworkCode); | 994 | NOKIA_DecodeNetworkCode(msg.Buffer+12,Data->Bitmap->NetworkCode); |
989 | smprintf(s, "Network code %s\n",Data->Bitmap->NetworkCode); | 995 | smprintf(s, "Network code %s\n",Data->Bitmap->NetworkCode); |
990 | Data->Bitmap->BitmapWidth= msg.Buffer[20]; | 996 | Data->Bitmap->BitmapWidth= msg.Buffer[20]; |
991 | Data->Bitmap->BitmapHeight= msg.Buffer[21]; | 997 | Data->Bitmap->BitmapHeight= msg.Buffer[21]; |
992 | if (msg.Length == 18) return ERR_EMPTY; | ||
993 | PHONE_DecodeBitmap(GSM_Nokia6510OperatorLogo,msg.Buffer+26,Data->Bitmap); | 998 | PHONE_DecodeBitmap(GSM_Nokia6510OperatorLogo,msg.Buffer+26,Data->Bitmap); |
994 | return ERR_NONE; | 999 | return ERR_NONE; |
995 | } | 1000 | } |
996 | 1001 | ||
997 | GSM_Error N6510_ReplyDeleteMemory(GSM_Protocol_Message msg, GSM_StateMachine *s) | 1002 | GSM_Error N6510_ReplyDeleteMemory(GSM_Protocol_Message msg, GSM_StateMachine *s) |
998 | { | 1003 | { |
999 | smprintf(s, "Phonebook entry deleted\n"); | 1004 | smprintf(s, "Phonebook entry deleted\n"); |
1000 | return ERR_NONE; | 1005 | return ERR_NONE; |
1001 | } | 1006 | } |
1002 | 1007 | ||
1003 | GSM_Error N6510_DeleteMemory(GSM_StateMachine *s, GSM_MemoryEntry *entry) | 1008 | GSM_Error N6510_DeleteMemory(GSM_StateMachine *s, GSM_MemoryEntry *entry) |
1004 | { | 1009 | { |
@@ -1756,25 +1761,26 @@ static GSM_Error N6510_GetSyncMLSettings(GSM_StateMachine *s, GSM_SyncMLSettings | |||
1756 | 0x00, 0x00, 0x00, 0x31, 0x00, | 1761 | 0x00, 0x00, 0x00, 0x31, 0x00, |
1757 | 0x01, //location | 1762 | 0x01, //location |
1758 | 0x00, 0x00, 0x02, 0x46, 0x00, 0x00}; | 1763 | 0x00, 0x00, 0x02, 0x46, 0x00, 0x00}; |
1759 | 1764 | ||
1760 | settings->Connection.Location = settings->Location; | 1765 | settings->Connection.Location = settings->Location; |
1761 | error = N6510_GetConnectionSettings(s, &settings->Connection, N6510_SYNCML_SETTINGS); | 1766 | error = N6510_GetConnectionSettings(s, &settings->Connection, N6510_SYNCML_SETTINGS); |
1762 | if (error != ERR_NONE) return error; | 1767 | if (error != ERR_NONE) return error; |
1763 | 1768 | ||
1764 | settings->Active = settings->Connection.Active; | 1769 | settings->Active = settings->Connection.Active; |
1765 | 1770 | ||
1766 | settings->Name[0] = 0; | 1771 | settings->Name[0] = 0; |
1767 | settings->Name[1] = 0; | 1772 | settings->Name[1] = 0; |
1768 | //s->Phone.Data.SyncMLSettings = settings; | 1773 | s->Phone.Data.SyncMLSettings = settings; |
1774 | |||
1769 | //smprintf(s, "Getting SyncML settings name\n"); | 1775 | //smprintf(s, "Getting SyncML settings name\n"); |
1770 | //error = GSM_WaitFor (s, NameReq, 16, 0x43, 4, ID_GetSyncMLName); | 1776 | //error = GSM_WaitFor (s, NameReq, 16, 0x43, 4, ID_GetSyncMLName); |
1771 | //if (error != ERR_NONE) return error; | 1777 | //if (error != ERR_NONE) return error; |
1772 | 1778 | ||
1773 | req[9] = settings->Location - 1; | 1779 | req[9] = settings->Location - 1; |
1774 | smprintf(s, "Getting additional SyncML settings\n"); | 1780 | smprintf(s, "Getting additional SyncML settings\n"); |
1775 | return GSM_WaitFor (s, req, 16, 0x43, 4, ID_GetSyncMLSettings); | 1781 | return GSM_WaitFor (s, req, 16, 0x43, 4, ID_GetSyncMLSettings); |
1776 | } | 1782 | } |
1777 | 1783 | ||
1778 | static GSM_Error N6510_ReplyGetChatSettings(GSM_Protocol_Message msg, GSM_StateMachine *s) | 1784 | static GSM_Error N6510_ReplyGetChatSettings(GSM_Protocol_Message msg, GSM_StateMachine *s) |
1779 | { | 1785 | { |
1780 | GSM_ChatSettings *Sett = s->Phone.Data.ChatSettings; | 1786 | GSM_ChatSettings *Sett = s->Phone.Data.ChatSettings; |
@@ -2274,25 +2280,25 @@ static GSM_Error N6510_DeleteSMSMessage(GSM_StateMachine *s, GSM_SMSMessage *sms | |||
2274 | } | 2280 | } |
2275 | req[6]=location / 256; | 2281 | req[6]=location / 256; |
2276 | req[7]=location; | 2282 | req[7]=location; |
2277 | 2283 | ||
2278 | smprintf(s, "Deleting sms\n"); | 2284 | smprintf(s, "Deleting sms\n"); |
2279 | return GSM_WaitFor (s, req, 10, 0x14, 4, ID_DeleteSMSMessage); | 2285 | return GSM_WaitFor (s, req, 10, 0x14, 4, ID_DeleteSMSMessage); |
2280 | } | 2286 | } |
2281 | 2287 | ||
2282 | static GSM_Error N6510_ReplySendSMSMessage(GSM_Protocol_Message msg, GSM_StateMachine *s) | 2288 | static GSM_Error N6510_ReplySendSMSMessage(GSM_Protocol_Message msg, GSM_StateMachine *s) |
2283 | { | 2289 | { |
2284 | switch (msg.Buffer[8]) { | 2290 | switch (msg.Buffer[8]) { |
2285 | case 0x00: | 2291 | case 0x00: |
2286 | smprintf(s, "SMS sent OK, TPMR for sent sms is %02x\n",msg.Buffer[10]); | 2292 | smprintf(s, "SMS sent OK, TPMR for sent sms is %d\n",msg.Buffer[10]); |
2287 | if (s->User.SendSMSStatus!=NULL) s->User.SendSMSStatus(s->CurrentConfig->Device,0,msg.Buffer[10]); | 2293 | if (s->User.SendSMSStatus!=NULL) s->User.SendSMSStatus(s->CurrentConfig->Device,0,msg.Buffer[10]); |
2288 | return ERR_NONE; | 2294 | return ERR_NONE; |
2289 | default: | 2295 | default: |
2290 | smprintf(s, "SMS not sent OK, error code probably %i\n",msg.Buffer[8]); | 2296 | smprintf(s, "SMS not sent OK, error code probably %i\n",msg.Buffer[8]); |
2291 | if (s->User.SendSMSStatus!=NULL) s->User.SendSMSStatus(s->CurrentConfig->Device,msg.Buffer[8],msg.Buffer[10]); | 2297 | if (s->User.SendSMSStatus!=NULL) s->User.SendSMSStatus(s->CurrentConfig->Device,msg.Buffer[8],msg.Buffer[10]); |
2292 | return ERR_NONE; | 2298 | return ERR_NONE; |
2293 | } | 2299 | } |
2294 | } | 2300 | } |
2295 | 2301 | ||
2296 | static GSM_Error N6510_SendSMSMessage(GSM_StateMachine *s, GSM_SMSMessage *sms) | 2302 | static GSM_Error N6510_SendSMSMessage(GSM_StateMachine *s, GSM_SMSMessage *sms) |
2297 | { | 2303 | { |
2298 | int length = 11; | 2304 | int length = 11; |
@@ -2761,24 +2767,25 @@ static GSM_Error N6510_GetRingtone(GSM_StateMachine *s, GSM_Ringtone *Ringtone, | |||
2761 | return ERR_NOTSUPPORTED; | 2767 | return ERR_NOTSUPPORTED; |
2762 | case RING_NOKIABINARY: | 2768 | case RING_NOKIABINARY: |
2763 | s->Phone.Data.Ringtone= Ringtone; | 2769 | s->Phone.Data.Ringtone= Ringtone; |
2764 | Info.Number = 0; | 2770 | Info.Number = 0; |
2765 | error=N6510_PrivGetRingtonesInfo(s, &Info, PhoneRingtone); | 2771 | error=N6510_PrivGetRingtonesInfo(s, &Info, PhoneRingtone); |
2766 | if (error != ERR_NONE) return error; | 2772 | if (error != ERR_NONE) return error; |
2767 | if (Ringtone->Location > Info.Number) return ERR_INVALIDLOCATION; | 2773 | if (Ringtone->Location > Info.Number) return ERR_INVALIDLOCATION; |
2768 | req2[4] = Info.Ringtone[Ringtone->Location-1].ID / 256; | 2774 | req2[4] = Info.Ringtone[Ringtone->Location-1].ID / 256; |
2769 | req2[5] = Info.Ringtone[Ringtone->Location-1].ID % 256; | 2775 | req2[5] = Info.Ringtone[Ringtone->Location-1].ID % 256; |
2770 | smprintf(s, "Getting binary ringtone\n"); | 2776 | smprintf(s, "Getting binary ringtone\n"); |
2771 | return GSM_WaitFor (s, req2, 6, 0x1f, 4, ID_GetRingtone); | 2777 | return GSM_WaitFor (s, req2, 6, 0x1f, 4, ID_GetRingtone); |
2772 | case RING_MIDI: | 2778 | case RING_MIDI: |
2779 | case RING_MMF: | ||
2773 | return ERR_NOTSUPPORTED; | 2780 | return ERR_NOTSUPPORTED; |
2774 | } | 2781 | } |
2775 | return ERR_NOTSUPPORTED; | 2782 | return ERR_NOTSUPPORTED; |
2776 | } | 2783 | } |
2777 | 2784 | ||
2778 | static GSM_Error N6510_PlayTone(GSM_StateMachine *s, int Herz, unsigned char Volume, bool start) | 2785 | static GSM_Error N6510_PlayTone(GSM_StateMachine *s, int Herz, unsigned char Volume, bool start) |
2779 | { | 2786 | { |
2780 | GSM_Error error; | 2787 | GSM_Error error; |
2781 | unsigned char reqStart[] = { | 2788 | unsigned char reqStart[] = { |
2782 | 0x00,0x06,0x01,0x00,0x07,0x00 }; | 2789 | 0x00,0x06,0x01,0x00,0x07,0x00 }; |
2783 | unsigned char reqPlay[] = { | 2790 | unsigned char reqPlay[] = { |
2784 | 0x00,0x06,0x01,0x14,0x05,0x04, | 2791 | 0x00,0x06,0x01,0x14,0x05,0x04, |
@@ -2977,24 +2984,27 @@ static GSM_Error N6510_GetProfile(GSM_StateMachine *s, GSM_Profile *Profile) | |||
2977 | unsigned char req[150] = {N6110_FRAME_HEADER, 0x01, 0x01, 0x0C, 0x01}; | 2984 | unsigned char req[150] = {N6110_FRAME_HEADER, 0x01, 0x01, 0x0C, 0x01}; |
2978 | unsigned charreqActive[] = {N6110_FRAME_HEADER, 0x05}; | 2985 | unsigned charreqActive[] = {N6110_FRAME_HEADER, 0x05}; |
2979 | int i, length = 7; | 2986 | int i, length = 7; |
2980 | GSM_Errorerror; | 2987 | GSM_Errorerror; |
2981 | 2988 | ||
2982 | /* For now !!! */ | 2989 | /* For now !!! */ |
2983 | if (!strcmp(s->Phone.Data.ModelInfo->model,"3510")) { | 2990 | if (!strcmp(s->Phone.Data.ModelInfo->model,"3510")) { |
2984 | if (s->Phone.Data.VerNum>3.37) return ERR_NOTSUPPORTED; | 2991 | if (s->Phone.Data.VerNum>3.37) return ERR_NOTSUPPORTED; |
2985 | } | 2992 | } |
2986 | if (!strcmp(s->Phone.Data.ModelInfo->model,"6230")) { | 2993 | if (!strcmp(s->Phone.Data.ModelInfo->model,"6230")) { |
2987 | return ERR_NOTSUPPORTED; | 2994 | return ERR_NOTSUPPORTED; |
2988 | } | 2995 | } |
2996 | if (!strcmp(s->Phone.Data.ModelInfo->model,"5140")) { | ||
2997 | return ERR_NOTSUPPORTED; | ||
2998 | } | ||
2989 | 2999 | ||
2990 | if (Profile->Location>5) return ERR_INVALIDLOCATION; | 3000 | if (Profile->Location>5) return ERR_INVALIDLOCATION; |
2991 | 3001 | ||
2992 | for (i = 0; i < 0x0a; i++) { | 3002 | for (i = 0; i < 0x0a; i++) { |
2993 | req[length++] = 0x04; | 3003 | req[length++] = 0x04; |
2994 | req[length++] = Profile->Location; | 3004 | req[length++] = Profile->Location; |
2995 | req[length++] = i; | 3005 | req[length++] = i; |
2996 | req[length++] = 0x01; | 3006 | req[length++] = 0x01; |
2997 | } | 3007 | } |
2998 | 3008 | ||
2999 | req[length++] = 0x04; | 3009 | req[length++] = 0x04; |
3000 | req[length++] = Profile->Location; | 3010 | req[length++] = Profile->Location; |
@@ -3106,52 +3116,76 @@ static GSM_Error N6510_ReplyIncomingSMS(GSM_Protocol_Message msg, GSM_StateMachi | |||
3106 | sms.State = SMS_UnRead; | 3116 | sms.State = SMS_UnRead; |
3107 | sms.InboxFolder = true; | 3117 | sms.InboxFolder = true; |
3108 | 3118 | ||
3109 | N6510_DecodeSMSFrame(s, &sms, msg.Buffer+10); | 3119 | N6510_DecodeSMSFrame(s, &sms, msg.Buffer+10); |
3110 | 3120 | ||
3111 | s->User.IncomingSMS(s->CurrentConfig->Device,sms); | 3121 | s->User.IncomingSMS(s->CurrentConfig->Device,sms); |
3112 | } | 3122 | } |
3113 | return ERR_NONE; | 3123 | return ERR_NONE; |
3114 | } | 3124 | } |
3115 | 3125 | ||
3116 | static GSM_Error N6510_DialVoice(GSM_StateMachine *s, char *number, GSM_CallShowNumber ShowNumber) | 3126 | static GSM_Error N6510_DialVoice(GSM_StateMachine *s, char *number, GSM_CallShowNumber ShowNumber) |
3117 | { | 3127 | { |
3128 | unsigned int pos2 = 15; | ||
3118 | unsigned intpos = 4; | 3129 | unsigned intpos = 4; |
3130 | unsigned char req2[100] = {N6110_FRAME_HEADER,0x01, | ||
3131 | 0x00,0x02,0x07,0x04, | ||
3132 | 0x01, // 1 - voice, 2 - data | ||
3133 | 0x00,0x03, | ||
3134 | 0x18, // length of rest + 1 | ||
3135 | 0x00,0x00,0x00}; | ||
3119 | unsigned char req[100] = {N6110_FRAME_HEADER,0x01, | 3136 | unsigned char req[100] = {N6110_FRAME_HEADER,0x01, |
3120 | 0x0c};/* Number length */ | 3137 | 0x0c};/* Number length */ |
3138 | GSM_Errorerror; | ||
3139 | |||
3140 | /* USSD not supported */ | ||
3141 | if (number[0] == '*') return ERR_NOTSUPPORTED; | ||
3142 | if (number[0] == '#') return ERR_NOTSUPPORTED; | ||
3121 | 3143 | ||
3122 | req[pos++] = strlen(number); | 3144 | req[pos++] = strlen(number); |
3123 | EncodeUnicode(req+pos,number,strlen(number)); | 3145 | EncodeUnicode(req+pos,number,strlen(number)); |
3124 | pos += strlen(number)*2; | 3146 | pos += strlen(number)*2; |
3125 | req[pos++] = 0x05; /* call type: voice - 0x05, data - 0x01 */ | 3147 | req[pos++] = 0x05; /* call type: voice - 0x05, data - 0x01 */ |
3126 | req[pos++] = 0x01; | 3148 | req[pos++] = 0x01; |
3127 | req[pos++] = 0x05; | 3149 | req[pos++] = 0x05; |
3128 | req[pos++] = 0x00; | 3150 | req[pos++] = 0x00; |
3129 | req[pos++] = 0x02; | 3151 | req[pos++] = 0x02; |
3130 | req[pos++] = 0x00; | 3152 | req[pos++] = 0x00; |
3131 | req[pos++] = 0x00; | 3153 | req[pos++] = 0x00; |
3132 | switch (ShowNumber) { | 3154 | switch (ShowNumber) { |
3133 | case GSM_CALL_HideNumber: | 3155 | case GSM_CALL_HideNumber: |
3134 | req[pos++] = 0x02; | 3156 | req[pos++] = 0x02; |
3135 | break; | 3157 | break; |
3136 | case GSM_CALL_ShowNumber: | 3158 | case GSM_CALL_ShowNumber: |
3137 | req[pos++] = 0x03; | 3159 | req[pos++] = 0x03; |
3138 | break; | 3160 | break; |
3139 | case GSM_CALL_DefaultNumberPresence: | 3161 | case GSM_CALL_DefaultNumberPresence: |
3140 | req[pos++] = 0x01; | 3162 | req[pos++] = 0x01; |
3141 | break; | 3163 | break; |
3142 | } | 3164 | } |
3165 | smprintf(s, "Making voice call\n"); | ||
3166 | error = GSM_WaitFor (s, req, pos, 0x01, 4, ID_DialVoice); | ||
3167 | if (error != ERR_NOTSUPPORTED) return error; | ||
3168 | |||
3169 | if (ShowNumber != GSM_CALL_DefaultNumberPresence) return ERR_NOTSUPPORTED; | ||
3170 | |||
3171 | req2[11] = strlen(number)*2+6; | ||
3172 | req2[pos2++] = strlen(number); | ||
3173 | EncodeUnicode(req2+pos2,number,strlen(number)); | ||
3174 | pos2 += strlen(number)*2; | ||
3143 | 3175 | ||
3144 | smprintf(s, "Making voice call\n"); | 3176 | smprintf(s, "Making voice call\n"); |
3145 | return GSM_WaitFor (s, req, pos, 0x01, 4, ID_DialVoice); | 3177 | error = GSM_WaitFor (s, req2, pos2, 0x01, 4, ID_DialVoice); |
3178 | if (error == ERR_NOTSUPPORTED) return ERR_NONE; | ||
3179 | return error; | ||
3146 | } | 3180 | } |
3147 | 3181 | ||
3148 | /* method 3 */ | 3182 | /* method 3 */ |
3149 | static GSM_Error N6510_ReplyGetCalendarInfo3(GSM_Protocol_Message msg, GSM_StateMachine *s, GSM_NOKIACalToDoLocations *Last) | 3183 | static GSM_Error N6510_ReplyGetCalendarInfo3(GSM_Protocol_Message msg, GSM_StateMachine *s, GSM_NOKIACalToDoLocations *Last) |
3150 | { | 3184 | { |
3151 | int i=0,j=0; | 3185 | int i=0,j=0; |
3152 | 3186 | ||
3153 | while (Last->Location[j] != 0x00) j++; | 3187 | while (Last->Location[j] != 0x00) j++; |
3154 | if (j >= GSM_MAXCALENDARTODONOTES) { | 3188 | if (j >= GSM_MAXCALENDARTODONOTES) { |
3155 | smprintf(s, "Increase GSM_MAXCALENDARTODONOTES\n"); | 3189 | smprintf(s, "Increase GSM_MAXCALENDARTODONOTES\n"); |
3156 | return ERR_UNKNOWN; | 3190 | return ERR_UNKNOWN; |
3157 | } | 3191 | } |
@@ -3165,63 +3199,69 @@ static GSM_Error N6510_ReplyGetCalendarInfo3(GSM_Protocol_Message msg, GSM_State | |||
3165 | smprintf(s, "%i ",Last->Location[j-1]); | 3199 | smprintf(s, "%i ",Last->Location[j-1]); |
3166 | i++; | 3200 | i++; |
3167 | } | 3201 | } |
3168 | smprintf(s, "\nNumber of Entries in frame: %i\n",i); | 3202 | smprintf(s, "\nNumber of Entries in frame: %i\n",i); |
3169 | Last->Location[j] = 0; | 3203 | Last->Location[j] = 0; |
3170 | smprintf(s, "\n"); | 3204 | smprintf(s, "\n"); |
3171 | if (i == 1 && msg.Buffer[12+0*4]*256+msg.Buffer[13+0*4] == 0) return ERR_EMPTY; | 3205 | if (i == 1 && msg.Buffer[12+0*4]*256+msg.Buffer[13+0*4] == 0) return ERR_EMPTY; |
3172 | if (i == 0) return ERR_EMPTY; | 3206 | if (i == 0) return ERR_EMPTY; |
3173 | return ERR_NONE; | 3207 | return ERR_NONE; |
3174 | } | 3208 | } |
3175 | 3209 | ||
3176 | /* method 3 */ | 3210 | /* method 3 */ |
3177 | static GSM_Error N6510_GetCalendarInfo3(GSM_StateMachine *s, GSM_NOKIACalToDoLocations *Last, bool Calendar) | 3211 | static GSM_Error N6510_GetCalendarInfo3(GSM_StateMachine *s, GSM_NOKIACalToDoLocations *Last, char Type) |
3178 | { | 3212 | { |
3179 | GSM_Error error; | 3213 | GSM_Error error = ERR_UNKNOWN; |
3180 | int i; | 3214 | int i; |
3181 | unsigned char req[] = {N6110_FRAME_HEADER, 0x9E, 0xFF, 0xFF, 0x00, 0x00, | 3215 | unsigned char req[] = {N6110_FRAME_HEADER, 0x9E, 0xFF, 0xFF, 0x00, 0x00, |
3182 | 0x00, 0x00,/* First location */ | 3216 | 0x00, 0x00,/* First location */ |
3183 | 0x00}; /* 0 = calendar, 1 = ToDo in 6610 style */ | 3217 | 0x00}; /* 0 = calendar, 1 = ToDo in 6610 style, 2 = Notes */ |
3184 | 3218 | ||
3185 | Last->Location[0] = 0x00; | 3219 | Last->Location[0] = 0x00; |
3186 | Last->Number = 0; | 3220 | Last->Number = 0; |
3187 | 3221 | ||
3188 | if (Calendar) { | 3222 | req[10] = Type; |
3223 | if (Type == 0) { | ||
3189 | smprintf(s, "Getting locations for calendar method 3\n"); | 3224 | smprintf(s, "Getting locations for calendar method 3\n"); |
3190 | error = GSM_WaitFor (s, req, 11, 0x13, 4, ID_GetCalendarNotesInfo); | 3225 | error = GSM_WaitFor (s, req, 11, 0x13, 4, ID_GetCalendarNotesInfo); |
3191 | } else { | 3226 | } else if (Type == 1) { |
3192 | req[10] = 0x01; | ||
3193 | smprintf(s, "Getting locations for ToDo method 2\n"); | 3227 | smprintf(s, "Getting locations for ToDo method 2\n"); |
3194 | error = GSM_WaitFor (s, req, 11, 0x13, 4, ID_GetToDo); | 3228 | error = GSM_WaitFor (s, req, 11, 0x13, 4, ID_GetToDo); |
3229 | } else if (Type == 2) { | ||
3230 | smprintf(s, "Getting locations for Notes\n"); | ||
3231 | error = GSM_WaitFor (s, req, 11, 0x13, 4, ID_GetNote); | ||
3195 | } | 3232 | } |
3196 | if (error != ERR_NONE && error != ERR_EMPTY) return error; | 3233 | if (error != ERR_NONE && error != ERR_EMPTY) return error; |
3197 | 3234 | ||
3198 | while (1) { | 3235 | while (1) { |
3199 | i=0; | 3236 | i=0; |
3200 | while (Last->Location[i] != 0x00) i++; | 3237 | while (Last->Location[i] != 0x00) i++; |
3201 | smprintf(s, "i = %i %i\n",i,Last->Number); | 3238 | smprintf(s, "i = %i %i\n",i,Last->Number); |
3202 | if (i == Last->Number) break; | 3239 | if (i == Last->Number) break; |
3203 | if (i != Last->Number && error == ERR_EMPTY) { | 3240 | if (i != Last->Number && error == ERR_EMPTY) { |
3204 | smprintf(s, "Phone doesn't support some notes with this method. Workaround\n"); | 3241 | smprintf(s, "Phone doesn't support some notes with this method. Workaround\n"); |
3205 | Last->Number = i; | 3242 | Last->Number = i; |
3206 | break; | 3243 | break; |
3207 | } | 3244 | } |
3208 | req[8] = Last->Location[i-1] / 256; | 3245 | req[8] = Last->Location[i-1] / 256; |
3209 | req[9] = Last->Location[i-1] % 256; | 3246 | req[9] = Last->Location[i-1] % 256; |
3210 | if (Calendar) { | 3247 | if (Type == 0) { |
3211 | smprintf(s, "Getting locations for calendar method 3\n"); | 3248 | smprintf(s, "Getting locations for calendar method 3\n"); |
3212 | error = GSM_WaitFor (s, req, 11, 0x13, 4, ID_GetCalendarNotesInfo); | 3249 | error = GSM_WaitFor (s, req, 11, 0x13, 4, ID_GetCalendarNotesInfo); |
3213 | } else { | 3250 | } else if (Type == 1) { |
3214 | smprintf(s, "Getting locations for todo method 2\n"); | 3251 | smprintf(s, "Getting locations for todo method 2\n"); |
3215 | error = GSM_WaitFor (s, req, 11, 0x13, 4, ID_GetToDo); | 3252 | error = GSM_WaitFor (s, req, 11, 0x13, 4, ID_GetToDo); |
3253 | } else if (Type == 2) { | ||
3254 | smprintf(s, "Getting locations for Notes\n"); | ||
3255 | error = GSM_WaitFor (s, req, 11, 0x13, 4, ID_GetNote); | ||
3216 | } | 3256 | } |
3217 | if (error != ERR_NONE && error != ERR_EMPTY) return error; | 3257 | if (error != ERR_NONE && error != ERR_EMPTY) return error; |
3218 | } | 3258 | } |
3219 | return ERR_NONE; | 3259 | return ERR_NONE; |
3220 | } | 3260 | } |
3221 | 3261 | ||
3222 | /* method 3 */ | 3262 | /* method 3 */ |
3223 | GSM_Error N6510_ReplyGetCalendar3(GSM_Protocol_Message msg, GSM_StateMachine *s) | 3263 | GSM_Error N6510_ReplyGetCalendar3(GSM_Protocol_Message msg, GSM_StateMachine *s) |
3224 | { | 3264 | { |
3225 | GSM_CalendarEntry *entry = s->Phone.Data.Cal; | 3265 | GSM_CalendarEntry *entry = s->Phone.Data.Cal; |
3226 | GSM_DateTime Date; | 3266 | GSM_DateTime Date; |
3227 | unsigned long diff; | 3267 | unsigned long diff; |
@@ -3341,69 +3381,75 @@ GSM_Error N6510_ReplyGetCalendar3(GSM_Protocol_Message msg, GSM_StateMachine *s) | |||
3341 | } | 3381 | } |
3342 | if (entry->Type == GSM_CAL_MEETING) { | 3382 | if (entry->Type == GSM_CAL_MEETING) { |
3343 | memcpy(entry->Entries[entry->EntriesNum].Text, msg.Buffer+(54+msg.Buffer[51]*2), msg.Buffer[52]*2); | 3383 | memcpy(entry->Entries[entry->EntriesNum].Text, msg.Buffer+(54+msg.Buffer[51]*2), msg.Buffer[52]*2); |
3344 | entry->Entries[entry->EntriesNum].Text[msg.Buffer[52]*2] = 0; | 3384 | entry->Entries[entry->EntriesNum].Text[msg.Buffer[52]*2] = 0; |
3345 | entry->Entries[entry->EntriesNum].Text[msg.Buffer[52]*2+1] = 0; | 3385 | entry->Entries[entry->EntriesNum].Text[msg.Buffer[52]*2+1] = 0; |
3346 | entry->Entries[entry->EntriesNum].EntryType = CAL_LOCATION; | 3386 | entry->Entries[entry->EntriesNum].EntryType = CAL_LOCATION; |
3347 | entry->EntriesNum++; | 3387 | entry->EntriesNum++; |
3348 | } | 3388 | } |
3349 | 3389 | ||
3350 | return ERR_NONE; | 3390 | return ERR_NONE; |
3351 | } | 3391 | } |
3352 | 3392 | ||
3393 | static GSM_Error N6510_PrivGetGenericCalendar3(GSM_StateMachine *s, int Location, GSM_Phone_RequestID ID) | ||
3394 | { | ||
3395 | unsigned char req[] = {N6110_FRAME_HEADER,0x7D,0x00,0x00,0x00,0x00, | ||
3396 | 0x00,0x99,/* Location */ | ||
3397 | 0xff,0xff,0xff,0xff}; | ||
3398 | |||
3399 | req[8] = Location / 256; | ||
3400 | req[9] = Location % 256; | ||
3401 | |||
3402 | return GSM_WaitFor (s, req, 14, 0x13, 4, ID); | ||
3403 | } | ||
3404 | |||
3353 | static GSM_Error N6510_PrivGetCalendar3(GSM_StateMachine *s, GSM_CalendarEntry *Note, bool start, int *LastCalendarYear) | 3405 | static GSM_Error N6510_PrivGetCalendar3(GSM_StateMachine *s, GSM_CalendarEntry *Note, bool start, int *LastCalendarYear) |
3354 | { | 3406 | { |
3355 | GSM_Error error; | 3407 | GSM_Error error; |
3356 | GSM_DateTime date_time; | 3408 | GSM_DateTime date_time; |
3357 | unsigned char req[] = {N6110_FRAME_HEADER,0x7D,0x00,0x00,0x00,0x00, | ||
3358 | 0x00,0x99,/* Location */ | ||
3359 | 0xff,0xff,0xff,0xff,0x01}; | ||
3360 | 3409 | ||
3361 | if (start) { | 3410 | if (start) { |
3362 | /* We have to get current year. It's NOT written in frame for | 3411 | /* We have to get current year. It's NOT written in frame for |
3363 | * Birthday | 3412 | * Birthday |
3364 | */ | 3413 | */ |
3365 | error=s->Phone.Functions->GetDateTime(s,&date_time); | 3414 | error=s->Phone.Functions->GetDateTime(s,&date_time); |
3366 | switch (error) { | 3415 | switch (error) { |
3367 | case ERR_EMPTY: | 3416 | case ERR_EMPTY: |
3368 | case ERR_NOTIMPLEMENTED: | 3417 | case ERR_NOTIMPLEMENTED: |
3369 | GSM_GetCurrentDateTime(&date_time); | 3418 | GSM_GetCurrentDateTime(&date_time); |
3370 | break; | 3419 | break; |
3371 | case ERR_NONE: | 3420 | case ERR_NONE: |
3372 | break; | 3421 | break; |
3373 | default: | 3422 | default: |
3374 | return error; | 3423 | return error; |
3375 | } | 3424 | } |
3376 | *LastCalendarYear = date_time.Year; | 3425 | *LastCalendarYear = date_time.Year; |
3377 | } | 3426 | } |
3378 | 3427 | ||
3379 | Note->EntriesNum = 0; | 3428 | Note->EntriesNum = 0; |
3380 | Note->Entries[0].Date.Year = *LastCalendarYear; | 3429 | Note->Entries[0].Date.Year = *LastCalendarYear; |
3381 | 3430 | ||
3382 | req[8] = Note->Location / 256; | ||
3383 | req[9] = Note->Location % 256; | ||
3384 | |||
3385 | s->Phone.Data.Cal=Note; | 3431 | s->Phone.Data.Cal=Note; |
3386 | smprintf(s, "Getting calendar note method 3\n"); | 3432 | smprintf(s, "Getting calendar note method 3\n"); |
3387 | return GSM_WaitFor (s, req, 15, 0x13, 4, ID_GetCalendarNote); | 3433 | return N6510_PrivGetGenericCalendar3(s, Note->Location, ID_GetCalendarNote); |
3388 | } | 3434 | } |
3389 | 3435 | ||
3390 | /* method 3 */ | 3436 | /* method 3 */ |
3391 | GSM_Error N6510_GetNextCalendar3(GSM_StateMachine *s, GSM_CalendarEntry *Note, bool start, GSM_NOKIACalToDoLocations *LastCalendar, int *LastCalendarYear, int *LastCalendarPos) | 3437 | GSM_Error N6510_GetNextCalendar3(GSM_StateMachine *s, GSM_CalendarEntry *Note, bool start, GSM_NOKIACalToDoLocations *LastCalendar, int *LastCalendarYear, int *LastCalendarPos) |
3392 | { | 3438 | { |
3393 | GSM_Error error; | 3439 | GSM_Error error; |
3394 | bool start2; | 3440 | bool start2; |
3395 | 3441 | ||
3396 | if (start) { | 3442 | if (start) { |
3397 | error=N6510_GetCalendarInfo3(s,LastCalendar,true); | 3443 | error=N6510_GetCalendarInfo3(s,LastCalendar,0); |
3398 | if (error!=ERR_NONE) return error; | 3444 | if (error!=ERR_NONE) return error; |
3399 | if (LastCalendar->Number == 0) return ERR_EMPTY; | 3445 | if (LastCalendar->Number == 0) return ERR_EMPTY; |
3400 | 3446 | ||
3401 | *LastCalendarPos = 0; | 3447 | *LastCalendarPos = 0; |
3402 | } else { | 3448 | } else { |
3403 | (*LastCalendarPos)++; | 3449 | (*LastCalendarPos)++; |
3404 | } | 3450 | } |
3405 | 3451 | ||
3406 | error = ERR_EMPTY; | 3452 | error = ERR_EMPTY; |
3407 | start2 = start; | 3453 | start2 = start; |
3408 | while (error == ERR_EMPTY) { | 3454 | while (error == ERR_EMPTY) { |
3409 | if (*LastCalendarPos >= LastCalendar->Number) return ERR_EMPTY; | 3455 | if (*LastCalendarPos >= LastCalendar->Number) return ERR_EMPTY; |
@@ -3468,42 +3514,42 @@ static GSM_Error N6510_FindCalendarIconID3(GSM_StateMachine *s, GSM_CalendarEntr | |||
3468 | GSM_Error error; | 3514 | GSM_Error error; |
3469 | bool found; | 3515 | bool found; |
3470 | 3516 | ||
3471 | for(i=0;i<Priv->CalendarIconsNum;i++) { | 3517 | for(i=0;i<Priv->CalendarIconsNum;i++) { |
3472 | if (Priv->CalendarIconsTypes[i] == Entry->Type) { | 3518 | if (Priv->CalendarIconsTypes[i] == Entry->Type) { |
3473 | *ID = Priv->CalendarIcons[i]; | 3519 | *ID = Priv->CalendarIcons[i]; |
3474 | return ERR_NONE; | 3520 | return ERR_NONE; |
3475 | } | 3521 | } |
3476 | } | 3522 | } |
3477 | 3523 | ||
3478 | smprintf(s, "Starting finding note ID\n"); | 3524 | smprintf(s, "Starting finding note ID\n"); |
3479 | 3525 | ||
3480 | error=N6510_GetCalendarInfo3(s, &Priv->LastCalendar,true); | 3526 | error=N6510_GetCalendarInfo3(s, &Priv->LastCalendar,0); |
3481 | memcpy(&LastCalendar1,&Priv->LastCalendar,sizeof(GSM_NOKIACalToDoLocations)); | 3527 | memcpy(&LastCalendar1,&Priv->LastCalendar,sizeof(GSM_NOKIACalToDoLocations)); |
3482 | if (error != ERR_NONE) return error; | 3528 | if (error != ERR_NONE) return error; |
3483 | 3529 | ||
3484 | if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_CAL35) || | 3530 | if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_CAL35) || |
3485 | IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_CAL65) || | 3531 | IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_CAL65) || |
3486 | IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_CAL62)) { | 3532 | IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_CAL62)) { |
3487 | error=N71_65_AddCalendar2(s,Entry); | 3533 | error=N71_65_AddCalendar2(s,Entry); |
3488 | } else { | 3534 | } else { |
3489 | if (Entry->Type == GSM_CAL_MEETING) { | 3535 | if (Entry->Type == GSM_CAL_MEETING) { |
3490 | error=N71_65_AddCalendar1(s, Entry, &s->Phone.Data.Priv.N6510.FirstCalendarPos); | 3536 | error=N71_65_AddCalendar1(s, Entry, &s->Phone.Data.Priv.N6510.FirstCalendarPos); |
3491 | } else { | 3537 | } else { |
3492 | error=N71_65_AddCalendar2(s,Entry); | 3538 | error=N71_65_AddCalendar2(s,Entry); |
3493 | } | 3539 | } |
3494 | } | 3540 | } |
3495 | if (error != ERR_NONE) return error; | 3541 | if (error != ERR_NONE) return error; |
3496 | 3542 | ||
3497 | error=N6510_GetCalendarInfo3(s, &Priv->LastCalendar,true); | 3543 | error=N6510_GetCalendarInfo3(s, &Priv->LastCalendar,0); |
3498 | memcpy(&LastCalendar2,&Priv->LastCalendar,sizeof(GSM_NOKIACalToDoLocations)); | 3544 | memcpy(&LastCalendar2,&Priv->LastCalendar,sizeof(GSM_NOKIACalToDoLocations)); |
3499 | if (error != ERR_NONE) return error; | 3545 | if (error != ERR_NONE) return error; |
3500 | 3546 | ||
3501 | smprintf(s,"Number of entries: %i %i\n",LastCalendar1.Number,LastCalendar2.Number); | 3547 | smprintf(s,"Number of entries: %i %i\n",LastCalendar1.Number,LastCalendar2.Number); |
3502 | 3548 | ||
3503 | for(i=0;i<LastCalendar2.Number;i++) { | 3549 | for(i=0;i<LastCalendar2.Number;i++) { |
3504 | found = true; | 3550 | found = true; |
3505 | for(j=0;j<LastCalendar1.Number;j++) { | 3551 | for(j=0;j<LastCalendar1.Number;j++) { |
3506 | if (LastCalendar1.Location[j] == LastCalendar2.Location[i]) { | 3552 | if (LastCalendar1.Location[j] == LastCalendar2.Location[i]) { |
3507 | found = false; | 3553 | found = false; |
3508 | break; | 3554 | break; |
3509 | } | 3555 | } |
@@ -3728,25 +3774,25 @@ static GSM_Error N6510_GetCalendarStatus(GSM_StateMachine *s, GSM_CalendarStatus | |||
3728 | 3774 | ||
3729 | if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_CAL62)) { | 3775 | if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_CAL62)) { |
3730 | /* Method 1 */ | 3776 | /* Method 1 */ |
3731 | error=N71_65_GetCalendarInfo1(s, &s->Phone.Data.Priv.N6510.LastCalendar); | 3777 | error=N71_65_GetCalendarInfo1(s, &s->Phone.Data.Priv.N6510.LastCalendar); |
3732 | if (error!=ERR_NONE) return error; | 3778 | if (error!=ERR_NONE) return error; |
3733 | Status->Used = s->Phone.Data.Priv.N6510.LastCalendar.Number; | 3779 | Status->Used = s->Phone.Data.Priv.N6510.LastCalendar.Number; |
3734 | return ERR_NONE; | 3780 | return ERR_NONE; |
3735 | 3781 | ||
3736 | /* Method 2 */ | 3782 | /* Method 2 */ |
3737 | // return ERR_NOTSUPPORTED; | 3783 | // return ERR_NOTSUPPORTED; |
3738 | } else { | 3784 | } else { |
3739 | /* Method 3 */ | 3785 | /* Method 3 */ |
3740 | error=N6510_GetCalendarInfo3(s,&s->Phone.Data.Priv.N6510.LastCalendar,true); | 3786 | error=N6510_GetCalendarInfo3(s,&s->Phone.Data.Priv.N6510.LastCalendar,0); |
3741 | if (error!=ERR_NONE) return error; | 3787 | if (error!=ERR_NONE) return error; |
3742 | Status->Used = s->Phone.Data.Priv.N6510.LastCalendar.Number; | 3788 | Status->Used = s->Phone.Data.Priv.N6510.LastCalendar.Number; |
3743 | return ERR_NONE; | 3789 | return ERR_NONE; |
3744 | } | 3790 | } |
3745 | } | 3791 | } |
3746 | 3792 | ||
3747 | static GSM_Error N6510_AddCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Note) | 3793 | static GSM_Error N6510_AddCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Note) |
3748 | { | 3794 | { |
3749 | #ifdef GSM_FORCE_DCT4_CALENDAR_6210 | 3795 | #ifdef GSM_FORCE_DCT4_CALENDAR_6210 |
3750 | return N71_65_AddCalendar2(s,Note); | 3796 | return N71_65_AddCalendar2(s,Note); |
3751 | #endif | 3797 | #endif |
3752 | 3798 | ||
@@ -3963,24 +4009,60 @@ static GSM_Error N6510_ShowStartInfo(GSM_StateMachine *s, bool enable) | |||
3963 | return N6510_SetLight(s,N6510_LIGHT_KEYPAD,true); | 4009 | return N6510_SetLight(s,N6510_LIGHT_KEYPAD,true); |
3964 | } else { | 4010 | } else { |
3965 | error=N6510_SetLight(s,N6510_LIGHT_DISPLAY,false); | 4011 | error=N6510_SetLight(s,N6510_LIGHT_DISPLAY,false); |
3966 | if (error != ERR_NONE) return error; | 4012 | if (error != ERR_NONE) return error; |
3967 | 4013 | ||
3968 | error=N6510_SetLight(s,N6510_LIGHT_TORCH,false); | 4014 | error=N6510_SetLight(s,N6510_LIGHT_TORCH,false); |
3969 | if (error != ERR_NONE) return error; | 4015 | if (error != ERR_NONE) return error; |
3970 | 4016 | ||
3971 | return N6510_SetLight(s,N6510_LIGHT_KEYPAD,false); | 4017 | return N6510_SetLight(s,N6510_LIGHT_KEYPAD,false); |
3972 | } | 4018 | } |
3973 | } | 4019 | } |
3974 | 4020 | ||
4021 | static GSM_Error N6510_ReplyGetNoteInfo(GSM_Protocol_Message msg, GSM_StateMachine *s) | ||
4022 | { | ||
4023 | return N6510_ReplyGetCalendarInfo3(msg, s, &s->Phone.Data.Priv.N6510.LastNote); | ||
4024 | } | ||
4025 | |||
4026 | static GSM_Error N6510_ReplyGetNote(GSM_Protocol_Message msg, GSM_StateMachine *s) | ||
4027 | { | ||
4028 | smprintf(s, "Note received\n"); | ||
4029 | memcpy(s->Phone.Data.Note->Text,msg.Buffer+54,(msg.Buffer[50]*256+msg.Buffer[51])*2); | ||
4030 | s->Phone.Data.Note->Text[(msg.Buffer[50]*256+msg.Buffer[51])*2] = 0; | ||
4031 | s->Phone.Data.Note->Text[(msg.Buffer[50]*256+msg.Buffer[51])*2+1] = 0; | ||
4032 | return ERR_NONE; | ||
4033 | } | ||
4034 | |||
4035 | GSM_Error N6510_GetNextNote(GSM_StateMachine *s, GSM_NoteEntry *Note, bool start) | ||
4036 | { | ||
4037 | GSM_Error error; | ||
4038 | GSM_NOKIACalToDoLocations *LastNote = &s->Phone.Data.Priv.N6510.LastNote; | ||
4039 | |||
4040 | if (!IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_NOTES)) return ERR_NOTSUPPORTED; | ||
4041 | |||
4042 | if (start) { | ||
4043 | error=N6510_GetCalendarInfo3(s,LastNote,2); | ||
4044 | if (error!=ERR_NONE) return error; | ||
4045 | Note->Location = 1; | ||
4046 | } else { | ||
4047 | Note->Location++; | ||
4048 | } | ||
4049 | |||
4050 | if (Note->Location > LastNote->Number) return ERR_EMPTY; | ||
4051 | |||
4052 | s->Phone.Data.Note = Note; | ||
4053 | smprintf(s, "Getting note\n"); | ||
4054 | return N6510_PrivGetGenericCalendar3(s, LastNote->Location[Note->Location-1], ID_GetNote); | ||
4055 | } | ||
4056 | |||
3975 | static int N6510_FindFileCheckSum(unsigned char *ptr, int len) | 4057 | static int N6510_FindFileCheckSum(unsigned char *ptr, int len) |
3976 | { | 4058 | { |
3977 | int acc, i, accx; | 4059 | int acc, i, accx; |
3978 | 4060 | ||
3979 | accx = 0; | 4061 | accx = 0; |
3980 | acc = 0xffff; | 4062 | acc = 0xffff; |
3981 | while (len--) { | 4063 | while (len--) { |
3982 | accx = (accx & 0xffff00ff) | (acc & 0xff00); | 4064 | accx = (accx & 0xffff00ff) | (acc & 0xff00); |
3983 | acc = (acc & 0xffff00ff) | *ptr++ << 8; | 4065 | acc = (acc & 0xffff00ff) | *ptr++ << 8; |
3984 | for (i = 0; i < 8; i++) { | 4066 | for (i = 0; i < 8; i++) { |
3985 | acc <<= 1; | 4067 | acc <<= 1; |
3986 | if (acc & 0x10000) acc ^= 0x1021; | 4068 | if (acc & 0x10000) acc ^= 0x1021; |
@@ -4046,25 +4128,25 @@ static GSM_Error N6510_ReplyGetFileFolderInfo(GSM_Protocol_Message msg, GSM_Stat | |||
4046 | else if (msg.Buffer[i]==0x02 && msg.Buffer[i+2]==0x05) | 4128 | else if (msg.Buffer[i]==0x02 && msg.Buffer[i+2]==0x05) |
4047 | File->Type = GSM_File_Image_GIF; | 4129 | File->Type = GSM_File_Image_GIF; |
4048 | else if (msg.Buffer[i]==0x02 && msg.Buffer[i+2]==0x09) | 4130 | else if (msg.Buffer[i]==0x02 && msg.Buffer[i+2]==0x09) |
4049 | File->Type = GSM_File_Image_WBMP; | 4131 | File->Type = GSM_File_Image_WBMP; |
4050 | else if (msg.Buffer[i]==0x04 && msg.Buffer[i+2]==0x01) | 4132 | else if (msg.Buffer[i]==0x04 && msg.Buffer[i+2]==0x01) |
4051 | File->Type = GSM_File_Sound_AMR; | 4133 | File->Type = GSM_File_Sound_AMR; |
4052 | else if (msg.Buffer[i]==0x04 && msg.Buffer[i+2]==0x02) | 4134 | else if (msg.Buffer[i]==0x04 && msg.Buffer[i+2]==0x02) |
4053 | File->Type = GSM_File_Sound_MIDI; | 4135 | File->Type = GSM_File_Sound_MIDI; |
4054 | else if (msg.Buffer[i]==0x08 && msg.Buffer[i+2]==0x05) | 4136 | else if (msg.Buffer[i]==0x08 && msg.Buffer[i+2]==0x05) |
4055 | File->Type = GSM_File_Video_3GP; | 4137 | File->Type = GSM_File_Video_3GP; |
4056 | else if (msg.Buffer[i]==0x10 && msg.Buffer[i+2]==0x01) | 4138 | else if (msg.Buffer[i]==0x10 && msg.Buffer[i+2]==0x01) |
4057 | File->Type = GSM_File_Java_JAR; | 4139 | File->Type = GSM_File_Java_JAR; |
4058 | #if DEVELOP | 4140 | #ifdef DEVELOP |
4059 | else if (msg.Buffer[i]==0x00 && msg.Buffer[i+2]==0x01) | 4141 | else if (msg.Buffer[i]==0x00 && msg.Buffer[i+2]==0x01) |
4060 | File->Type = GSM_File_MMS; | 4142 | File->Type = GSM_File_MMS; |
4061 | #endif | 4143 | #endif |
4062 | } | 4144 | } |
4063 | return ERR_NONE; | 4145 | return ERR_NONE; |
4064 | case 0x2F: | 4146 | case 0x2F: |
4065 | smprintf(s,"File or folder used bytes received\n"); | 4147 | smprintf(s,"File or folder used bytes received\n"); |
4066 | File->Used = msg.Buffer[6]*256*256*256+ | 4148 | File->Used = msg.Buffer[6]*256*256*256+ |
4067 | msg.Buffer[7]*256*256+ | 4149 | msg.Buffer[7]*256*256+ |
4068 | msg.Buffer[8]*256+ | 4150 | msg.Buffer[8]*256+ |
4069 | msg.Buffer[9]; | 4151 | msg.Buffer[9]; |
4070 | return ERR_NONE; | 4152 | return ERR_NONE; |
@@ -4389,25 +4471,25 @@ static GSM_Error N6510_AddFilePart(GSM_StateMachine *s, GSM_File *File, int *Pos | |||
4389 | 0x01, 0x28}; /* length */ | 4471 | 0x01, 0x28}; /* length */ |
4390 | unsigned char end[30] = { | 4472 | unsigned char end[30] = { |
4391 | N7110_FRAME_HEADER, 0x40, 0x00, 0x00, 0x00, 0x01, | 4473 | N7110_FRAME_HEADER, 0x40, 0x00, 0x00, 0x00, 0x01, |
4392 | 0x00, 0x04, /* file ID */ | 4474 | 0x00, 0x04, /* file ID */ |
4393 | 0x00, 0x00, 0x00, 0x00}; | 4475 | 0x00, 0x00, 0x00, 0x00}; |
4394 | 4476 | ||
4395 | if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_NOFILESYSTEM)) return ERR_NOTSUPPORTED; | 4477 | if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_NOFILESYSTEM)) return ERR_NOTSUPPORTED; |
4396 | 4478 | ||
4397 | s->Phone.Data.File = File; | 4479 | s->Phone.Data.File = File; |
4398 | 4480 | ||
4399 | if (*Pos == 0) { | 4481 | if (*Pos == 0) { |
4400 | error = N6510_SearchForFileName(s,File); | 4482 | error = N6510_SearchForFileName(s,File); |
4401 | if (error == ERR_NONE) return ERR_INVALIDLOCATION; | 4483 | if (error == ERR_NONE) return ERR_FILEALREADYEXIST; |
4402 | if (error != ERR_EMPTY) return error; | 4484 | if (error != ERR_EMPTY) return error; |
4403 | 4485 | ||
4404 | Header[8] = atoi(File->ID_FullName) / 256; | 4486 | Header[8] = atoi(File->ID_FullName) / 256; |
4405 | Header[9] = atoi(File->ID_FullName) % 256; | 4487 | Header[9] = atoi(File->ID_FullName) % 256; |
4406 | memset(Header+14, 0x00, 300); | 4488 | memset(Header+14, 0x00, 300); |
4407 | CopyUnicodeString(Header+14,File->Name); | 4489 | CopyUnicodeString(Header+14,File->Name); |
4408 | Header[222] = File->Used / (256*256*256); | 4490 | Header[222] = File->Used / (256*256*256); |
4409 | Header[223] = File->Used / (256*256); | 4491 | Header[223] = File->Used / (256*256); |
4410 | Header[224] = File->Used / 256; | 4492 | Header[224] = File->Used / 256; |
4411 | Header[225] = File->Used % 256; | 4493 | Header[225] = File->Used % 256; |
4412 | switch(File->Type) { | 4494 | switch(File->Type) { |
4413 | case GSM_File_Image_JPG : Header[231]=0x02; Header[233]=0x01; break; | 4495 | case GSM_File_Image_JPG : Header[231]=0x02; Header[233]=0x01; break; |
@@ -4805,25 +4887,25 @@ static GSM_Error N6510_GetToDoStatus1(GSM_StateMachine *s, GSM_ToDoStatus *statu | |||
4805 | error = GSM_WaitFor (s, reqLoc, 10, 0x55, 4, ID_GetToDo); | 4887 | error = GSM_WaitFor (s, reqLoc, 10, 0x55, 4, ID_GetToDo); |
4806 | if (error != ERR_NONE) return error; | 4888 | if (error != ERR_NONE) return error; |
4807 | 4889 | ||
4808 | status->Used = LastToDo->Number; | 4890 | status->Used = LastToDo->Number; |
4809 | return ERR_NONE; | 4891 | return ERR_NONE; |
4810 | } | 4892 | } |
4811 | 4893 | ||
4812 | static GSM_Error N6510_GetToDoStatus2(GSM_StateMachine *s, GSM_ToDoStatus *status) | 4894 | static GSM_Error N6510_GetToDoStatus2(GSM_StateMachine *s, GSM_ToDoStatus *status) |
4813 | { | 4895 | { |
4814 | GSM_NOKIACalToDoLocations*LastToDo = &s->Phone.Data.Priv.N6510.LastToDo; | 4896 | GSM_NOKIACalToDoLocations*LastToDo = &s->Phone.Data.Priv.N6510.LastToDo; |
4815 | GSM_Error error; | 4897 | GSM_Error error; |
4816 | 4898 | ||
4817 | error = N6510_GetCalendarInfo3(s,LastToDo,false); | 4899 | error = N6510_GetCalendarInfo3(s,LastToDo,1); |
4818 | if (error!=ERR_NONE) return error; | 4900 | if (error!=ERR_NONE) return error; |
4819 | 4901 | ||
4820 | status->Used = LastToDo->Number; | 4902 | status->Used = LastToDo->Number; |
4821 | return ERR_NONE; | 4903 | return ERR_NONE; |
4822 | } | 4904 | } |
4823 | 4905 | ||
4824 | static GSM_Error N6510_GetToDoStatus(GSM_StateMachine *s, GSM_ToDoStatus *status) | 4906 | static GSM_Error N6510_GetToDoStatus(GSM_StateMachine *s, GSM_ToDoStatus *status) |
4825 | { | 4907 | { |
4826 | status->Used = 0; | 4908 | status->Used = 0; |
4827 | 4909 | ||
4828 | if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_TODO63)) { | 4910 | if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_TODO63)) { |
4829 | return N6510_GetToDoStatus1(s, status); | 4911 | return N6510_GetToDoStatus1(s, status); |
@@ -4935,26 +5017,25 @@ static GSM_Error N6510_ReplyGetToDo2(GSM_Protocol_Message msg, GSM_StateMachine | |||
4935 | Date.Minute = msg.Buffer[33]; | 5017 | Date.Minute = msg.Buffer[33]; |
4936 | Date.Second= 0; | 5018 | Date.Second= 0; |
4937 | 5019 | ||
4938 | Last->EntriesNum = 2; | 5020 | Last->EntriesNum = 2; |
4939 | 5021 | ||
4940 | if (msg.Buffer[45] == 0x01) { | 5022 | if (msg.Buffer[45] == 0x01) { |
4941 | Last->Entries[2].Number = msg.Buffer[45]; | 5023 | Last->Entries[2].Number = msg.Buffer[45]; |
4942 | Last->Entries[2].EntryType = TODO_COMPLETED; | 5024 | Last->Entries[2].EntryType = TODO_COMPLETED; |
4943 | Last->EntriesNum++; | 5025 | Last->EntriesNum++; |
4944 | smprintf(s,"Completed\n"); | 5026 | smprintf(s,"Completed\n"); |
4945 | } | 5027 | } |
4946 | 5028 | ||
4947 | if (msg.Buffer[14] == 0xFF && msg.Buffer[15] == 0xFF && msg.Buffer[16] == 0xff && msg.Buffer[17] == 0xff) | 5029 | if (msg.Buffer[14] == 0xFF && msg.Buffer[15] == 0xFF && msg.Buffer[16] == 0xff && msg.Buffer[17] == 0xff) { |
4948 | { | ||
4949 | smprintf(s, "No alarm\n"); | 5030 | smprintf(s, "No alarm\n"); |
4950 | } else { | 5031 | } else { |
4951 | diff = ((unsigned int)msg.Buffer[14]) << 24; | 5032 | diff = ((unsigned int)msg.Buffer[14]) << 24; |
4952 | diff += ((unsigned int)msg.Buffer[15]) << 16; | 5033 | diff += ((unsigned int)msg.Buffer[15]) << 16; |
4953 | diff += ((unsigned int)msg.Buffer[16]) << 8; | 5034 | diff += ((unsigned int)msg.Buffer[16]) << 8; |
4954 | diff += msg.Buffer[17]; | 5035 | diff += msg.Buffer[17]; |
4955 | 5036 | ||
4956 | memcpy(&Last->Entries[Last->EntriesNum].Date,&Date,sizeof(GSM_DateTime)); | 5037 | memcpy(&Last->Entries[Last->EntriesNum].Date,&Date,sizeof(GSM_DateTime)); |
4957 | GetTimeDifference(diff, &Last->Entries[Last->EntriesNum].Date, false, 60); | 5038 | GetTimeDifference(diff, &Last->Entries[Last->EntriesNum].Date, false, 60); |
4958 | smprintf(s, "Alarm date : %02i-%02i-%04i %02i:%02i:%02i\n", | 5039 | smprintf(s, "Alarm date : %02i-%02i-%04i %02i:%02i:%02i\n", |
4959 | Last->Entries[Last->EntriesNum].Date.Day, Last->Entries[Last->EntriesNum].Date.Month, | 5040 | Last->Entries[Last->EntriesNum].Date.Day, Last->Entries[Last->EntriesNum].Date.Month, |
4960 | Last->Entries[Last->EntriesNum].Date.Year, Last->Entries[Last->EntriesNum].Date.Hour, | 5041 | Last->Entries[Last->EntriesNum].Date.Year, Last->Entries[Last->EntriesNum].Date.Hour, |
@@ -4969,46 +5050,38 @@ static GSM_Error N6510_ReplyGetToDo2(GSM_Protocol_Message msg, GSM_StateMachine | |||
4969 | } | 5050 | } |
4970 | Last->EntriesNum++; | 5051 | Last->EntriesNum++; |
4971 | } | 5052 | } |
4972 | 5053 | ||
4973 | return ERR_NONE; | 5054 | return ERR_NONE; |
4974 | } | 5055 | } |
4975 | 5056 | ||
4976 | /* ToDo support - 6610 style */ | 5057 | /* ToDo support - 6610 style */ |
4977 | static GSM_Error N6510_GetNextToDo2(GSM_StateMachine *s, GSM_ToDoEntry *ToDo, bool refresh) | 5058 | static GSM_Error N6510_GetNextToDo2(GSM_StateMachine *s, GSM_ToDoEntry *ToDo, bool refresh) |
4978 | { | 5059 | { |
4979 | GSM_Error error; | 5060 | GSM_Error error; |
4980 | GSM_NOKIACalToDoLocations *LastToDo = &s->Phone.Data.Priv.N6510.LastToDo; | 5061 | GSM_NOKIACalToDoLocations *LastToDo = &s->Phone.Data.Priv.N6510.LastToDo; |
4981 | /* The same to getting calendar method 3 */ | ||
4982 | unsigned char req[] = { | ||
4983 | N6110_FRAME_HEADER,0x7D,0x00,0x00,0x00,0x00, | ||
4984 | 0x00,0x99, /* Location */ | ||
4985 | 0xff,0xff,0xff,0xff,0x01}; | ||
4986 | 5062 | ||
4987 | if (refresh) { | 5063 | if (refresh) { |
4988 | error=N6510_GetCalendarInfo3(s,LastToDo,false); | 5064 | error=N6510_GetCalendarInfo3(s,LastToDo,1); |
4989 | if (error!=ERR_NONE) return error; | 5065 | if (error!=ERR_NONE) return error; |
4990 | ToDo->Location = 1; | 5066 | ToDo->Location = 1; |
4991 | } else { | 5067 | } else { |
4992 | ToDo->Location++; | 5068 | ToDo->Location++; |
4993 | } | 5069 | } |
4994 | 5070 | ||
4995 | if (ToDo->Location > LastToDo->Number) return ERR_EMPTY; | 5071 | if (ToDo->Location > LastToDo->Number) return ERR_EMPTY; |
4996 | 5072 | ||
4997 | req[8] = LastToDo->Location[ToDo->Location-1] / 256; | ||
4998 | req[9] = LastToDo->Location[ToDo->Location-1] % 256; | ||
4999 | |||
5000 | s->Phone.Data.ToDo = ToDo; | 5073 | s->Phone.Data.ToDo = ToDo; |
5001 | smprintf(s, "Getting todo method 2\n"); | 5074 | smprintf(s, "Getting todo method 2\n"); |
5002 | return GSM_WaitFor (s, req, 15, 0x13, 4, ID_GetToDo); | 5075 | return N6510_PrivGetGenericCalendar3(s, LastToDo->Location[ToDo->Location-1], ID_GetToDo); |
5003 | } | 5076 | } |
5004 | 5077 | ||
5005 | static GSM_Error N6510_GetNextToDo(GSM_StateMachine *s, GSM_ToDoEntry *ToDo, bool refresh) | 5078 | static GSM_Error N6510_GetNextToDo(GSM_StateMachine *s, GSM_ToDoEntry *ToDo, bool refresh) |
5006 | { | 5079 | { |
5007 | if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_TODO63)) { | 5080 | if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_TODO63)) { |
5008 | return N6510_GetNextToDo1(s, ToDo, refresh); | 5081 | return N6510_GetNextToDo1(s, ToDo, refresh); |
5009 | } else if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_TODO66)) { | 5082 | } else if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_TODO66)) { |
5010 | return N6510_GetNextToDo2(s, ToDo, refresh); | 5083 | return N6510_GetNextToDo2(s, ToDo, refresh); |
5011 | } else { | 5084 | } else { |
5012 | return ERR_NOTSUPPORTED; | 5085 | return ERR_NOTSUPPORTED; |
5013 | } | 5086 | } |
5014 | } | 5087 | } |
@@ -5034,25 +5107,25 @@ static GSM_Error N6510_DeleteAllToDo1(GSM_StateMachine *s) | |||
5034 | } | 5107 | } |
5035 | 5108 | ||
5036 | static GSM_Error N6510_DeleteToDo2(GSM_StateMachine *s, GSM_ToDoEntry *ToDo) | 5109 | static GSM_Error N6510_DeleteToDo2(GSM_StateMachine *s, GSM_ToDoEntry *ToDo) |
5037 | { | 5110 | { |
5038 | GSM_Error error; | 5111 | GSM_Error error; |
5039 | GSM_NOKIACalToDoLocations *LastToDo = &s->Phone.Data.Priv.N6510.LastToDo; | 5112 | GSM_NOKIACalToDoLocations *LastToDo = &s->Phone.Data.Priv.N6510.LastToDo; |
5040 | GSM_CalendarEntry Note; | 5113 | GSM_CalendarEntry Note; |
5041 | 5114 | ||
5042 | if (!IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_TODO66)) { | 5115 | if (!IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_TODO66)) { |
5043 | return ERR_NOTSUPPORTED; | 5116 | return ERR_NOTSUPPORTED; |
5044 | } | 5117 | } |
5045 | 5118 | ||
5046 | error=N6510_GetCalendarInfo3(s,LastToDo,false); | 5119 | error=N6510_GetCalendarInfo3(s,LastToDo,1); |
5047 | if (error!=ERR_NONE) return error; | 5120 | if (error!=ERR_NONE) return error; |
5048 | 5121 | ||
5049 | smprintf(s, "Deleting ToDo method 2\n"); | 5122 | smprintf(s, "Deleting ToDo method 2\n"); |
5050 | 5123 | ||
5051 | if (ToDo->Location > LastToDo->Number || ToDo->Location == 0) return ERR_INVALIDLOCATION; | 5124 | if (ToDo->Location > LastToDo->Number || ToDo->Location == 0) return ERR_INVALIDLOCATION; |
5052 | 5125 | ||
5053 | Note.Location = LastToDo->Location[ToDo->Location-1]; | 5126 | Note.Location = LastToDo->Location[ToDo->Location-1]; |
5054 | return N71_65_DelCalendar(s,&Note); | 5127 | return N71_65_DelCalendar(s,&Note); |
5055 | } | 5128 | } |
5056 | 5129 | ||
5057 | /* ToDo support - 6310 style */ | 5130 | /* ToDo support - 6310 style */ |
5058 | static GSM_Error N6510_ReplyGetToDoFirstLoc1(GSM_Protocol_Message msg, GSM_StateMachine *s) | 5131 | static GSM_Error N6510_ReplyGetToDoFirstLoc1(GSM_Protocol_Message msg, GSM_StateMachine *s) |
@@ -5442,31 +5515,37 @@ static GSM_Reply_Function N6510ReplyFunctions[] = { | |||
5442 | {N71_65_ReplyCallInfo, "\x01",0x03,0x02,ID_IncomingFrame }, | 5515 | {N71_65_ReplyCallInfo, "\x01",0x03,0x02,ID_IncomingFrame }, |
5443 | {N71_65_ReplyCallInfo, "\x01",0x03,0x03,ID_IncomingFrame }, | 5516 | {N71_65_ReplyCallInfo, "\x01",0x03,0x03,ID_IncomingFrame }, |
5444 | {N71_65_ReplyCallInfo, "\x01",0x03,0x04,ID_IncomingFrame }, | 5517 | {N71_65_ReplyCallInfo, "\x01",0x03,0x04,ID_IncomingFrame }, |
5445 | {N71_65_ReplyCallInfo, "\x01",0x03,0x05,ID_IncomingFrame }, | 5518 | {N71_65_ReplyCallInfo, "\x01",0x03,0x05,ID_IncomingFrame }, |
5446 | {N71_65_ReplyCallInfo, "\x01",0x03,0x07,ID_AnswerCall }, | 5519 | {N71_65_ReplyCallInfo, "\x01",0x03,0x07,ID_AnswerCall }, |
5447 | {N71_65_ReplyCallInfo, "\x01",0x03,0x07,ID_IncomingFrame }, | 5520 | {N71_65_ReplyCallInfo, "\x01",0x03,0x07,ID_IncomingFrame }, |
5448 | {N71_65_ReplyCallInfo, "\x01",0x03,0x09,ID_CancelCall }, | 5521 | {N71_65_ReplyCallInfo, "\x01",0x03,0x09,ID_CancelCall }, |
5449 | {N71_65_ReplyCallInfo, "\x01",0x03,0x09,ID_IncomingFrame }, | 5522 | {N71_65_ReplyCallInfo, "\x01",0x03,0x09,ID_IncomingFrame }, |
5450 | {N71_65_ReplyCallInfo, "\x01",0x03,0x0A,ID_IncomingFrame }, | 5523 | {N71_65_ReplyCallInfo, "\x01",0x03,0x0A,ID_IncomingFrame }, |
5451 | {N71_65_ReplyCallInfo, "\x01",0x03,0x0B,ID_IncomingFrame }, | 5524 | {N71_65_ReplyCallInfo, "\x01",0x03,0x0B,ID_IncomingFrame }, |
5452 | {N71_65_ReplyCallInfo, "\x01",0x03,0x0C,ID_DialVoice }, | 5525 | {N71_65_ReplyCallInfo, "\x01",0x03,0x0C,ID_DialVoice }, |
5453 | {N71_65_ReplyCallInfo, "\x01",0x03,0x0C,ID_IncomingFrame }, | 5526 | {N71_65_ReplyCallInfo, "\x01",0x03,0x0C,ID_IncomingFrame }, |
5527 | {N71_65_ReplyCallInfo, "\x01",0x03,0x0F,ID_IncomingFrame }, | ||
5528 | {N71_65_ReplyCallInfo, "\x01",0x03,0x10,ID_DialVoice }, | ||
5529 | {N71_65_ReplyCallInfo, "\x01",0x03,0x10,ID_IncomingFrame }, | ||
5454 | {N71_65_ReplyCallInfo, "\x01",0x03,0x23,ID_IncomingFrame }, | 5530 | {N71_65_ReplyCallInfo, "\x01",0x03,0x23,ID_IncomingFrame }, |
5455 | {N71_65_ReplyCallInfo, "\x01",0x03,0x25,ID_IncomingFrame }, | 5531 | {N71_65_ReplyCallInfo, "\x01",0x03,0x25,ID_IncomingFrame }, |
5456 | {N71_65_ReplyCallInfo, "\x01",0x03,0x27,ID_IncomingFrame }, | 5532 | {N71_65_ReplyCallInfo, "\x01",0x03,0x27,ID_IncomingFrame }, |
5457 | {N71_65_ReplySendDTMF, "\x01",0x03,0x51,ID_SendDTMF }, | 5533 | {N71_65_ReplySendDTMF, "\x01",0x03,0x51,ID_SendDTMF }, |
5458 | {N71_65_ReplyCallInfo, "\x01",0x03,0x53,ID_IncomingFrame }, | 5534 | {N71_65_ReplyCallInfo, "\x01",0x03,0x53,ID_IncomingFrame }, |
5459 | {N71_65_ReplySendDTMF, "\x01",0x03,0x59,ID_SendDTMF }, | 5535 | {N71_65_ReplySendDTMF, "\x01",0x03,0x59,ID_SendDTMF }, |
5460 | {N71_65_ReplySendDTMF, "\x01",0x03,0x5E,ID_SendDTMF }, | 5536 | {N71_65_ReplySendDTMF, "\x01",0x03,0x5E,ID_SendDTMF }, |
5537 | {N71_65_ReplyCallInfo, "\x01",0x03,0xA6,ID_IncomingFrame }, | ||
5538 | {N71_65_ReplyCallInfo, "\x01",0x03,0xD2,ID_IncomingFrame }, | ||
5539 | {N71_65_ReplyCallInfo, "\x01",0x03,0xD3,ID_IncomingFrame }, | ||
5461 | 5540 | ||
5462 | {N6510_ReplySendSMSMessage, "\x02",0x03,0x03,ID_IncomingFrame }, | 5541 | {N6510_ReplySendSMSMessage, "\x02",0x03,0x03,ID_IncomingFrame }, |
5463 | {N6510_ReplyIncomingSMS, "\x02",0x03,0x04,ID_IncomingFrame }, | 5542 | {N6510_ReplyIncomingSMS, "\x02",0x03,0x04,ID_IncomingFrame }, |
5464 | {N6510_ReplySetSMSC, "\x02",0x03,0x13,ID_SetSMSC }, | 5543 | {N6510_ReplySetSMSC, "\x02",0x03,0x13,ID_SetSMSC }, |
5465 | {N6510_ReplyGetSMSC, "\x02",0x03,0x15,ID_GetSMSC }, | 5544 | {N6510_ReplyGetSMSC, "\x02",0x03,0x15,ID_GetSMSC }, |
5466 | 5545 | ||
5467 | {N6510_ReplyGetMemoryStatus, "\x03",0x03,0x04,ID_GetMemoryStatus }, | 5546 | {N6510_ReplyGetMemoryStatus, "\x03",0x03,0x04,ID_GetMemoryStatus }, |
5468 | {N6510_ReplyGetMemory, "\x03",0x03,0x08,ID_GetMemory }, | 5547 | {N6510_ReplyGetMemory, "\x03",0x03,0x08,ID_GetMemory }, |
5469 | {N6510_ReplyDeleteMemory, "\x03",0x03,0x10,ID_SetMemory }, | 5548 | {N6510_ReplyDeleteMemory, "\x03",0x03,0x10,ID_SetMemory }, |
5470 | {N71_65_ReplyWritePhonebook, "\x03",0x03,0x0C,ID_SetBitmap }, | 5549 | {N71_65_ReplyWritePhonebook, "\x03",0x03,0x0C,ID_SetBitmap }, |
5471 | {N71_65_ReplyWritePhonebook, "\x03",0x03,0x0C,ID_SetMemory }, | 5550 | {N71_65_ReplyWritePhonebook, "\x03",0x03,0x0C,ID_SetMemory }, |
5472 | 5551 | ||
@@ -5499,31 +5578,33 @@ static GSM_Reply_Function N6510ReplyFunctions[] = { | |||
5499 | {N71_65_ReplyDelCalendar, "\x13",0x03,0x0C,ID_DeleteCalendarNote }, | 5578 | {N71_65_ReplyDelCalendar, "\x13",0x03,0x0C,ID_DeleteCalendarNote }, |
5500 | {N71_65_ReplyGetNextCalendar1, "\x13",0x03,0x1A,ID_GetCalendarNote },/*method 1*/ | 5579 | {N71_65_ReplyGetNextCalendar1, "\x13",0x03,0x1A,ID_GetCalendarNote },/*method 1*/ |
5501 | {N6510_ReplyGetCalendarNotePos, "\x13",0x03,0x32,ID_GetCalendarNotePos },/*method 1*/ | 5580 | {N6510_ReplyGetCalendarNotePos, "\x13",0x03,0x32,ID_GetCalendarNotePos },/*method 1*/ |
5502 | {N6510_ReplyGetCalendarInfo, "\x13",0x03,0x3B,ID_GetCalendarNotesInfo},/*method 1*/ | 5581 | {N6510_ReplyGetCalendarInfo, "\x13",0x03,0x3B,ID_GetCalendarNotesInfo},/*method 1*/ |
5503 | #ifdef DEBUG | 5582 | #ifdef DEBUG |
5504 | {N71_65_ReplyGetNextCalendar2, "\x13",0x03,0x3F,ID_GetCalendarNote }, | 5583 | {N71_65_ReplyGetNextCalendar2, "\x13",0x03,0x3F,ID_GetCalendarNote }, |
5505 | #endif | 5584 | #endif |
5506 | {N71_65_ReplyAddCalendar2, "\x13",0x03,0x41,ID_SetCalendarNote },/*method 2*/ | 5585 | {N71_65_ReplyAddCalendar2, "\x13",0x03,0x41,ID_SetCalendarNote },/*method 2*/ |
5507 | {N6510_ReplyAddCalendar3, "\x13",0x03,0x66,ID_SetCalendarNote },/*method 3*/ | 5586 | {N6510_ReplyAddCalendar3, "\x13",0x03,0x66,ID_SetCalendarNote },/*method 3*/ |
5508 | {N6510_ReplyAddToDo2, "\x13",0x03,0x66,ID_SetToDo }, | 5587 | {N6510_ReplyAddToDo2, "\x13",0x03,0x66,ID_SetToDo }, |
5509 | {N6510_ReplyGetCalendar3, "\x13",0x03,0x7E,ID_GetCalendarNote },/*method 3*/ | 5588 | {N6510_ReplyGetCalendar3, "\x13",0x03,0x7E,ID_GetCalendarNote },/*method 3*/ |
5510 | {N6510_ReplyGetToDo2, "\x13",0x03,0x7E,ID_GetToDo }, | 5589 | {N6510_ReplyGetToDo2, "\x13",0x03,0x7E,ID_GetToDo }, |
5590 | {N6510_ReplyGetNote, "\x13",0x03,0x7E,ID_GetNote }, | ||
5511 | {N6510_ReplyGetCalendarSettings, "\x13",0x03,0x86,ID_GetCalendarSettings }, | 5591 | {N6510_ReplyGetCalendarSettings, "\x13",0x03,0x86,ID_GetCalendarSettings }, |
5512 | {N6510_ReplyGetLocale, "\x13",0x03,0x8A,ID_GetLocale }, | 5592 | {N6510_ReplyGetLocale, "\x13",0x03,0x8A,ID_GetLocale }, |
5513 | {N6510_ReplyGetCalendarSettings, "\x13",0x03,0x8E,ID_GetCalendarSettings }, | 5593 | {N6510_ReplyGetCalendarSettings, "\x13",0x03,0x8E,ID_GetCalendarSettings }, |
5514 | {N6510_ReplyGetCalendarNotePos, "\x13",0x03,0x96,ID_GetCalendarNotePos },/*method 3*/ | 5594 | {N6510_ReplyGetCalendarNotePos, "\x13",0x03,0x96,ID_GetCalendarNotePos },/*method 3*/ |
5515 | {N6510_ReplyGetToDoFirstLoc2, "\x13",0x03,0x96,ID_SetToDo }, | 5595 | {N6510_ReplyGetToDoFirstLoc2, "\x13",0x03,0x96,ID_SetToDo }, |
5516 | {N6510_ReplyGetCalendarInfo, "\x13",0x03,0x9F,ID_GetCalendarNotesInfo},/*method 3*/ | 5596 | {N6510_ReplyGetCalendarInfo, "\x13",0x03,0x9F,ID_GetCalendarNotesInfo},/*method 3*/ |
5517 | {N6510_ReplyGetToDoStatus2, "\x13",0x03,0x9F,ID_GetToDo }, | 5597 | {N6510_ReplyGetToDoStatus2, "\x13",0x03,0x9F,ID_GetToDo }, |
5598 | {N6510_ReplyGetNoteInfo, "\x13",0x03,0x9F,ID_GetNote }, | ||
5518 | 5599 | ||
5519 | {N6510_ReplySaveSMSMessage, "\x14",0x03,0x01,ID_SaveSMSMessage }, | 5600 | {N6510_ReplySaveSMSMessage, "\x14",0x03,0x01,ID_SaveSMSMessage }, |
5520 | {N6510_ReplySetPicture, "\x14",0x03,0x01,ID_SetBitmap }, | 5601 | {N6510_ReplySetPicture, "\x14",0x03,0x01,ID_SetBitmap }, |
5521 | {N6510_ReplyGetSMSMessage, "\x14",0x03,0x03,ID_GetSMSMessage }, | 5602 | {N6510_ReplyGetSMSMessage, "\x14",0x03,0x03,ID_GetSMSMessage }, |
5522 | {N6510_ReplyDeleteSMSMessage, "\x14",0x03,0x05,ID_DeleteSMSMessage }, | 5603 | {N6510_ReplyDeleteSMSMessage, "\x14",0x03,0x05,ID_DeleteSMSMessage }, |
5523 | {N6510_ReplyDeleteSMSMessage, "\x14",0x03,0x06,ID_DeleteSMSMessage }, | 5604 | {N6510_ReplyDeleteSMSMessage, "\x14",0x03,0x06,ID_DeleteSMSMessage }, |
5524 | {N6510_ReplyGetSMSStatus, "\x14",0x03,0x09,ID_GetSMSStatus }, | 5605 | {N6510_ReplyGetSMSStatus, "\x14",0x03,0x09,ID_GetSMSStatus }, |
5525 | {N6510_ReplyGetSMSFolderStatus, "\x14",0x03,0x0d,ID_GetSMSFolderStatus }, | 5606 | {N6510_ReplyGetSMSFolderStatus, "\x14",0x03,0x0d,ID_GetSMSFolderStatus }, |
5526 | {N6510_ReplyGetSMSMessage, "\x14",0x03,0x0f,ID_GetSMSMessage }, | 5607 | {N6510_ReplyGetSMSMessage, "\x14",0x03,0x0f,ID_GetSMSMessage }, |
5527 | {N6510_ReplyAddSMSFolder, "\x14",0x03,0x11,ID_AddSMSFolder }, | 5608 | {N6510_ReplyAddSMSFolder, "\x14",0x03,0x11,ID_AddSMSFolder }, |
5528 | {N6510_ReplyGetSMSFolders, "\x14",0x03,0x13,ID_GetSMSFolders }, | 5609 | {N6510_ReplyGetSMSFolders, "\x14",0x03,0x13,ID_GetSMSFolders }, |
5529 | {N6510_ReplySaveSMSMessage, "\x14",0x03,0x17,ID_SaveSMSMessage }, | 5610 | {N6510_ReplySaveSMSMessage, "\x14",0x03,0x17,ID_SaveSMSMessage }, |
@@ -5642,25 +5723,25 @@ static GSM_Reply_Function N6510ReplyFunctions[] = { | |||
5642 | 5723 | ||
5643 | {DCT3DCT4_ReplyGetModelFirmware, "\xD2",0x02,0x00,ID_GetModel }, | 5724 | {DCT3DCT4_ReplyGetModelFirmware, "\xD2",0x02,0x00,ID_GetModel }, |
5644 | {DCT3DCT4_ReplyGetModelFirmware, "\xD2",0x02,0x00,ID_GetFirmware }, | 5725 | {DCT3DCT4_ReplyGetModelFirmware, "\xD2",0x02,0x00,ID_GetFirmware }, |
5645 | 5726 | ||
5646 | /* 0xD7 - Bluetooth */ | 5727 | /* 0xD7 - Bluetooth */ |
5647 | 5728 | ||
5648 | {N6510_ReplyGetRingtoneID, "\xDB",0x03,0x02,ID_SetRingtone }, | 5729 | {N6510_ReplyGetRingtoneID, "\xDB",0x03,0x02,ID_SetRingtone }, |
5649 | 5730 | ||
5650 | {NULL, "\x00",0x00,0x00,ID_None } | 5731 | {NULL, "\x00",0x00,0x00,ID_None } |
5651 | }; | 5732 | }; |
5652 | 5733 | ||
5653 | GSM_Phone_Functions N6510Phone = { | 5734 | GSM_Phone_Functions N6510Phone = { |
5654 | "1100|1100a|1100b|3100|3100b|3108|3200|3200a|3300|3510|3510i|3530|3589i|3590|3595|5100|6100|6200|6220|6230|6310|6310i|6385|6510|6610|6800|7210|7250|7250i|7600|8310|8390|8910|8910i", | 5735 | "1100|1100a|1100b|3100|3100b|3108|3200|3200a|3300|3510|3510i|3530|3589i|3590|3595|5100|5140|6100|6200|6220|6230|6310|6310i|6385|6510|6610|6610i|6800|6810|6820|7210|7250|7250i|7600|8310|8390|8910|8910i", |
5655 | N6510ReplyFunctions, | 5736 | N6510ReplyFunctions, |
5656 | N6510_Initialise, | 5737 | N6510_Initialise, |
5657 | NONEFUNCTION, /* Terminate */ | 5738 | NONEFUNCTION, /* Terminate */ |
5658 | GSM_DispatchMessage, | 5739 | GSM_DispatchMessage, |
5659 | N6510_ShowStartInfo, | 5740 | N6510_ShowStartInfo, |
5660 | NOKIA_GetManufacturer, | 5741 | NOKIA_GetManufacturer, |
5661 | DCT3DCT4_GetModel, | 5742 | DCT3DCT4_GetModel, |
5662 | DCT3DCT4_GetFirmware, | 5743 | DCT3DCT4_GetFirmware, |
5663 | DCT4_GetIMEI, | 5744 | DCT4_GetIMEI, |
5664 | N6510_GetOriginalIMEI, | 5745 | N6510_GetOriginalIMEI, |
5665 | N6510_GetManufactureMonth, | 5746 | N6510_GetManufactureMonth, |
5666 | DCT4_GetProductCode, | 5747 | DCT4_GetProductCode, |
@@ -5696,24 +5777,25 @@ GSM_Phone_Functions N6510Phone = { | |||
5696 | N6510_GetSpeedDial, | 5777 | N6510_GetSpeedDial, |
5697 | NOTIMPLEMENTED, /* SetSpeedDial */ | 5778 | NOTIMPLEMENTED, /* SetSpeedDial */ |
5698 | N6510_GetSMSC, | 5779 | N6510_GetSMSC, |
5699 | N6510_SetSMSC, | 5780 | N6510_SetSMSC, |
5700 | N6510_GetSMSStatus, | 5781 | N6510_GetSMSStatus, |
5701 | N6510_GetSMSMessage, | 5782 | N6510_GetSMSMessage, |
5702 | N6510_GetNextSMSMessage, | 5783 | N6510_GetNextSMSMessage, |
5703 | N6510_SetSMS, | 5784 | N6510_SetSMS, |
5704 | N6510_AddSMS, | 5785 | N6510_AddSMS, |
5705 | N6510_DeleteSMSMessage, | 5786 | N6510_DeleteSMSMessage, |
5706 | N6510_SendSMSMessage, | 5787 | N6510_SendSMSMessage, |
5707 | NOTSUPPORTED, /* SendSavedSMS */ | 5788 | NOTSUPPORTED, /* SendSavedSMS */ |
5789 | NOTSUPPORTED, /* SetFastSMSSending*/ | ||
5708 | NOKIA_SetIncomingSMS, | 5790 | NOKIA_SetIncomingSMS, |
5709 | NOTIMPLEMENTED, /* SetIncomingCB */ | 5791 | NOTIMPLEMENTED, /* SetIncomingCB */ |
5710 | N6510_GetSMSFolders, | 5792 | N6510_GetSMSFolders, |
5711 | N6510_AddSMSFolder, | 5793 | N6510_AddSMSFolder, |
5712 | NOTIMPLEMENTED, /* DeleteSMSFolder */ | 5794 | NOTIMPLEMENTED, /* DeleteSMSFolder */ |
5713 | N6510_DialVoice, | 5795 | N6510_DialVoice, |
5714 | N6510_AnswerCall, | 5796 | N6510_AnswerCall, |
5715 | N6510_CancelCall, | 5797 | N6510_CancelCall, |
5716 | NOTIMPLEMENTED, /* HoldCall */ | 5798 | NOTIMPLEMENTED, /* HoldCall */ |
5717 | NOTIMPLEMENTED, /* UnholdCall */ | 5799 | NOTIMPLEMENTED, /* UnholdCall */ |
5718 | NOTIMPLEMENTED, /* ConferenceCall */ | 5800 | NOTIMPLEMENTED, /* ConferenceCall */ |
5719 | NOTIMPLEMENTED, /* SplitCall */ | 5801 | NOTIMPLEMENTED, /* SplitCall */ |
@@ -5750,25 +5832,25 @@ GSM_Phone_Functions N6510Phone = { | |||
5750 | N6510_AddToDo, | 5832 | N6510_AddToDo, |
5751 | N6510_DeleteToDo2, | 5833 | N6510_DeleteToDo2, |
5752 | N6510_DeleteAllToDo1, | 5834 | N6510_DeleteAllToDo1, |
5753 | N6510_GetCalendarStatus, | 5835 | N6510_GetCalendarStatus, |
5754 | NOTIMPLEMENTED, /* GetCalendar */ | 5836 | NOTIMPLEMENTED, /* GetCalendar */ |
5755 | N6510_GetNextCalendar, | 5837 | N6510_GetNextCalendar, |
5756 | NOTIMPLEMENTED, /* SetCalendar */ | 5838 | NOTIMPLEMENTED, /* SetCalendar */ |
5757 | N6510_AddCalendar, | 5839 | N6510_AddCalendar, |
5758 | N71_65_DelCalendar, | 5840 | N71_65_DelCalendar, |
5759 | NOTIMPLEMENTED, /* DeleteAllCalendar*/ | 5841 | NOTIMPLEMENTED, /* DeleteAllCalendar*/ |
5760 | N6510_GetCalendarSettings, | 5842 | N6510_GetCalendarSettings, |
5761 | NOTSUPPORTED, /* SetCalendarSettings*/ | 5843 | NOTSUPPORTED, /* SetCalendarSettings*/ |
5762 | NOTIMPLEMENTED, /* GetNote */ | 5844 | N6510_GetNextNote, |
5763 | N6510_GetProfile, | 5845 | N6510_GetProfile, |
5764 | N6510_SetProfile, | 5846 | N6510_SetProfile, |
5765 | N6510_GetFMStation, | 5847 | N6510_GetFMStation, |
5766 | N6510_SetFMStation, | 5848 | N6510_SetFMStation, |
5767 | N6510_ClearFMStations, | 5849 | N6510_ClearFMStations, |
5768 | N6510_GetNextFileFolder, | 5850 | N6510_GetNextFileFolder, |
5769 | N6510_GetFilePart, | 5851 | N6510_GetFilePart, |
5770 | N6510_AddFilePart, | 5852 | N6510_AddFilePart, |
5771 | N6510_GetFileSystemStatus, | 5853 | N6510_GetFileSystemStatus, |
5772 | N6510_DeleteFile, | 5854 | N6510_DeleteFile, |
5773 | N6510_AddFolder, | 5855 | N6510_AddFolder, |
5774 | N6510_GetGPRSAccessPoint, | 5856 | N6510_GetGPRSAccessPoint, |
diff --git a/gammu/emb/common/phone/nokia/dct4/n6510.h b/gammu/emb/common/phone/nokia/dct4/n6510.h index 4717aeb..26623d6 100644 --- a/gammu/emb/common/phone/nokia/dct4/n6510.h +++ b/gammu/emb/common/phone/nokia/dct4/n6510.h | |||
@@ -25,24 +25,26 @@ typedef struct { | |||
25 | int LastCalendarPos; | 25 | int LastCalendarPos; |
26 | GSM_NOKIACalToDoLocationsLastCalendar; | 26 | GSM_NOKIACalToDoLocationsLastCalendar; |
27 | int FirstCalendarPos; | 27 | int FirstCalendarPos; |
28 | unsigned char CalendarIcons[10]; | 28 | unsigned char CalendarIcons[10]; |
29 | GSM_CalendarNoteType CalendarIconsTypes[10]; | 29 | GSM_CalendarNoteType CalendarIconsTypes[10]; |
30 | int CalendarIconsNum; | 30 | int CalendarIconsNum; |
31 | 31 | ||
32 | GSM_NOKIASMSFolder LastSMSFolder; | 32 | GSM_NOKIASMSFolder LastSMSFolder; |
33 | GSM_SMSFolders LastSMSFolders; | 33 | GSM_SMSFolders LastSMSFolders; |
34 | 34 | ||
35 | GSM_NOKIACalToDoLocationsLastToDo; | 35 | GSM_NOKIACalToDoLocationsLastToDo; |
36 | 36 | ||
37 | GSM_NOKIACalToDoLocationsLastNote; | ||
38 | |||
37 | unsigned char RingtoneID;/* When set with preview */ | 39 | unsigned char RingtoneID;/* When set with preview */ |
38 | 40 | ||
39 | int FilesLocations[1000]; | 41 | int FilesLocations[1000]; |
40 | int FilesLevels[1000]; | 42 | int FilesLevels[1000]; |
41 | int FilesLocationsUsed; | 43 | int FilesLocationsUsed; |
42 | int FilesLocationsCurrent; | 44 | int FilesLocationsCurrent; |
43 | int FileToken; | 45 | int FileToken; |
44 | int ParentID; | 46 | int ParentID; |
45 | int FileCheckSum; | 47 | int FileCheckSum; |
46 | 48 | ||
47 | unsigned char FMStatus[4000]; | 49 | unsigned char FMStatus[4000]; |
48 | int FMStatusLength; | 50 | int FMStatusLength; |
diff --git a/gammu/emb/common/phone/nokia/nauto.c b/gammu/emb/common/phone/nokia/nauto.c index bf74bc9..3bb53ec 100644 --- a/gammu/emb/common/phone/nokia/nauto.c +++ b/gammu/emb/common/phone/nokia/nauto.c | |||
@@ -112,25 +112,25 @@ GSM_Phone_Functions NAUTOPhone = { | |||
112 | NOTSUPPORTED, /* AddToDo */ | 112 | NOTSUPPORTED, /* AddToDo */ |
113 | NOTSUPPORTED, /* DeleteToDo */ | 113 | NOTSUPPORTED, /* DeleteToDo */ |
114 | NOTSUPPORTED, /* DeleteAllToDo */ | 114 | NOTSUPPORTED, /* DeleteAllToDo */ |
115 | NOTSUPPORTED, /* GetCalendarStatus*/ | 115 | NOTSUPPORTED, /* GetCalendarStatus*/ |
116 | NOTSUPPORTED, /* GetCalendar */ | 116 | NOTSUPPORTED, /* GetCalendar */ |
117 | NOTSUPPORTED, /* GetNextCalendar */ | 117 | NOTSUPPORTED, /* GetNextCalendar */ |
118 | NOTSUPPORTED, /* SetCalendar */ | 118 | NOTSUPPORTED, /* SetCalendar */ |
119 | NOTSUPPORTED, /* AddCalendar */ | 119 | NOTSUPPORTED, /* AddCalendar */ |
120 | NOTSUPPORTED, /* DeleteCalendar */ | 120 | NOTSUPPORTED, /* DeleteCalendar */ |
121 | NOTSUPPORTED, /* DeleteAllCalendar*/ | 121 | NOTSUPPORTED, /* DeleteAllCalendar*/ |
122 | NOTSUPPORTED, /* GetCalendarSettings*/ | 122 | NOTSUPPORTED, /* GetCalendarSettings*/ |
123 | NOTSUPPORTED, /* SetCalendarSettings*/ | 123 | NOTSUPPORTED, /* SetCalendarSettings*/ |
124 | NOTSUPPORTED, /* GetNote */ | 124 | NOTSUPPORTED, /* GetNextNote */ |
125 | NOTSUPPORTED, /* GetProfile */ | 125 | NOTSUPPORTED, /* GetProfile */ |
126 | NOTSUPPORTED, /* SetProfile */ | 126 | NOTSUPPORTED, /* SetProfile */ |
127 | NOTSUPPORTED, /* GetFMStation */ | 127 | NOTSUPPORTED, /* GetFMStation */ |
128 | NOTSUPPORTED, /* SetFMStation */ | 128 | NOTSUPPORTED, /* SetFMStation */ |
129 | NOTSUPPORTED, /* ClearFMStations */ | 129 | NOTSUPPORTED, /* ClearFMStations */ |
130 | NOTSUPPORTED, /* GetNextFileFolder*/ | 130 | NOTSUPPORTED, /* GetNextFileFolder*/ |
131 | NOTSUPPORTED, /* GetFilePart */ | 131 | NOTSUPPORTED, /* GetFilePart */ |
132 | NOTSUPPORTED, /* AddFilePart */ | 132 | NOTSUPPORTED, /* AddFilePart */ |
133 | NOTSUPPORTED, /* GetFileSystemStatus*/ | 133 | NOTSUPPORTED, /* GetFileSystemStatus*/ |
134 | NOTSUPPORTED, /* DeleteFile */ | 134 | NOTSUPPORTED, /* DeleteFile */ |
135 | NOTSUPPORTED, /* AddFolder */ | 135 | NOTSUPPORTED, /* AddFolder */ |
136 | NOTSUPPORTED, /* GetGPRSAccessPoint*/ | 136 | NOTSUPPORTED, /* GetGPRSAccessPoint*/ |
diff --git a/gammu/emb/common/phone/nokia/nfunc.c b/gammu/emb/common/phone/nokia/nfunc.c index 3acfb10..d4d8b03 100644 --- a/gammu/emb/common/phone/nokia/nfunc.c +++ b/gammu/emb/common/phone/nokia/nfunc.c | |||
@@ -1384,53 +1384,67 @@ GSM_Error N71_65_ReplyCallInfo(GSM_Protocol_Message msg, GSM_StateMachine *s) | |||
1384 | smprintf(s, "Call is being released\n"); | 1384 | smprintf(s, "Call is being released\n"); |
1385 | break; | 1385 | break; |
1386 | case 0x0b: | 1386 | case 0x0b: |
1387 | smprintf(s, "Meaning not known\n"); | 1387 | smprintf(s, "Meaning not known\n"); |
1388 | call.CallIDAvailable = false; | 1388 | call.CallIDAvailable = false; |
1389 | break; | 1389 | break; |
1390 | case 0x0c: | 1390 | case 0x0c: |
1391 | smprintf(s, "Audio status\n"); | 1391 | smprintf(s, "Audio status\n"); |
1392 | if (msg.Buffer[4] == 0x01) smprintf(s, "Audio enabled\n"); | 1392 | if (msg.Buffer[4] == 0x01) smprintf(s, "Audio enabled\n"); |
1393 | else smprintf(s, "Audio disabled\n"); | 1393 | else smprintf(s, "Audio disabled\n"); |
1394 | call.CallIDAvailable = false; | 1394 | call.CallIDAvailable = false; |
1395 | break; | 1395 | break; |
1396 | case 0x0f: | ||
1397 | case 0x10: | ||
1398 | smprintf(s, "Meaning not known\n"); | ||
1399 | call.CallIDAvailable = false; | ||
1400 | break; | ||
1396 | case 0x23: | 1401 | case 0x23: |
1397 | smprintf(s, "Call held\n"); | 1402 | smprintf(s, "Call held\n"); |
1398 | call.Status = GSM_CALL_CallHeld; | 1403 | call.Status = GSM_CALL_CallHeld; |
1399 | break; | 1404 | break; |
1400 | case 0x25: | 1405 | case 0x25: |
1401 | smprintf(s, "Call resumed\n"); | 1406 | smprintf(s, "Call resumed\n"); |
1402 | call.Status = GSM_CALL_CallResumed; | 1407 | call.Status = GSM_CALL_CallResumed; |
1403 | break; | 1408 | break; |
1404 | case 0x27: | 1409 | case 0x27: |
1405 | smprintf(s, "Call switched\n"); | 1410 | smprintf(s, "Call switched\n"); |
1406 | call.Status = GSM_CALL_CallSwitched; | 1411 | call.Status = GSM_CALL_CallSwitched; |
1407 | break; | 1412 | break; |
1408 | case 0x53: | 1413 | case 0x53: |
1409 | smprintf(s, "Outgoing call\n"); | 1414 | smprintf(s, "Outgoing call\n"); |
1410 | smprintf(s, "Call mode : %i\n",msg.Buffer[5]);//such interpretation is in gnokii | 1415 | smprintf(s, "Call mode : %i\n",msg.Buffer[5]);//such interpretation is in gnokii |
1411 | tmp = 6; | 1416 | tmp = 6; |
1412 | NOKIA_GetUnicodeString(s, &tmp, msg.Buffer,buffer,false); | 1417 | NOKIA_GetUnicodeString(s, &tmp, msg.Buffer,buffer,false); |
1413 | smprintf(s, "Number : \"%s\"\n",DecodeUnicodeString(buffer)); | 1418 | smprintf(s, "Number : \"%s\"\n",DecodeUnicodeString(buffer)); |
1414 | /* FIXME: read name from frame */ | 1419 | /* FIXME: read name from frame */ |
1415 | call.Status = GSM_CALL_OutgoingCall; | 1420 | call.Status = GSM_CALL_OutgoingCall; |
1416 | tmp = 6; | 1421 | tmp = 6; |
1417 | NOKIA_GetUnicodeString(s, &tmp, msg.Buffer,call.PhoneNumber,false); | 1422 | NOKIA_GetUnicodeString(s, &tmp, msg.Buffer,call.PhoneNumber,false); |
1418 | break; | 1423 | break; |
1424 | case 0xA6: | ||
1425 | case 0xD2: | ||
1426 | case 0xD3: | ||
1427 | smprintf(s, "Meaning not known\n"); | ||
1428 | call.CallIDAvailable = false; | ||
1429 | break; | ||
1419 | } | 1430 | } |
1420 | if (call.CallIDAvailable) smprintf(s, "Call ID : %d\n",msg.Buffer[4]); | 1431 | if (call.CallIDAvailable) smprintf(s, "Call ID : %d\n",msg.Buffer[4]); |
1421 | if (s->Phone.Data.EnableIncomingCall && s->User.IncomingCall!=NULL && call.Status != 0) { | 1432 | if (s->Phone.Data.EnableIncomingCall && s->User.IncomingCall!=NULL && call.Status != 0) { |
1422 | if (call.CallIDAvailable) call.CallID = msg.Buffer[4]; | 1433 | if (call.CallIDAvailable) call.CallID = msg.Buffer[4]; |
1423 | s->User.IncomingCall(s->CurrentConfig->Device, call); | 1434 | s->User.IncomingCall(s->CurrentConfig->Device, call); |
1424 | } | 1435 | } |
1436 | if (s->Phone.Data.RequestID == ID_DialVoice) { | ||
1437 | if (msg.Buffer[3] == 0x10) return ERR_NOTSUPPORTED; | ||
1438 | } | ||
1425 | if (s->Phone.Data.RequestID == ID_CancelCall) { | 1439 | if (s->Phone.Data.RequestID == ID_CancelCall) { |
1426 | if (msg.Buffer[3] == 0x09) { | 1440 | if (msg.Buffer[3] == 0x09) { |
1427 | if (s->Phone.Data.CallID == msg.Buffer[4]) return ERR_NONE; | 1441 | if (s->Phone.Data.CallID == msg.Buffer[4]) return ERR_NONE; |
1428 | /* when we canceled call and see frame about other | 1442 | /* when we canceled call and see frame about other |
1429 | * call releasing, we don't give ERR_NONE for "our" | 1443 | * call releasing, we don't give ERR_NONE for "our" |
1430 | * call release command | 1444 | * call release command |
1431 | */ | 1445 | */ |
1432 | return ERR_NEEDANOTHERANSWER; | 1446 | return ERR_NEEDANOTHERANSWER; |
1433 | } | 1447 | } |
1434 | } | 1448 | } |
1435 | if (s->Phone.Data.RequestID == ID_AnswerCall) { | 1449 | if (s->Phone.Data.RequestID == ID_AnswerCall) { |
1436 | if (msg.Buffer[3] == 0x07) { | 1450 | if (msg.Buffer[3] == 0x07) { |
diff --git a/gammu/emb/common/phone/obex/obexgen.c b/gammu/emb/common/phone/obex/obexgen.c index dd14f8e..3106369 100644 --- a/gammu/emb/common/phone/obex/obexgen.c +++ b/gammu/emb/common/phone/obex/obexgen.c | |||
@@ -765,24 +765,25 @@ GSM_Phone_Functions OBEXGENPhone = { | |||
765 | NOTIMPLEMENTED, /* GetSpeedDial */ | 765 | NOTIMPLEMENTED, /* GetSpeedDial */ |
766 | NOTIMPLEMENTED, /* SetSpeedDial */ | 766 | NOTIMPLEMENTED, /* SetSpeedDial */ |
767 | NOTIMPLEMENTED, /* GetSMSC */ | 767 | NOTIMPLEMENTED, /* GetSMSC */ |
768 | NOTIMPLEMENTED, /* SetSMSC */ | 768 | NOTIMPLEMENTED, /* SetSMSC */ |
769 | NOTIMPLEMENTED, /* GetSMSStatus */ | 769 | NOTIMPLEMENTED, /* GetSMSStatus */ |
770 | NOTIMPLEMENTED, /* GetSMS */ | 770 | NOTIMPLEMENTED, /* GetSMS */ |
771 | NOTIMPLEMENTED, /* GetNextSMS */ | 771 | NOTIMPLEMENTED, /* GetNextSMS */ |
772 | NOTIMPLEMENTED, /* SetSMS */ | 772 | NOTIMPLEMENTED, /* SetSMS */ |
773 | NOTIMPLEMENTED, /* AddSMS */ | 773 | NOTIMPLEMENTED, /* AddSMS */ |
774 | NOTIMPLEMENTED, /* DeleteSMS */ | 774 | NOTIMPLEMENTED, /* DeleteSMS */ |
775 | NOTIMPLEMENTED, /* SendSMSMessage */ | 775 | NOTIMPLEMENTED, /* SendSMSMessage */ |
776 | NOTSUPPORTED, /* SendSavedSMS */ | 776 | NOTSUPPORTED, /* SendSavedSMS */ |
777 | NOTSUPPORTED, /* SetFastSMSSending*/ | ||
777 | NOTIMPLEMENTED, /* SetIncomingSMS */ | 778 | NOTIMPLEMENTED, /* SetIncomingSMS */ |
778 | NOTIMPLEMENTED, /* SetIncomingCB */ | 779 | NOTIMPLEMENTED, /* SetIncomingCB */ |
779 | NOTIMPLEMENTED, /* GetSMSFolders */ | 780 | NOTIMPLEMENTED, /* GetSMSFolders */ |
780 | NOTIMPLEMENTED, /* AddSMSFolder */ | 781 | NOTIMPLEMENTED, /* AddSMSFolder */ |
781 | NOTIMPLEMENTED, /* DeleteSMSFolder */ | 782 | NOTIMPLEMENTED, /* DeleteSMSFolder */ |
782 | NOTIMPLEMENTED, /* DialVoice */ | 783 | NOTIMPLEMENTED, /* DialVoice */ |
783 | NOTIMPLEMENTED, /* AnswerCall */ | 784 | NOTIMPLEMENTED, /* AnswerCall */ |
784 | NOTIMPLEMENTED, /* CancelCall */ | 785 | NOTIMPLEMENTED, /* CancelCall */ |
785 | NOTIMPLEMENTED, /* HoldCall */ | 786 | NOTIMPLEMENTED, /* HoldCall */ |
786 | NOTIMPLEMENTED, /* UnholdCall */ | 787 | NOTIMPLEMENTED, /* UnholdCall */ |
787 | NOTIMPLEMENTED, /* ConferenceCall */ | 788 | NOTIMPLEMENTED, /* ConferenceCall */ |
788 | NOTIMPLEMENTED, /* SplitCall */ | 789 | NOTIMPLEMENTED, /* SplitCall */ |
@@ -819,25 +820,25 @@ GSM_Phone_Functions OBEXGENPhone = { | |||
819 | NOTIMPLEMENTED, /* AddToDo */ | 820 | NOTIMPLEMENTED, /* AddToDo */ |
820 | NOTIMPLEMENTED, /* DeleteToDo */ | 821 | NOTIMPLEMENTED, /* DeleteToDo */ |
821 | NOTIMPLEMENTED, /* DeleteAllToDo */ | 822 | NOTIMPLEMENTED, /* DeleteAllToDo */ |
822 | NOTIMPLEMENTED, /* GetCalendarStatus*/ | 823 | NOTIMPLEMENTED, /* GetCalendarStatus*/ |
823 | NOTIMPLEMENTED, /* GetCalendar */ | 824 | NOTIMPLEMENTED, /* GetCalendar */ |
824 | NOTIMPLEMENTED, /* GetNextCalendar */ | 825 | NOTIMPLEMENTED, /* GetNextCalendar */ |
825 | NOTIMPLEMENTED, /* SetCalendar */ | 826 | NOTIMPLEMENTED, /* SetCalendar */ |
826 | NOTIMPLEMENTED, /* AddCalendar */ | 827 | NOTIMPLEMENTED, /* AddCalendar */ |
827 | NOTIMPLEMENTED, /* DeleteCalendar */ | 828 | NOTIMPLEMENTED, /* DeleteCalendar */ |
828 | NOTIMPLEMENTED, /* DeleteAllCalendar*/ | 829 | NOTIMPLEMENTED, /* DeleteAllCalendar*/ |
829 | NOTSUPPORTED, /* GetCalendarSettings*/ | 830 | NOTSUPPORTED, /* GetCalendarSettings*/ |
830 | NOTSUPPORTED, /* SetCalendarSettings*/ | 831 | NOTSUPPORTED, /* SetCalendarSettings*/ |
831 | NOTSUPPORTED, /* GetNote */ | 832 | NOTSUPPORTED, /* GetNextNote */ |
832 | NOTIMPLEMENTED, /* GetProfile */ | 833 | NOTIMPLEMENTED, /* GetProfile */ |
833 | NOTIMPLEMENTED, /* SetProfile */ | 834 | NOTIMPLEMENTED, /* SetProfile */ |
834 | NOTIMPLEMENTED, /* GetFMStation */ | 835 | NOTIMPLEMENTED, /* GetFMStation */ |
835 | NOTIMPLEMENTED, /* SetFMStation */ | 836 | NOTIMPLEMENTED, /* SetFMStation */ |
836 | NOTIMPLEMENTED, /* ClearFMStations */ | 837 | NOTIMPLEMENTED, /* ClearFMStations */ |
837 | OBEXGEN_GetNextFileFolder, | 838 | OBEXGEN_GetNextFileFolder, |
838 | OBEXGEN_GetFilePart, | 839 | OBEXGEN_GetFilePart, |
839 | OBEXGEN_AddFilePart, | 840 | OBEXGEN_AddFilePart, |
840 | NOTIMPLEMENTED, /* GetFileSystemStatus*/ | 841 | NOTIMPLEMENTED, /* GetFileSystemStatus*/ |
841 | OBEXGEN_DeleteFile, | 842 | OBEXGEN_DeleteFile, |
842 | OBEXGEN_AddFolder, | 843 | OBEXGEN_AddFolder, |
843 | NOTIMPLEMENTED, /* GetGPRSAccessPoint*/ | 844 | NOTIMPLEMENTED, /* GetGPRSAccessPoint*/ |
diff --git a/gammu/emb/common/phone/obex/obexgen.h b/gammu/emb/common/phone/obex/obexgen.h index 466fef5..b7033de 100644 --- a/gammu/emb/common/phone/obex/obexgen.h +++ b/gammu/emb/common/phone/obex/obexgen.h | |||
@@ -22,17 +22,21 @@ typedef enum { | |||
22 | 22 | ||
23 | typedef struct { | 23 | typedef struct { |
24 | int FileLev; | 24 | int FileLev; |
25 | int FilesLocationsUsed; | 25 | int FilesLocationsUsed; |
26 | int FilesLocationsCurrent; | 26 | int FilesLocationsCurrent; |
27 | GSM_File Files[500]; | 27 | GSM_File Files[500]; |
28 | bool FileLastPart; | 28 | bool FileLastPart; |
29 | 29 | ||
30 | int FrameSize; | 30 | int FrameSize; |
31 | OBEX_Service Service; | 31 | OBEX_Service Service; |
32 | } GSM_Phone_OBEXGENData; | 32 | } GSM_Phone_OBEXGENData; |
33 | 33 | ||
34 | GSM_Error OBEXGEN_GetFilePart(GSM_StateMachine *s, GSM_File *File); | ||
35 | GSM_Error OBEXGEN_AddFilePart(GSM_StateMachine *s, GSM_File *File, int *Pos); | ||
36 | GSM_Error OBEXGEN_Disconnect(GSM_StateMachine *s); | ||
37 | |||
34 | #endif | 38 | #endif |
35 | 39 | ||
36 | /* How should editor hadle tabs in this file? Add editor commands here. | 40 | /* How should editor hadle tabs in this file? Add editor commands here. |
37 | * vim: noexpandtab sw=8 ts=8 sts=8: | 41 | * vim: noexpandtab sw=8 ts=8 sts=8: |
38 | */ | 42 | */ |
diff --git a/gammu/emb/common/phone/symbian/mroutgen.c b/gammu/emb/common/phone/symbian/mroutgen.c index 2c339be..a7382cf 100644 --- a/gammu/emb/common/phone/symbian/mroutgen.c +++ b/gammu/emb/common/phone/symbian/mroutgen.c | |||
@@ -134,24 +134,25 @@ GSM_Phone_Functions MROUTERGENPhone = { | |||
134 | NOTSUPPORTED, /* GetSpeedDial */ | 134 | NOTSUPPORTED, /* GetSpeedDial */ |
135 | NOTSUPPORTED, /* SetSpeedDial */ | 135 | NOTSUPPORTED, /* SetSpeedDial */ |
136 | NOTSUPPORTED, /* GetSMSC */ | 136 | NOTSUPPORTED, /* GetSMSC */ |
137 | NOTSUPPORTED, /* SetSMSC */ | 137 | NOTSUPPORTED, /* SetSMSC */ |
138 | NOTSUPPORTED, /* GetSMSStatus */ | 138 | NOTSUPPORTED, /* GetSMSStatus */ |
139 | NOTSUPPORTED, /* GetSMS */ | 139 | NOTSUPPORTED, /* GetSMS */ |
140 | NOTSUPPORTED, /* GetNextSMS */ | 140 | NOTSUPPORTED, /* GetNextSMS */ |
141 | NOTSUPPORTED, /* SetSMS */ | 141 | NOTSUPPORTED, /* SetSMS */ |
142 | NOTSUPPORTED, /* AddSMS */ | 142 | NOTSUPPORTED, /* AddSMS */ |
143 | NOTSUPPORTED, /* DeleteSMS */ | 143 | NOTSUPPORTED, /* DeleteSMS */ |
144 | NOTSUPPORTED, /* SendSMSMessage */ | 144 | NOTSUPPORTED, /* SendSMSMessage */ |
145 | NOTSUPPORTED, /* SendSavedSMS */ | 145 | NOTSUPPORTED, /* SendSavedSMS */ |
146 | NOTSUPPORTED, /* SetFastSMSSending*/ | ||
146 | NOTSUPPORTED, /* SetIncomingSMS */ | 147 | NOTSUPPORTED, /* SetIncomingSMS */ |
147 | NOTSUPPORTED, /* SetIncomingCB */ | 148 | NOTSUPPORTED, /* SetIncomingCB */ |
148 | NOTSUPPORTED, /* GetSMSFolders */ | 149 | NOTSUPPORTED, /* GetSMSFolders */ |
149 | NOTSUPPORTED, /* AddSMSFolder */ | 150 | NOTSUPPORTED, /* AddSMSFolder */ |
150 | NOTSUPPORTED, /* DeleteSMSFolder */ | 151 | NOTSUPPORTED, /* DeleteSMSFolder */ |
151 | NOTSUPPORTED, /* DialVoice */ | 152 | NOTSUPPORTED, /* DialVoice */ |
152 | NOTSUPPORTED, /* AnswerCall */ | 153 | NOTSUPPORTED, /* AnswerCall */ |
153 | NOTSUPPORTED, /* CancelCall */ | 154 | NOTSUPPORTED, /* CancelCall */ |
154 | NOTSUPPORTED, /* HoldCall */ | 155 | NOTSUPPORTED, /* HoldCall */ |
155 | NOTSUPPORTED, /* UnholdCall */ | 156 | NOTSUPPORTED, /* UnholdCall */ |
156 | NOTSUPPORTED, /* ConferenceCall */ | 157 | NOTSUPPORTED, /* ConferenceCall */ |
157 | NOTSUPPORTED, /* SplitCall */ | 158 | NOTSUPPORTED, /* SplitCall */ |
@@ -188,25 +189,25 @@ GSM_Phone_Functions MROUTERGENPhone = { | |||
188 | NOTSUPPORTED, /* AddToDo */ | 189 | NOTSUPPORTED, /* AddToDo */ |
189 | NOTSUPPORTED, /* DeleteToDo */ | 190 | NOTSUPPORTED, /* DeleteToDo */ |
190 | NOTSUPPORTED, /* DeleteAllToDo */ | 191 | NOTSUPPORTED, /* DeleteAllToDo */ |
191 | NOTSUPPORTED, /* GetCalendarStatus*/ | 192 | NOTSUPPORTED, /* GetCalendarStatus*/ |
192 | NOTSUPPORTED, /* GetCalendar */ | 193 | NOTSUPPORTED, /* GetCalendar */ |
193 | NOTSUPPORTED, /* GetNextCalendar */ | 194 | NOTSUPPORTED, /* GetNextCalendar */ |
194 | NOTSUPPORTED, /* SetCalendar */ | 195 | NOTSUPPORTED, /* SetCalendar */ |
195 | NOTSUPPORTED, /* AddCalendar */ | 196 | NOTSUPPORTED, /* AddCalendar */ |
196 | NOTSUPPORTED, /* DeleteCalendar */ | 197 | NOTSUPPORTED, /* DeleteCalendar */ |
197 | NOTSUPPORTED, /* DeleteAllCalendar*/ | 198 | NOTSUPPORTED, /* DeleteAllCalendar*/ |
198 | NOTSUPPORTED, /* GetCalendarSettings*/ | 199 | NOTSUPPORTED, /* GetCalendarSettings*/ |
199 | NOTSUPPORTED, /* SetCalendarSettings*/ | 200 | NOTSUPPORTED, /* SetCalendarSettings*/ |
200 | NOTSUPPORTED, /* GetNote */ | 201 | NOTSUPPORTED, /* GetNextNote */ |
201 | NOTSUPPORTED, /* GetProfile */ | 202 | NOTSUPPORTED, /* GetProfile */ |
202 | NOTSUPPORTED, /* SetProfile */ | 203 | NOTSUPPORTED, /* SetProfile */ |
203 | NOTSUPPORTED, /* GetFMStation */ | 204 | NOTSUPPORTED, /* GetFMStation */ |
204 | NOTSUPPORTED, /* SetFMStation */ | 205 | NOTSUPPORTED, /* SetFMStation */ |
205 | NOTSUPPORTED, /* ClearFMStations */ | 206 | NOTSUPPORTED, /* ClearFMStations */ |
206 | NOTSUPPORTED, /* GetNextFileFolder*/ | 207 | NOTSUPPORTED, /* GetNextFileFolder*/ |
207 | NOTSUPPORTED, /* GetFilePart */ | 208 | NOTSUPPORTED, /* GetFilePart */ |
208 | NOTSUPPORTED, /* AddFilePart */ | 209 | NOTSUPPORTED, /* AddFilePart */ |
209 | NOTSUPPORTED, /* GetFileSystemStatus*/ | 210 | NOTSUPPORTED, /* GetFileSystemStatus*/ |
210 | NOTSUPPORTED, /* DeleteFile */ | 211 | NOTSUPPORTED, /* DeleteFile */ |
211 | NOTSUPPORTED, /* AddFolder */ | 212 | NOTSUPPORTED, /* AddFolder */ |
212 | NOTSUPPORTED, /* GetGPRSAccessPoint*/ | 213 | NOTSUPPORTED, /* GetGPRSAccessPoint*/ |