5 #ifdef GSM_ENABLE_NOKIA6510 10 #include "../../../../misc/coding/coding.h" 11 #include "../../../../gsmcomon.h" 12 #include "../../../../service/gsmlogo.h" 13 #include "../../../../service/gsmcal.h" 14 #include "../../nfunc.h" 15 #include "../../nfuncold.h" 16 #include "../../../pfunc.h" 17 #include "../dct4func.h" 25 while (Last->
Location[j] != 0x00) j++;
27 smprintf(s,
"Increase GSM_MAXCALENDARTODONOTES\n");
35 while (14+(i*4) <= msg->
Length) {
41 smprintf(s,
"\nNumber of Entries in frame: %ld\n", (
long)i);
63 smprintf(s,
"Getting locations for calendar method 3\n");
65 }
else if (Type == 1) {
66 smprintf(s,
"Getting locations for ToDo method 2\n");
68 }
else if (Type == 2) {
69 smprintf(s,
"Getting locations for Notes\n");
76 while (Last->
Location[i] != 0x00) i++;
78 if (i == Last->
Number)
break;
80 smprintf(s,
"Phone doesn't support some notes with this method. Workaround\n");
87 smprintf(s,
"Getting locations for calendar method 3\n");
89 }
else if (Type == 1) {
90 smprintf(s,
"Getting locations for todo method 2\n");
92 }
else if (Type == 2) {
93 smprintf(s,
"Getting locations for Notes\n");
111 smprintf(s,
"Calendar note received method 3\n");
124 smprintf(s,
"StartTime: %04i-%02i-%02i %02i:%02i\n",
151 smprintf(s,
"EndTime: %04i-%02i-%02i %02i:%02i\n",
180 diff = ((
unsigned int)msg->
Buffer[14]) << 24;
181 diff += ((
unsigned int)msg->
Buffer[15]) << 16;
182 diff += ((
unsigned int)msg->
Buffer[16]) << 8;
187 smprintf(s,
"Alarm date : %02i-%02i-%04i %02i:%02i:%02i\n",
196 smprintf(s,
"Alarm type : Silent\n");
202 if (msg->
Buffer[42] == 0xff && msg->
Buffer[43] == 0xff) {
245 0xff,0xff,0xff,0xff};
247 req[8] = Location / 256;
248 req[9] = Location % 256;
273 *LastCalendarYear = date_time.
Year;
280 smprintf(s,
"Getting calendar note method 3\n");
291 error=N6510_GetCalendarInfo3(s,LastCalendar,0);
295 *LastCalendarPos = 0;
297 (*LastCalendarPos)++;
306 error=N6510_PrivGetCalendar3(s, Note, start2, LastCalendarYear);
307 if (error ==
ERR_EMPTY) (*LastCalendarPos)++;
321 smprintf(s,
"Info with calendar notes locations received method 3\n");
322 return N6510_ReplyGetCalendarInfo3(msg, s, &s->
Phone.
Data.
Priv.N6510.LastCalendar);
340 smprintf(s,
"Getting first free calendar note location\n");
353 return N6510_ReplyGetCalendarNotePos3(msg, s,&s->
Phone.
Data.
Priv.N6510.FirstCalendarPos);
360 int i,j,LastCalendarYear;
374 smprintf(s,
"Starting finding note ID\n");
378 if (error !=
ERR_NONE)
return error;
399 if (error !=
ERR_NONE)
return error;
403 if (error !=
ERR_NONE)
return error;
407 for(i=0;i<LastCalendar2.
Number;i++) {
409 for(j=0;j<LastCalendar1.
Number;j++) {
417 error=N6510_PrivGetCalendar3(s, &Note,
TRUE, &LastCalendarYear);
418 if (error !=
ERR_NONE)
return error;
421 if (error !=
ERR_NONE)
return error;
423 smprintf(s,
"Ending finding note ID\n");
441 smprintf(s,
"Calendar note added\n");
449 time_t t_time1,t_time2;
453 int Text, Time, Alarm, Phone, EndTime, Location, count=54;
454 unsigned char req[5000] = {
459 0x00, 0x00, 0x00, 0x00,
460 0xFF, 0xFF, 0xFF, 0xFF,
463 0xFF, 0xFF, 0xFF, 0xFF,
466 0x07, 0xD0, 0x01, 0x12, 0x0C, 0x00,
467 0x07, 0xD0, 0x01, 0x12, 0x0C, 0x00,
478 error=N6510_GetCalendarNotePos3(s);
481 req[8] = *FirstCalendarPos/256;
482 req[9] = *FirstCalendarPos%256;
495 OldNoteType = Note->
Type;
496 Note->
Type = NoteType;
497 error=N6510_FindCalendarIconID3(s, Note, &req[21]);
498 Note->
Type = OldNoteType;
509 req[28] = DT.
Year / 256;
510 req[29] = DT.
Year % 256;
528 req[28] = date_time.
Year / 256;
529 req[29] = date_time.
Year % 256;
534 req[42] = DT.
Year / 256;
535 req[43] = DT.
Year % 256;
541 req[34] = DT.
Year / 256;
542 req[35] = DT.
Year % 256;
548 req[34] = date_time.
Year / 256;
549 req[35] = date_time.
Year % 256;
557 req[22] = 0x00; req[23] = 0x00; req[24] = 0x00; req[25] = 0x00;
562 diff = (t_time1-t_time2)/60;
564 smprintf(s,
" Difference : %li seconds or minutes\n", -diff);
565 req[14] = (
unsigned char)(-diff >> 24);
566 req[15] = (
unsigned char)(-diff >> 16);
567 req[16] = (
unsigned char)(-diff >> 8);
568 req[17] = (
unsigned char)(-diff);
575 count += req[49] * 2 + (req[48] * 256) * 2;
597 smprintf(s,
"Writing calendar note method 3\n");
603 #ifdef GSM_FORCE_DCT4_CALENDAR_6210 624 #ifdef GSM_FORCE_DCT4_CALENDAR_6210 648 error=N6510_GetCalendarInfo3(s,&s->
Phone.
Data.
Priv.N6510.LastCalendar,0);
657 #ifdef GSM_FORCE_DCT4_CALENDAR_6210 666 return N6510_AddCalendar3(s, Note, &s->
Phone.
Data.
Priv.N6510.FirstCalendarPos);
672 return N6510_ReplyGetCalendarInfo3(msg, s, &s->
Phone.
Data.
Priv.N6510.LastNote);
701 error=N6510_GetCalendarInfo3(s,LastNote,2);
723 error=N6510_GetCalendarInfo3(s,LastNote,2);
758 0x00, 0x00, 0x00, 0x00,
759 0xFF, 0xFF, 0xFF, 0xFF,
762 0x00, 0x00, 0x00, 0x00,
765 0x07, 0xD2, 0x01, 0x01, 0x00, 0x00,
766 0x07, 0xD2, 0x01, 0x11, 0x00, 0x00,
779 smprintf(s,
"Getting first free Note location\n");
786 req[48] = length / 256;
787 req[49] = length % 256;
802 error = N6510_GetCalendarInfo3(s,LastNote,2);
815 smprintf(s,
"TODO locations received\n");
819 for (i=0;i<Last->
Number;i++) {
832 unsigned char reqLoc[] = {
834 0x15, 0x01, 0x00, 0x00,
837 smprintf(s,
"Getting ToDo locations\n");
839 if (error !=
ERR_NONE)
return error;
854 error = N6510_GetCalendarInfo3(s,LastToDo,1);
870 return N6510_GetToDoStatus1(s, status);
872 return N6510_GetToDoStatus2(s, status);
883 smprintf(s,
"TODO received method 1\n");
912 unsigned char reqGet[] = {
914 0x03, 0x00, 0x00, 0x80, 0x00,
919 if (error !=
ERR_NONE)
return error;
935 return N6510_ReplyGetCalendarInfo3(msg, s, &s->
Phone.
Data.
Priv.N6510.LastToDo);
946 smprintf(s,
"ToDo received method 2\n");
953 switch (msg->
Buffer[44]) {
973 smprintf(s,
"EndTime: %04i-%02i-%02i %02i:%02i\n",
987 smprintf(s,
"StartTime: %04i-%02i-%02i %02i:%02i\n",
1001 if (msg->
Buffer[45] == 0x01) {
1011 diff = ((
unsigned int)msg->
Buffer[14]) << 24;
1012 diff += ((
unsigned int)msg->
Buffer[15]) << 16;
1013 diff += ((
unsigned int)msg->
Buffer[16]) << 8;
1018 smprintf(s,
"Alarm date : %02i-%02i-%04i %02i:%02i:%02i\n",
1028 smprintf(s,
"Alarm type : Silent\n");
1043 error=N6510_GetCalendarInfo3(s,LastToDo,1);
1053 smprintf(s,
"Getting todo method 2\n");
1060 return N6510_GetNextToDo1(s, ToDo, refresh);
1062 return N6510_GetNextToDo2(s, ToDo, refresh);
1084 smprintf(s,
"Deleting all ToDo method 1\n");
1098 error=N6510_GetCalendarInfo3(s,LastToDo,1);
1101 smprintf(s,
"Deleting ToDo method 2\n");
1112 smprintf(s,
"TODO first location received method 1: %02x\n",msg->
Buffer[9]);
1127 int Text, Alarm, EndTime, Completed, ulen, Phone;
1130 unsigned char reqSet[500] = {
1139 smprintf(s,
"Getting first ToDo location\n");
1141 if (error !=
ERR_NONE)
return error;
1157 reqSet[10+ulen*2] = 0x00;
1158 reqSet[10+ulen*2+1] = 0x00;
1159 smprintf(s,
"Adding ToDo method 1\n");
1165 smprintf(s,
"ToDo added method 2\n");
1179 time_t t_time1,t_time2;
1183 int Text, Alarm, EndTime, Completed, count=54, Phone;
1191 0x00, 0x00, 0x00, 0x00,
1192 0xFF, 0xFF, 0xFF, 0xFF,
1195 0xFF, 0xFF, 0xFF, 0xFF,
1198 0x07, 0xD0, 0x01, 0x12, 0x0C, 0x00,
1199 0x07, 0xD0, 0x01, 0x12, 0x0C, 0x00,
1212 smprintf(s,
"Getting first free ToDo location method 2\n");
1229 error=N6510_FindCalendarIconID3(s, &Note, &req[21]);
1241 if (Completed != -1) req[45] = 0x01;
1243 if (EndTime == -1) {
1249 req[28] = DT.
Year / 256;
1250 req[29] = DT.
Year % 256;
1256 req[34] = DT.
Year / 256;
1257 req[35] = DT.
Year % 256;
1266 req[22] = 0x00; req[23] = 0x00; req[24] = 0x00; req[25] = 0x00;
1270 diff = (t_time1-t_time2)/60;
1272 smprintf(s,
" Difference : %li seconds or minutes\n", -diff);
1273 req[14] = (
unsigned char)(-diff >> 24);
1274 req[15] = (
unsigned char)(-diff >> 16);
1275 req[16] = (
unsigned char)(-diff >> 8);
1276 req[17] = (
unsigned char)(-diff);
1283 count += req[49] * 2 + (req[48] * 256) * 2;
1286 req[count++] = 0x00;
1288 smprintf(s,
"Adding ToDo method 2\n");
1295 return N6510_AddToDo1(s, ToDo);
1297 return N6510_AddToDo2(s, ToDo);
1307 switch (msg->
Buffer[3]) {
1309 smprintf(s,
"Auto deleting setting received\n");
1313 smprintf(s,
"Start day for calendar received\n");
1341 smprintf(s,
"Getting auto delete\n");
1343 if (error !=
ERR_NONE)
return error;
1345 smprintf(s,
"Getting start day for week\n");
GSM_Error N6510_GetNextNote(GSM_StateMachine *s, GSM_NoteEntry *Note, gboolean start)
void GSM_ToDoFindDefaultTextTimeAlarmCompleted(GSM_ToDoEntry *entry, int *Text, int *Alarm, int *Completed, int *EndTime, int *Phone)
GSM_Error N6510_ReplyGetCalendarInfo(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_Error N6510_ReplyGetToDoFirstLoc1(GSM_Protocol_Message *msg, GSM_StateMachine *s)
char * DecodeUnicodeString(const unsigned char *src)
void CopyUnicodeString(unsigned char *Dest, const unsigned char *Source)
GSM_ToDo_Priority Priority
GSM_Error N71_65_AddCalendar1(GSM_StateMachine *s, GSM_CalendarEntry *Note, int *FirstCalendarPos)
GSM_Error N6510_ReplyGetToDo2(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_Error N6510_ReplyGetCalendarSettings(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_Error N6510_AddCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Note)
#define GSM_MAX_CALENDAR_TEXT_LENGTH
GSM_CalendarNoteType Type
void GetTimeDifference(unsigned long diff, GSM_DateTime *DT, gboolean Plus, int multi)
#define N6110_FRAME_HEADER
GSM_Error N6510_DeleteAllToDo1(GSM_StateMachine *s)
GSM_Error N71_65_DelCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Note)
GSM_CalendarSettings * CalendarSettings
GSM_Error N71_65_GetCalendarInfo1(GSM_StateMachine *s, GSM_NOKIACalToDoLocations *LastCalendar)
GSM_Error N6510_GetToDoStatus(GSM_StateMachine *s, GSM_ToDoStatus *status)
GSM_Error N6510_AddToDo(GSM_StateMachine *s, GSM_ToDoEntry *ToDo)
GSM_Error N6510_ReplyGetNoteInfo(GSM_Protocol_Message *msg, GSM_StateMachine *s)
size_t UnicodeLength(const unsigned char *str)
GSM_Error N71_65_ReplyGetCalendarNotePos1(GSM_Protocol_Message *msg, GSM_StateMachine *s, int *FirstCalendarPos)
void GSM_SetCalendarRecurranceRepeat(GSM_Debug_Info *di, unsigned char *rec, unsigned char *endday, GSM_CalendarEntry *entry)
GSM_CalendarNoteType N71_65_FindCalendarType(GSM_CalendarNoteType Type, GSM_PhoneModel *model)
GSM_Error N6510_ReplyDeleteAllToDo1(GSM_Protocol_Message *msg, GSM_StateMachine *s)
int Location[GSM_MAXCALENDARTODONOTES+1]
GSM_Error N6510_GetNextCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Note, gboolean start)
GSM_PhoneModel * ModelInfo
GSM_CalendarNoteType CalendarIconsTypes[10]
GSM_Error N6510_AddNote(GSM_StateMachine *s, GSM_NoteEntry *Not)
void GSM_GetCalendarRecurranceRepeat(GSM_Debug_Info *di, unsigned char *rec, unsigned char *endday, GSM_CalendarEntry *entry)
void GSM_CalendarFindDefaultTextTimeAlarmPhone(GSM_CalendarEntry *entry, int *Text, int *Time, int *Alarm, int *Phone, int *EndTime, int *Location)
char Text[(GSM_MAX_NOTE_TEXT_LENGTH+1) *2]
GSM_CalendarNoteType Type
void EncodeUnicode(unsigned char *dest, const char *src, size_t len)
GSM_Error N6510_ReplyGetCalendarNotePos(GSM_Protocol_Message *msg, GSM_StateMachine *s)
unsigned char CalendarIcons[10]
struct GSM_Phone_Data::@2 Priv
GSM_Error N6510_ReplyGetNote(GSM_Protocol_Message *msg, GSM_StateMachine *s)
#define GSM_MAX_NOTE_TEXT_LENGTH
GSM_SubToDoEntry Entries[GSM_TODO_ENTRIES]
GSM_NOKIACalToDoLocations LastCalendar
GSM_Error GSM_WaitFor(GSM_StateMachine *s, unsigned const char *buffer, size_t length, int type, int timeout, GSM_Phone_RequestID request)
#define GSM_MAXCALENDARTODONOTES
GSM_Error N6510_ReplyGetToDoFirstLoc2(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_Error N6510_ReplyAddCalendar3(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_Error N6510_ReplyGetToDoStatus1(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_Error N71_65_GetNextCalendar1(GSM_StateMachine *s, GSM_CalendarEntry *Note, gboolean start, GSM_NOKIACalToDoLocations *LastCalendar, int *LastCalendarYear, int *LastCalendarPos)
GSM_CalendarType EntryType
GSM_Error(* GetDateTime)(GSM_StateMachine *s, GSM_DateTime *date_time)
GSM_Error N71_65_ReplyGetCalendarInfo1(GSM_Protocol_Message *msg, GSM_StateMachine *s, GSM_NOKIACalToDoLocations *LastCalendar)
GSM_Error N6510_ReplyGetToDoStatus2(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_Error N6510_ReplyAddNote(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_SubCalendarEntry Entries[GSM_CALENDAR_ENTRIES]
GSM_Error N6510_GetNoteStatus(GSM_StateMachine *s, GSM_ToDoStatus *status)
void GSM_GetCurrentDateTime(GSM_DateTime *Date)
GSM_Error N6510_ReplyGetNoteFirstLoc(GSM_Protocol_Message *msg, GSM_StateMachine *s)
time_t Fill_Time_T(GSM_DateTime DT)
gboolean GSM_IsPhoneFeatureAvailable(GSM_PhoneModel *model, GSM_Feature feature)
GSM_Error N6510_DeleteToDo2(GSM_StateMachine *s, GSM_ToDoEntry *ToDo)
GSM_Phone_Functions * Functions
GSM_Error N6510_ReplyAddToDo2(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_Error N6510_GetCalendarStatus(GSM_StateMachine *s, GSM_CalendarStatus *Status)
GSM_Error N71_65_AddCalendar2(GSM_StateMachine *s, GSM_CalendarEntry *Note)
GSM_Error N6510_ReplyAddToDo1(GSM_Protocol_Message *msg, GSM_StateMachine *s)
#define GSM_MAX_TODO_TEXT_LENGTH
GSM_Error N6510_ReplyGetCalendar3(GSM_Protocol_Message *msg, GSM_StateMachine *s)
GSM_Error N6510_DeleteNote(GSM_StateMachine *s, GSM_NoteEntry *Not)
unsigned char Text[(GSM_MAX_TODO_TEXT_LENGTH+1) *2]
GSM_Error N6510_GetCalendarSettings(GSM_StateMachine *s, GSM_CalendarSettings *settings)
GSM_Error N6510_GetNextToDo(GSM_StateMachine *s, GSM_ToDoEntry *ToDo, gboolean refresh)
GSM_Error N6510_ReplyGetToDo1(GSM_Protocol_Message *msg, GSM_StateMachine *s)
unsigned char Text[(GSM_MAX_CALENDAR_TEXT_LENGTH+1) *2]
int smprintf(GSM_StateMachine *s, const char *format,...)