Diffstat (limited to 'gammu/emb/common/phone/nokia/dct3/n6110.c') (more/less context) (ignore whitespace changes)
-rw-r--r-- | gammu/emb/common/phone/nokia/dct3/n6110.c | 17 |
1 files changed, 12 insertions, 5 deletions
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,52 +1,54 @@ | |||
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" |
17 | #include "../nfunc.h" | 19 | #include "../nfunc.h" |
18 | #include "n6110.h" | 20 | #include "n6110.h" |
19 | #include "dct3func.h" | 21 | #include "dct3func.h" |
20 | 22 | ||
21 | static unsigned char N6110_MEMORY_TYPES[] = { | 23 | static unsigned char N6110_MEMORY_TYPES[] = { |
22 | MEM_ME, 0x02, | 24 | MEM_ME, 0x02, |
23 | MEM_SM, 0x03, | 25 | MEM_SM, 0x03, |
24 | MEM_ON, 0x05, | 26 | MEM_ON, 0x05, |
25 | MEM_DC, 0x07, | 27 | MEM_DC, 0x07, |
26 | MEM_RC, 0x08, | 28 | MEM_RC, 0x08, |
27 | MEM_MC, 0x09, | 29 | MEM_MC, 0x09, |
28 | MEM_VM, 0x0b, | 30 | MEM_VM, 0x0b, |
29 | 0x00, 0x00 | 31 | 0x00, 0x00 |
30 | }; | 32 | }; |
31 | 33 | ||
32 | static GSM_Error N6110_ReplyGetPhoneLanguage(GSM_Protocol_Message msg, GSM_StateMachine *s) | 34 | static GSM_Error N6110_ReplyGetPhoneLanguage(GSM_Protocol_Message msg, GSM_StateMachine *s) |
33 | { | 35 | { |
34 | N6110_Language lang = N6110_Auto; | 36 | N6110_Language lang = N6110_Auto; |
35 | 37 | ||
36 | if (msg.Buffer[3] == 0x15) return ERR_NONE; | 38 | if (msg.Buffer[3] == 0x15) return ERR_NONE; |
37 | 39 | ||
38 | smprintf(s, "Phone language is %02x\n",msg.Buffer[6]); | 40 | smprintf(s, "Phone language is %02x\n",msg.Buffer[6]); |
39 | switch (msg.Buffer[6]) { | 41 | switch (msg.Buffer[6]) { |
40 | case 0x21: lang = N6110_Europe; break; //Polish | 42 | case 0x21: lang = N6110_Europe; break; //Polish |
41 | } | 43 | } |
42 | s->Phone.Data.Priv.N6110.PhoneLanguage = lang; | 44 | s->Phone.Data.Priv.N6110.PhoneLanguage = lang; |
43 | return ERR_NONE; | 45 | return ERR_NONE; |
44 | } | 46 | } |
45 | 47 | ||
46 | static GSM_Error N6110_GetPhoneLanguage(GSM_StateMachine *s) | 48 | static GSM_Error N6110_GetPhoneLanguage(GSM_StateMachine *s) |
47 | { | 49 | { |
48 | unsigned char feat_req[] = {N6110_FRAME_HEADER, 0x13, 0x01, | 50 | unsigned char feat_req[] = {N6110_FRAME_HEADER, 0x13, 0x01, |
49 | 0x00, /* Profile location */ | 51 | 0x00, /* Profile location */ |
50 | 0x00}; /* Feature number */ | 52 | 0x00}; /* Feature number */ |
51 | 53 | ||
52 | s->Phone.Data.Priv.N6110.PhoneLanguage = N6110_Auto; | 54 | s->Phone.Data.Priv.N6110.PhoneLanguage = N6110_Auto; |
@@ -82,96 +84,97 @@ static struct N6110_Lang_Char N6110_Lang_Table[] = { | |||
82 | {N6110_Europe,0x93,0x01,0x44},//Latin small letter n with acute | 84 | {N6110_Europe,0x93,0x01,0x44},//Latin small letter n with acute |
83 | {N6110_Europe,0x9A,0x00,0xF3},//Latin small letter o with acute | 85 | {N6110_Europe,0x9A,0x00,0xF3},//Latin small letter o with acute |
84 | {N6110_Europe,0xB2,0x20,0xAC},//euro | 86 | {N6110_Europe,0xB2,0x20,0xAC},//euro |
85 | {N6110_Europe,0xB5,0x01,0x5A},//Latin capital letter s with acute | 87 | {N6110_Europe,0xB5,0x01,0x5A},//Latin capital letter s with acute |
86 | {N6110_Europe,0xB6,0x01,0x5B},//Latin small letter s with acute | 88 | {N6110_Europe,0xB6,0x01,0x5B},//Latin small letter s with acute |
87 | {N6110_Europe,0xE7,0x01,0x79},//Latin capital letter z with acute | 89 | {N6110_Europe,0xE7,0x01,0x79},//Latin capital letter z with acute |
88 | {N6110_Europe,0xEE,0x01,0x7A},//Latin small letter z with acute | 90 | {N6110_Europe,0xEE,0x01,0x7A},//Latin small letter z with acute |
89 | {N6110_Europe,0xF4,0x01,0x7C},//Latin small letter z with dot above | 91 | {N6110_Europe,0xF4,0x01,0x7C},//Latin small letter z with dot above |
90 | {N6110_Europe,0xF0,0x01,0x7B},//Latin capital letter z with dot above | 92 | {N6110_Europe,0xF0,0x01,0x7B},//Latin capital letter z with dot above |
91 | {0,0,0,0} | 93 | {0,0,0,0} |
92 | }; | 94 | }; |
93 | 95 | ||
94 | static void N6110_EncodeUnicode(GSM_StateMachine *s, unsigned char *dest, const unsigned char *src, int len) | 96 | static void N6110_EncodeUnicode(GSM_StateMachine *s, unsigned char *dest, const unsigned char *src, int len) |
95 | { | 97 | { |
96 | int i_len = 0, o_len, i; | 98 | int i_len = 0, o_len, i; |
97 | wchar_t wc; | 99 | wchar_t wc; |
98 | GSM_Phone_N6110Data *Priv = &s->Phone.Data.Priv.N6110; | 100 | GSM_Phone_N6110Data *Priv = &s->Phone.Data.Priv.N6110; |
99 | bool found; | 101 | bool found; |
100 | 102 | ||
101 | for (o_len = 0; i_len < len; o_len++) { | 103 | for (o_len = 0; i_len < len; o_len++) { |
102 | found = false; | 104 | found = false; |
103 | if (Priv->PhoneLanguage != N6110_Auto) { | 105 | if (Priv->PhoneLanguage != N6110_Auto) { |
104 | i = 0; | 106 | i = 0; |
105 | while(1) { | 107 | while(1) { |
106 | if (N6110_Lang_Table[i].Lang == 0) break; | 108 | if (N6110_Lang_Table[i].Lang == 0) break; |
107 | if (N6110_Lang_Table[i].Lang == Priv->PhoneLanguage && | 109 | if (N6110_Lang_Table[i].Lang == Priv->PhoneLanguage && |
108 | N6110_Lang_Table[i].Phone == src[i_len]) { | 110 | N6110_Lang_Table[i].Phone == src[i_len]) { |
109 | dest[o_len*2] = N6110_Lang_Table[i].Unicode1; | 111 | dest[o_len*2] = N6110_Lang_Table[i].Unicode1; |
110 | dest[(o_len*2)+1] = N6110_Lang_Table[i].Unicode2; | 112 | dest[(o_len*2)+1] = N6110_Lang_Table[i].Unicode2; |
111 | i_len++; | 113 | i_len++; |
112 | found = true; | 114 | found = true; |
113 | break; | 115 | break; |
114 | } | 116 | } |
115 | i++; | 117 | i++; |
116 | } | 118 | } |
117 | } | 119 | } |
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 | */ |
142 | static void N6110_GetNokiaAuthentication(unsigned char *Imei, unsigned char *MagicBytes, unsigned char *MagicResponse) | 145 | static void N6110_GetNokiaAuthentication(unsigned char *Imei, unsigned char *MagicBytes, unsigned char *MagicResponse) |
143 | { | 146 | { |
144 | int i, j, CRC=0; | 147 | int i, j, CRC=0; |
145 | unsigned char Temp[16]; /* This is our temporary working area. */ | 148 | unsigned char Temp[16]; /* This is our temporary working area. */ |
146 | 149 | ||
147 | /* Here we put FAC (Final Assembly Code) and serial number into our area. */ | 150 | /* Here we put FAC (Final Assembly Code) and serial number into our area. */ |
148 | Temp[0] = Imei[6]; Temp[1] = Imei[7]; | 151 | Temp[0] = Imei[6]; Temp[1] = Imei[7]; |
149 | Temp[2] = Imei[8]; Temp[3] = Imei[9]; | 152 | Temp[2] = Imei[8]; Temp[3] = Imei[9]; |
150 | Temp[4] = Imei[10]; Temp[5] = Imei[11]; | 153 | Temp[4] = Imei[10]; Temp[5] = Imei[11]; |
151 | Temp[6] = Imei[12]; Temp[7] = Imei[13]; | 154 | Temp[6] = Imei[12]; Temp[7] = Imei[13]; |
152 | 155 | ||
153 | /* And now the TAC (Type Approval Code). */ | 156 | /* And now the TAC (Type Approval Code). */ |
154 | Temp[8] = Imei[2]; Temp[9] = Imei[3]; | 157 | Temp[8] = Imei[2]; Temp[9] = Imei[3]; |
155 | Temp[10] = Imei[4]; Temp[11] = Imei[5]; | 158 | Temp[10] = Imei[4]; Temp[11] = Imei[5]; |
156 | 159 | ||
157 | /* And now we pack magic bytes from the phone. */ | 160 | /* And now we pack magic bytes from the phone. */ |
158 | Temp[12] = MagicBytes[0]; Temp[13] = MagicBytes[1]; | 161 | Temp[12] = MagicBytes[0]; Temp[13] = MagicBytes[1]; |
159 | Temp[14] = MagicBytes[2]; Temp[15] = MagicBytes[3]; | 162 | Temp[14] = MagicBytes[2]; Temp[15] = MagicBytes[3]; |
160 | 163 | ||
161 | for (i=0; i<=11; i++) if (Temp[i + 1]& 1) Temp[i]<<=1; | 164 | for (i=0; i<=11; i++) if (Temp[i + 1]& 1) Temp[i]<<=1; |
162 | switch (Temp[15] & 0x03) { | 165 | switch (Temp[15] & 0x03) { |
163 | case 1: | 166 | case 1: |
164 | case 2: j = Temp[13] & 0x07; | 167 | case 2: j = Temp[13] & 0x07; |
165 | for (i=0; i<=3; i++) Temp[i+j] ^= Temp[i+12]; | 168 | for (i=0; i<=3; i++) Temp[i+j] ^= Temp[i+12]; |
166 | break; | 169 | break; |
167 | default: j = Temp[14] & 0x07; | 170 | default: j = Temp[14] & 0x07; |
168 | for (i=0; i<=3; i++) Temp[i + j] |= Temp[i + 12]; | 171 | for (i=0; i<=3; i++) Temp[i + j] |= Temp[i + 12]; |
169 | } | 172 | } |
170 | for (i=0; i<=15; i++) CRC ^= Temp[i]; | 173 | for (i=0; i<=15; i++) CRC ^= Temp[i]; |
171 | for (i=0; i<=15; i++) { | 174 | for (i=0; i<=15; i++) { |
172 | switch (Temp[15 - i] & 0x06) { | 175 | switch (Temp[15 - i] & 0x06) { |
173 | case 0: j = Temp[i] | CRC; break; | 176 | case 0: j = Temp[i] | CRC; break; |
174 | case 2: | 177 | case 2: |
175 | case 4: j = Temp[i] ^ CRC; break; | 178 | case 4: j = Temp[i] ^ CRC; break; |
176 | case 6: j = Temp[i] & CRC; break; | 179 | case 6: j = Temp[i] & CRC; break; |
177 | } | 180 | } |
@@ -779,96 +782,97 @@ static GSM_Error N6110_SetRingtone(GSM_StateMachine *s, GSM_Ringtone *Ringtone, | |||
779 | 0x00,0x78}; | 782 | 0x00,0x78}; |
780 | unsigned char reqBin[1000] = {0x00,0x01,0xa0,0x00,0x00,0x0c,0x01,0x2c}; | 783 | unsigned char reqBin[1000] = {0x00,0x01,0xa0,0x00,0x00,0x0c,0x01,0x2c}; |
781 | 784 | ||
782 | if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_NORING)) return ERR_NOTSUPPORTED; | 785 | if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_NORING)) return ERR_NOTSUPPORTED; |
783 | if (Ringtone->Location == 0) return ERR_INVALIDLOCATION; | 786 | if (Ringtone->Location == 0) return ERR_INVALIDLOCATION; |
784 | 787 | ||
785 | switch (Ringtone->Format) { | 788 | switch (Ringtone->Format) { |
786 | case RING_NOTETONE: | 789 | case RING_NOTETONE: |
787 | if (Ringtone->Location==255) { | 790 | if (Ringtone->Location==255) { |
788 | /* Only 6110, 6130 and 6150 support it */ | 791 | /* Only 6110, 6130 and 6150 support it */ |
789 | if (strcmp(s->Phone.Data.Model,"NSE-3") == 0 || strcmp(s->Phone.Data.Model,"NSK-3") == 0 || | 792 | if (strcmp(s->Phone.Data.Model,"NSE-3") == 0 || strcmp(s->Phone.Data.Model,"NSK-3") == 0 || |
790 | strcmp(s->Phone.Data.Model,"NSM-1") == 0) { | 793 | strcmp(s->Phone.Data.Model,"NSM-1") == 0) { |
791 | req[0] = 0x0c; | 794 | req[0] = 0x0c; |
792 | req[1] = 0x01; | 795 | req[1] = 0x01; |
793 | UDHHeader.Type = UDH_NokiaRingtone; | 796 | UDHHeader.Type = UDH_NokiaRingtone; |
794 | GSM_EncodeUDHHeader(&UDHHeader); | 797 | GSM_EncodeUDHHeader(&UDHHeader); |
795 | /* We copy UDH now */ | 798 | /* We copy UDH now */ |
796 | memcpy(req+2,UDHHeader.Text,UDHHeader.Length); | 799 | memcpy(req+2,UDHHeader.Text,UDHHeader.Length); |
797 | *maxlength=GSM_EncodeNokiaRTTLRingtone(*Ringtone, req+2+UDHHeader.Length, &size); | 800 | *maxlength=GSM_EncodeNokiaRTTLRingtone(*Ringtone, req+2+UDHHeader.Length, &size); |
798 | error = s->Protocol.Functions->WriteMessage(s, req, 2+UDHHeader.Length+size, 0x12); | 801 | error = s->Protocol.Functions->WriteMessage(s, req, 2+UDHHeader.Length+size, 0x12); |
799 | if (error!=ERR_NONE) return error; | 802 | if (error!=ERR_NONE) return error; |
800 | my_sleep(1000); | 803 | my_sleep(1000); |
801 | /* We have to make something (not important, what) now */ | 804 | /* We have to make something (not important, what) now */ |
802 | /* no answer from phone*/ | 805 | /* no answer from phone*/ |
803 | return DCT3_GetNetworkInfo(s,&NetInfo); | 806 | return DCT3_GetNetworkInfo(s,&NetInfo); |
804 | } else { | 807 | } else { |
805 | return ERR_NOTSUPPORTED; | 808 | return ERR_NOTSUPPORTED; |
806 | } | 809 | } |
807 | } | 810 | } |
808 | *maxlength=GSM_EncodeNokiaRTTLRingtone(*Ringtone, req+7, &size); | 811 | *maxlength=GSM_EncodeNokiaRTTLRingtone(*Ringtone, req+7, &size); |
809 | req[4] = Ringtone->Location - 1; | 812 | req[4] = Ringtone->Location - 1; |
810 | smprintf(s, "Setting ringtone\n"); | 813 | smprintf(s, "Setting ringtone\n"); |
811 | return GSM_WaitFor (s, req, 7 + size, 0x05, 4, ID_SetRingtone); | 814 | return GSM_WaitFor (s, req, 7 + size, 0x05, 4, ID_SetRingtone); |
812 | case RING_NOKIABINARY: | 815 | case RING_NOKIABINARY: |
813 | error=DCT3_EnableSecurity (s, 0x01); | 816 | error=DCT3_EnableSecurity (s, 0x01); |
814 | if (error!=ERR_NONE) return error; | 817 | if (error!=ERR_NONE) return error; |
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); |
839 | count = count + 3; | 843 | count = count + 3; |
840 | smprintf(s, "Network code : %s\n", Data->Bitmap->NetworkCode); | 844 | smprintf(s, "Network code : %s\n", Data->Bitmap->NetworkCode); |
841 | smprintf(s, "Network name for Gammu : %s ", | 845 | smprintf(s, "Network name for Gammu : %s ", |
842 | DecodeUnicodeString(GSM_GetNetworkName(Data->Bitmap->NetworkCode))); | 846 | DecodeUnicodeString(GSM_GetNetworkName(Data->Bitmap->NetworkCode))); |
843 | smprintf(s, "(%s)\n",DecodeUnicodeString(GSM_GetCountryName(Data->Bitmap->NetworkCode))); | 847 | smprintf(s, "(%s)\n",DecodeUnicodeString(GSM_GetCountryName(Data->Bitmap->NetworkCode))); |
844 | 848 | ||
845 | count = count + 3; /* We ignore size */ | 849 | count = count + 3; /* We ignore size */ |
846 | Data->Bitmap->BitmapWidth = msg.Buffer[count++]; | 850 | Data->Bitmap->BitmapWidth = msg.Buffer[count++]; |
847 | Data->Bitmap->BitmapHeight = msg.Buffer[count++]; | 851 | Data->Bitmap->BitmapHeight = msg.Buffer[count++]; |
848 | count++; | 852 | count++; |
849 | PHONE_DecodeBitmap(GSM_NokiaOperatorLogo,msg.Buffer+count,Data->Bitmap); | 853 | PHONE_DecodeBitmap(GSM_NokiaOperatorLogo,msg.Buffer+count,Data->Bitmap); |
850 | return ERR_NONE; | 854 | return ERR_NONE; |
851 | } | 855 | } |
852 | 856 | ||
853 | static GSM_Error N6110_ReplyGetStartup(GSM_Protocol_Message msg, GSM_StateMachine *s) | 857 | static GSM_Error N6110_ReplyGetStartup(GSM_Protocol_Message msg, GSM_StateMachine *s) |
854 | { | 858 | { |
855 | int i, count = 5; | 859 | int i, count = 5; |
856 | GSM_Phone_Data *Data = &s->Phone.Data; | 860 | GSM_Phone_Data *Data = &s->Phone.Data; |
857 | 861 | ||
858 | smprintf(s, "Startup logo & notes received\n"); | 862 | smprintf(s, "Startup logo & notes received\n"); |
859 | for (i=0;i<msg.Buffer[4];i++) { | 863 | for (i=0;i<msg.Buffer[4];i++) { |
860 | switch (msg.Buffer[count++]) { | 864 | switch (msg.Buffer[count++]) { |
861 | case 0x01: | 865 | case 0x01: |
862 | smprintf(s, "Startup logo\n"); | 866 | smprintf(s, "Startup logo\n"); |
863 | if (Data->Bitmap->Type == GSM_StartupLogo) { | 867 | if (Data->Bitmap->Type == GSM_StartupLogo) { |
864 | Data->Bitmap->BitmapHeight = msg.Buffer[count++]; | 868 | Data->Bitmap->BitmapHeight = msg.Buffer[count++]; |
865 | Data->Bitmap->BitmapWidth = msg.Buffer[count++]; | 869 | Data->Bitmap->BitmapWidth = msg.Buffer[count++]; |
866 | PHONE_DecodeBitmap(GSM_NokiaStartupLogo, msg.Buffer + count, Data->Bitmap); | 870 | PHONE_DecodeBitmap(GSM_NokiaStartupLogo, msg.Buffer + count, Data->Bitmap); |
867 | } else { | 871 | } else { |
868 | count = count + 2; | 872 | count = count + 2; |
869 | } | 873 | } |
870 | count = count + PHONE_GetBitmapSize(GSM_NokiaStartupLogo,0,0); | 874 | count = count + PHONE_GetBitmapSize(GSM_NokiaStartupLogo,0,0); |
871 | break; | 875 | break; |
872 | case 0x02: | 876 | case 0x02: |
873 | smprintf(s, "Welcome note\n"); | 877 | smprintf(s, "Welcome note\n"); |
874 | if (Data->Bitmap->Type == GSM_WelcomeNote_Text) { | 878 | if (Data->Bitmap->Type == GSM_WelcomeNote_Text) { |
@@ -1479,133 +1483,135 @@ static GSM_Error N6110_ReplyGetRingtone(GSM_Protocol_Message msg, GSM_StateMachi | |||
1479 | int i,end,start; | 1483 | int i,end,start; |
1480 | 1484 | ||
1481 | smprintf(s, "Ringtone received\n"); | 1485 | smprintf(s, "Ringtone received\n"); |
1482 | switch (msg.Buffer[4]) { | 1486 | switch (msg.Buffer[4]) { |
1483 | case 0x00: | 1487 | case 0x00: |
1484 | switch (Data->Ringtone->Format) { | 1488 | switch (Data->Ringtone->Format) { |
1485 | case RING_NOTETONE: | 1489 | case RING_NOTETONE: |
1486 | memcpy(buffer,msg.Buffer,msg.Length); | 1490 | memcpy(buffer,msg.Buffer,msg.Length); |
1487 | i=7; | 1491 | i=7; |
1488 | if (buffer[9]==0x4a && buffer[10]==0x3a) i=8; | 1492 | if (buffer[9]==0x4a && buffer[10]==0x3a) i=8; |
1489 | buffer[i]=0x02; | 1493 | buffer[i]=0x02; |
1490 | error=GSM_DecodeNokiaRTTLRingtone(Data->Ringtone, buffer+i, msg.Length-i); | 1494 | error=GSM_DecodeNokiaRTTLRingtone(Data->Ringtone, buffer+i, msg.Length-i); |
1491 | if (error!=ERR_NONE) return ERR_EMPTY; | 1495 | if (error!=ERR_NONE) return ERR_EMPTY; |
1492 | return ERR_NONE; | 1496 | return ERR_NONE; |
1493 | case RING_NOKIABINARY: | 1497 | case RING_NOKIABINARY: |
1494 | i=8; | 1498 | i=8; |
1495 | while (msg.Buffer[i]!=0) { | 1499 | while (msg.Buffer[i]!=0) { |
1496 | i++; | 1500 | i++; |
1497 | if (i>msg.Length) return ERR_EMPTY; | 1501 | if (i>msg.Length) return ERR_EMPTY; |
1498 | } | 1502 | } |
1499 | EncodeUnicode(Data->Ringtone->Name,msg.Buffer+8,i-8); | 1503 | EncodeUnicode(Data->Ringtone->Name,msg.Buffer+8,i-8); |
1500 | smprintf(s, "Name \"%s\"\n",DecodeUnicodeString(Data->Ringtone->Name)); | 1504 | smprintf(s, "Name \"%s\"\n",DecodeUnicodeString(Data->Ringtone->Name)); |
1501 | /* Looking for start && end */ | 1505 | /* Looking for start && end */ |
1502 | end=0;start=0;i=0; | 1506 | end=0;start=0;i=0; |
1503 | while (true) { | 1507 | while (true) { |
1504 | if (start!=0) { | 1508 | if (start!=0) { |
1505 | if (msg.Buffer[i]==0x07 && msg.Buffer[i+1]==0x0b) { | 1509 | if (msg.Buffer[i]==0x07 && msg.Buffer[i+1]==0x0b) { |
1506 | end=i+2; break; | 1510 | end=i+2; break; |
1507 | } | 1511 | } |
1508 | if (msg.Buffer[i]==0x0e && msg.Buffer[i+1]==0x0b) { | 1512 | if (msg.Buffer[i]==0x0e && msg.Buffer[i+1]==0x0b) { |
1509 | end=i+2; break; | 1513 | end=i+2; break; |
1510 | } | 1514 | } |
1511 | } else { | 1515 | } else { |
1512 | if (msg.Buffer[i]==0x02 && msg.Buffer[i+1]==0xfc && msg.Buffer[i+2]==0x09) { | 1516 | if (msg.Buffer[i]==0x02 && msg.Buffer[i+1]==0xfc && msg.Buffer[i+2]==0x09) { |
1513 | start = i; | 1517 | start = i; |
1514 | } | 1518 | } |
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) |
1539 | { | 1544 | { |
1540 | GSM_Error error; | 1545 | GSM_Error error; |
1541 | unsigned char req[] = {0x00, 0x01, 0x9e, | 1546 | unsigned char req[] = {0x00, 0x01, 0x9e, |
1542 | 0x00}; /* location */ | 1547 | 0x00}; /* location */ |
1543 | 1548 | ||
1544 | if (PhoneRingtone) return ERR_NOTSUPPORTED; | 1549 | if (PhoneRingtone) return ERR_NOTSUPPORTED; |
1545 | if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo,F_NORING)) return ERR_NOTSUPPORTED; | 1550 | if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo,F_NORING)) return ERR_NOTSUPPORTED; |
1546 | if (Ringtone->Location == 0) return ERR_INVALIDLOCATION; | 1551 | if (Ringtone->Location == 0) return ERR_INVALIDLOCATION; |
1547 | 1552 | ||
1548 | if (Ringtone->Format == 0x00) { | 1553 | if (Ringtone->Format == 0x00) { |
1549 | if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo,F_RING_SM)) { | 1554 | if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo,F_RING_SM)) { |
1550 | Ringtone->Format = RING_NOTETONE; | 1555 | Ringtone->Format = RING_NOTETONE; |
1551 | } else { | 1556 | } else { |
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 | ||
1576 | static GSM_Error N6110_ReplyGetSecurityStatus(GSM_Protocol_Message msg, GSM_StateMachine *s) | 1582 | static GSM_Error N6110_ReplyGetSecurityStatus(GSM_Protocol_Message msg, GSM_StateMachine *s) |
1577 | { | 1583 | { |
1578 | *s->Phone.Data.SecurityStatus = msg.Buffer[4]; | 1584 | *s->Phone.Data.SecurityStatus = msg.Buffer[4]; |
1579 | 1585 | ||
1580 | #ifdef DEBUG | 1586 | #ifdef DEBUG |
1581 | smprintf(s, "Security code status\n"); | 1587 | smprintf(s, "Security code status\n"); |
1582 | switch(msg.Buffer[4]) { | 1588 | switch(msg.Buffer[4]) { |
1583 | case SEC_SecurityCode: smprintf(s, "waiting for Security Code.\n"); break; | 1589 | case SEC_SecurityCode: smprintf(s, "waiting for Security Code.\n"); break; |
1584 | case SEC_Pin : smprintf(s, "waiting for PIN.\n"); break; | 1590 | case SEC_Pin : smprintf(s, "waiting for PIN.\n"); break; |
1585 | case SEC_Pin2 : smprintf(s, "waiting for PIN2.\n"); break; | 1591 | case SEC_Pin2 : smprintf(s, "waiting for PIN2.\n"); break; |
1586 | case SEC_Puk : smprintf(s, "waiting for PUK.\n"); break; | 1592 | case SEC_Puk : smprintf(s, "waiting for PUK.\n"); break; |
1587 | case SEC_Puk2 : smprintf(s, "waiting for PUK2.\n"); break; | 1593 | case SEC_Puk2 : smprintf(s, "waiting for PUK2.\n"); break; |
1588 | case SEC_None : smprintf(s, "nothing to enter.\n"); break; | 1594 | case SEC_None : smprintf(s, "nothing to enter.\n"); break; |
1589 | default : smprintf(s, "ERROR: unknown %i\n",msg.Buffer[4]); | 1595 | default : smprintf(s, "ERROR: unknown %i\n",msg.Buffer[4]); |
1590 | return ERR_UNKNOWNRESPONSE; | 1596 | return ERR_UNKNOWNRESPONSE; |
1591 | } | 1597 | } |
1592 | #endif | 1598 | #endif |
1593 | return ERR_NONE; | 1599 | return ERR_NONE; |
1594 | } | 1600 | } |
1595 | 1601 | ||
1596 | static GSM_Error N6110_GetSecurityStatus(GSM_StateMachine *s, GSM_SecurityCodeType *Status) | 1602 | static GSM_Error N6110_GetSecurityStatus(GSM_StateMachine *s, GSM_SecurityCodeType *Status) |
1597 | { | 1603 | { |
1598 | unsigned char req[4] = {N6110_FRAME_HEADER, 0x07}; | 1604 | unsigned char req[4] = {N6110_FRAME_HEADER, 0x07}; |
1599 | 1605 | ||
1600 | s->Phone.Data.SecurityStatus=Status; | 1606 | s->Phone.Data.SecurityStatus=Status; |
1601 | smprintf(s, "Getting security code status\n"); | 1607 | smprintf(s, "Getting security code status\n"); |
1602 | return GSM_WaitFor (s, req, 4, 0x08, 2, ID_GetSecurityStatus); | 1608 | return GSM_WaitFor (s, req, 4, 0x08, 2, ID_GetSecurityStatus); |
1603 | } | 1609 | } |
1604 | 1610 | ||
1605 | static GSM_Error N6110_ReplyEnterSecurityCode(GSM_Protocol_Message msg, GSM_StateMachine *s) | 1611 | static GSM_Error N6110_ReplyEnterSecurityCode(GSM_Protocol_Message msg, GSM_StateMachine *s) |
1606 | { | 1612 | { |
1607 | switch (msg.Buffer[3]) { | 1613 | switch (msg.Buffer[3]) { |
1608 | case 0x0b: | 1614 | case 0x0b: |
1609 | smprintf(s, "Security code OK\n"); | 1615 | smprintf(s, "Security code OK\n"); |
1610 | return ERR_NONE; | 1616 | return ERR_NONE; |
1611 | case 0x0c: | 1617 | case 0x0c: |
@@ -2398,98 +2404,98 @@ static GSM_Error N6110_ReplyGetNextCalendar(GSM_Protocol_Message msg, GSM_StateM | |||
2398 | } | 2404 | } |
2399 | } | 2405 | } |
2400 | return ERR_NONE; | 2406 | return ERR_NONE; |
2401 | case 0x93: | 2407 | case 0x93: |
2402 | smprintf(s, "Can't get calendar note - too high location?\n"); | 2408 | smprintf(s, "Can't get calendar note - too high location?\n"); |
2403 | return ERR_INVALIDLOCATION; | 2409 | return ERR_INVALIDLOCATION; |
2404 | } | 2410 | } |
2405 | return ERR_UNKNOWNRESPONSE; | 2411 | return ERR_UNKNOWNRESPONSE; |
2406 | } | 2412 | } |
2407 | 2413 | ||
2408 | static GSM_Error N6110_GetNextCalendarNote(GSM_StateMachine *s, GSM_CalendarEntry *Note, bool start) | 2414 | static GSM_Error N6110_GetNextCalendarNote(GSM_StateMachine *s, GSM_CalendarEntry *Note, bool start) |
2409 | { | 2415 | { |
2410 | int Text, Time, Alarm, Phone, Recurrance, EndTime, Location; | 2416 | int Text, Time, Alarm, Phone, Recurrance, EndTime, Location; |
2411 | GSM_Error error; | 2417 | GSM_Error error; |
2412 | GSM_DateTime date_time; | 2418 | GSM_DateTime date_time; |
2413 | GSM_Phone_N6110Data *Priv = &s->Phone.Data.Priv.N6110; | 2419 | GSM_Phone_N6110Data *Priv = &s->Phone.Data.Priv.N6110; |
2414 | unsigned char req[] = {N6110_FRAME_HEADER, 0x66, | 2420 | unsigned char req[] = {N6110_FRAME_HEADER, 0x66, |
2415 | 0x00}; /* Location */ | 2421 | 0x00}; /* Location */ |
2416 | 2422 | ||
2417 | if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_NOCALENDAR)) return ERR_NOTSUPPORTED; | 2423 | if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_NOCALENDAR)) return ERR_NOTSUPPORTED; |
2418 | 2424 | ||
2419 | if (start) { | 2425 | if (start) { |
2420 | Priv->LastCalendarPos = 1; | 2426 | Priv->LastCalendarPos = 1; |
2421 | } else { | 2427 | } else { |
2422 | Priv->LastCalendarPos++; | 2428 | Priv->LastCalendarPos++; |
2423 | } | 2429 | } |
2424 | 2430 | ||
2425 | Note->Location = Priv->LastCalendarPos; | 2431 | Note->Location = Priv->LastCalendarPos; |
2426 | req[4] = Priv->LastCalendarPos; | 2432 | req[4] = Priv->LastCalendarPos; |
2427 | 2433 | ||
2428 | s->Phone.Data.Cal=Note; | 2434 | s->Phone.Data.Cal=Note; |
2429 | smprintf(s, "Getting calendar note\n"); | 2435 | smprintf(s, "Getting calendar note\n"); |
2430 | error=GSM_WaitFor (s, req, 5, 0x13, 4, ID_GetCalendarNote); | 2436 | error=GSM_WaitFor (s, req, 5, 0x13, 4, ID_GetCalendarNote); |
2431 | 2437 | ||
2432 | GSM_CalendarFindDefaultTextTimeAlarmPhoneRecurrance(Note, &Text, &Time, &Alarm, &Phone, &Recurrance, &EndTime, &Location); | 2438 | GSM_CalendarFindDefaultTextTimeAlarmPhoneRecurrance(Note, &Text, &Time, &Alarm, &Phone, &Recurrance, &EndTime, &Location); |
2433 | /* 2090 year is set for example in 3310 */ | 2439 | /* 2090 year is set for example in 3310 */ |
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) |
2460 | { | 2466 | { |
2461 | GSM_Error error; | 2467 | GSM_Error error; |
2462 | unsigned char req1[] = {N6110_FRAME_HEADER, 0x42, 0x05, 0x01, | 2468 | unsigned char req1[] = {N6110_FRAME_HEADER, 0x42, 0x05, 0x01, |
2463 | 0x07, 0xa2, 0x88, 0x81, 0x21, 0x15, 0x63, 0xa8, | 2469 | 0x07, 0xa2, 0x88, 0x81, 0x21, 0x15, 0x63, 0xa8, |
2464 | 0x00, 0x00, 0x07, 0xa3, 0xb8, 0x81, 0x20, 0x15, | 2470 | 0x00, 0x00, 0x07, 0xa3, 0xb8, 0x81, 0x20, 0x15, |
2465 | 0x63, 0x80}; | 2471 | 0x63, 0x80}; |
2466 | 2472 | ||
2467 | if (!all) { | 2473 | if (!all) { |
2468 | smprintf(s, "Answering call part 1\n"); | 2474 | smprintf(s, "Answering call part 1\n"); |
2469 | error = GSM_WaitFor (s, req1, 24, 0x01, 5, ID_AnswerCall); | 2475 | error = GSM_WaitFor (s, req1, 24, 0x01, 5, ID_AnswerCall); |
2470 | if (error != ERR_NONE) return error; | 2476 | if (error != ERR_NONE) return error; |
2471 | return DCT3DCT4_AnswerCall(s,ID); | 2477 | return DCT3DCT4_AnswerCall(s,ID); |
2472 | } | 2478 | } |
2473 | 2479 | ||
2474 | return DCT3_AnswerAllCalls(s); | 2480 | return DCT3_AnswerAllCalls(s); |
2475 | } | 2481 | } |
2476 | 2482 | ||
2477 | static GSM_Error N6110_DialVoice(GSM_StateMachine *s, char *number, GSM_CallShowNumber ShowNumber) | 2483 | static GSM_Error N6110_DialVoice(GSM_StateMachine *s, char *number, GSM_CallShowNumber ShowNumber) |
2478 | { | 2484 | { |
2479 | unsigned int pos = 4; | 2485 | unsigned int pos = 4; |
2480 | unsigned char req[100] = {N6110_FRAME_HEADER,0x01, | 2486 | unsigned char req[100] = {N6110_FRAME_HEADER,0x01, |
2481 | 0x0c}; /* Length of number */ | 2487 | 0x0c}; /* Length of number */ |
2482 | 2488 | ||
2483 | if (ShowNumber == GSM_CALL_DefaultNumberPresence) return DCT3_DialVoice(s,number,ShowNumber); | 2489 | if (ShowNumber == GSM_CALL_DefaultNumberPresence) return DCT3_DialVoice(s,number,ShowNumber); |
2484 | 2490 | ||
2485 | req[pos++] = strlen(number); | 2491 | req[pos++] = strlen(number); |
2486 | memcpy(req+pos,number,strlen(number)); | 2492 | memcpy(req+pos,number,strlen(number)); |
2487 | pos += strlen(number); | 2493 | pos += strlen(number); |
2488 | req[pos++] = 0x05; /* call type: voice - 0x05, data - 0x01 */ | 2494 | req[pos++] = 0x05; /* call type: voice - 0x05, data - 0x01 */ |
2489 | req[pos++] = 0x01; | 2495 | req[pos++] = 0x01; |
2490 | req[pos++] = 0x01; | 2496 | req[pos++] = 0x01; |
2491 | req[pos++] = 0x05; | 2497 | req[pos++] = 0x05; |
2492 | req[pos++] = 0x81; | 2498 | req[pos++] = 0x81; |
2493 | switch (ShowNumber) { | 2499 | switch (ShowNumber) { |
2494 | case GSM_CALL_HideNumber: | 2500 | case GSM_CALL_HideNumber: |
2495 | req[pos++] = 0x02; | 2501 | req[pos++] = 0x02; |
@@ -2762,123 +2768,124 @@ GSM_Phone_Functions N6110Phone = { | |||
2762 | NOKIA_GetManufacturer, | 2768 | NOKIA_GetManufacturer, |
2763 | DCT3DCT4_GetModel, | 2769 | DCT3DCT4_GetModel, |
2764 | DCT3DCT4_GetFirmware, | 2770 | DCT3DCT4_GetFirmware, |
2765 | DCT3_GetIMEI, | 2771 | DCT3_GetIMEI, |
2766 | DCT3_GetOriginalIMEI, | 2772 | DCT3_GetOriginalIMEI, |
2767 | DCT3_GetManufactureMonth, | 2773 | DCT3_GetManufactureMonth, |
2768 | DCT3_GetProductCode, | 2774 | DCT3_GetProductCode, |
2769 | DCT3_GetHardware, | 2775 | DCT3_GetHardware, |
2770 | DCT3_GetPPM, | 2776 | DCT3_GetPPM, |
2771 | NOTSUPPORTED, /* GetSIMIMSI */ | 2777 | NOTSUPPORTED, /* GetSIMIMSI */ |
2772 | N6110_GetDateTime, | 2778 | N6110_GetDateTime, |
2773 | N6110_SetDateTime, | 2779 | N6110_SetDateTime, |
2774 | N6110_GetAlarm, | 2780 | N6110_GetAlarm, |
2775 | N6110_SetAlarm, | 2781 | N6110_SetAlarm, |
2776 | NOTSUPPORTED, /* GetLocale */ | 2782 | NOTSUPPORTED, /* GetLocale */ |
2777 | NOTSUPPORTED, /* SetLocale */ | 2783 | NOTSUPPORTED, /* SetLocale */ |
2778 | DCT3_PressKey, | 2784 | DCT3_PressKey, |
2779 | DCT3_Reset, | 2785 | DCT3_Reset, |
2780 | N61_71_ResetPhoneSettings, | 2786 | N61_71_ResetPhoneSettings, |
2781 | N6110_EnterSecurityCode, | 2787 | N6110_EnterSecurityCode, |
2782 | N6110_GetSecurityStatus, | 2788 | N6110_GetSecurityStatus, |
2783 | N6110_GetDisplayStatus, | 2789 | N6110_GetDisplayStatus, |
2784 | NOTIMPLEMENTED, /* SetAutoNetworkLogin */ | 2790 | NOTIMPLEMENTED, /* SetAutoNetworkLogin */ |
2785 | N6110_GetBatteryCharge, | 2791 | N6110_GetBatteryCharge, |
2786 | N6110_GetSignalQuality, | 2792 | N6110_GetSignalQuality, |
2787 | DCT3_GetNetworkInfo, | 2793 | DCT3_GetNetworkInfo, |
2788 | NOTSUPPORTED, /* GetCategory */ | 2794 | NOTSUPPORTED, /* GetCategory */ |
2789 | NOTSUPPORTED, /* AddCategory */ | 2795 | NOTSUPPORTED, /* AddCategory */ |
2790 | NOTSUPPORTED, /* GetCategoryStatus */ | 2796 | NOTSUPPORTED, /* GetCategoryStatus */ |
2791 | N6110_GetMemoryStatus, | 2797 | N6110_GetMemoryStatus, |
2792 | N6110_GetMemory, | 2798 | N6110_GetMemory, |
2793 | NOTIMPLEMENTED, /* GetNextMemory */ | 2799 | NOTIMPLEMENTED, /* GetNextMemory */ |
2794 | N6110_SetMemory, | 2800 | N6110_SetMemory, |
2795 | NOTIMPLEMENTED, /* AddMemory */ | 2801 | NOTIMPLEMENTED, /* AddMemory */ |
2796 | N6110_DeleteMemory, | 2802 | N6110_DeleteMemory, |
2797 | NOTIMPLEMENTED, /* DeleteAllMemory */ | 2803 | NOTIMPLEMENTED, /* DeleteAllMemory */ |
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, |
2822 | N6110_TransferCall, | 2829 | N6110_TransferCall, |
2823 | N6110_SwitchCall, | 2830 | N6110_SwitchCall, |
2824 | DCT3DCT4_GetCallDivert, | 2831 | DCT3DCT4_GetCallDivert, |
2825 | DCT3DCT4_SetCallDivert, | 2832 | DCT3DCT4_SetCallDivert, |
2826 | DCT3DCT4_CancelAllDiverts, | 2833 | DCT3DCT4_CancelAllDiverts, |
2827 | NOKIA_SetIncomingCall, | 2834 | NOKIA_SetIncomingCall, |
2828 | NOKIA_SetIncomingUSSD, | 2835 | NOKIA_SetIncomingUSSD, |
2829 | DCT3DCT4_SendDTMF, | 2836 | DCT3DCT4_SendDTMF, |
2830 | N6110_GetRingtone, | 2837 | N6110_GetRingtone, |
2831 | N6110_SetRingtone, | 2838 | N6110_SetRingtone, |
2832 | NOTSUPPORTED, /* GetRingtonesInfo */ | 2839 | NOTSUPPORTED, /* GetRingtonesInfo */ |
2833 | NOTSUPPORTED, /* DeleteUserRingtones */ | 2840 | NOTSUPPORTED, /* DeleteUserRingtones */ |
2834 | DCT3_PlayTone, | 2841 | DCT3_PlayTone, |
2835 | DCT3_GetWAPBookmark, | 2842 | DCT3_GetWAPBookmark, |
2836 | DCT3_SetWAPBookmark, | 2843 | DCT3_SetWAPBookmark, |
2837 | DCT3_DeleteWAPBookmark, | 2844 | DCT3_DeleteWAPBookmark, |
2838 | DCT3_GetWAPSettings, | 2845 | DCT3_GetWAPSettings, |
2839 | DCT3_SetWAPSettings, | 2846 | DCT3_SetWAPSettings, |
2840 | NOTSUPPORTED, /* GetMMSSettings */ | 2847 | NOTSUPPORTED, /* GetMMSSettings */ |
2841 | NOTSUPPORTED, /* SetMMSSettings */ | 2848 | NOTSUPPORTED, /* SetMMSSettings */ |
2842 | NOTSUPPORTED, /* GetSyncMLSettings*/ | 2849 | NOTSUPPORTED, /* GetSyncMLSettings*/ |
2843 | NOTSUPPORTED, /* SetSyncMLSettings*/ | 2850 | NOTSUPPORTED, /* SetSyncMLSettings*/ |
2844 | NOTSUPPORTED, /* GetChatSettings */ | 2851 | NOTSUPPORTED, /* GetChatSettings */ |
2845 | NOTSUPPORTED, /* SetChatSettings */ | 2852 | NOTSUPPORTED, /* SetChatSettings */ |
2846 | N6110_GetBitmap, | 2853 | N6110_GetBitmap, |
2847 | N6110_SetBitmap, | 2854 | N6110_SetBitmap, |
2848 | NOTSUPPORTED, /* GetToDoStatus */ | 2855 | NOTSUPPORTED, /* GetToDoStatus */ |
2849 | NOTSUPPORTED, /* GetToDo */ | 2856 | NOTSUPPORTED, /* GetToDo */ |
2850 | NOTSUPPORTED, /* GetNextToDo */ | 2857 | NOTSUPPORTED, /* GetNextToDo */ |
2851 | NOTSUPPORTED, /* SetToDo */ | 2858 | NOTSUPPORTED, /* SetToDo */ |
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 */ |
2877 | NOTSUPPORTED /* SetGPRSAccessPoint */ | 2884 | NOTSUPPORTED /* SetGPRSAccessPoint */ |
2878 | }; | 2885 | }; |
2879 | 2886 | ||
2880 | #endif | 2887 | #endif |
2881 | 2888 | ||
2882 | /* How should editor hadle tabs in this file? Add editor commands here. | 2889 | /* How should editor hadle tabs in this file? Add editor commands here. |
2883 | * vim: noexpandtab sw=8 ts=8 sts=8: | 2890 | * vim: noexpandtab sw=8 ts=8 sts=8: |
2884 | */ | 2891 | */ |