-rw-r--r-- | gammu/emb/common/service/gsmcal.c | 2 | ||||
-rw-r--r-- | gammu/emb/gammu/gammu.c | 41 |
2 files changed, 35 insertions, 8 deletions
diff --git a/gammu/emb/common/service/gsmcal.c b/gammu/emb/common/service/gsmcal.c index 598292c..ddf9790 100644 --- a/gammu/emb/common/service/gsmcal.c +++ b/gammu/emb/common/service/gsmcal.c | |||
@@ -137,17 +137,17 @@ GSM_Error GSM_EncodeVCALENDAR(char *Buffer, int *Length, GSM_CalendarEntry *note | |||
137 | if (EndTime != -1) { | 137 | if (EndTime != -1) { |
138 | SaveVCALDateTime(Buffer, Length, ¬e->Entries[EndTime].Date, "DTEND"); | 138 | SaveVCALDateTime(Buffer, Length, ¬e->Entries[EndTime].Date, "DTEND"); |
139 | } | 139 | } |
140 | 140 | ||
141 | if (Alarm != -1) { | 141 | if (Alarm != -1) { |
142 | if (note->Entries[Alarm].EntryType == CAL_SILENT_ALARM_DATETIME) { | 142 | if (note->Entries[Alarm].EntryType == CAL_SILENT_ALARM_DATETIME) { |
143 | SaveVCALDateTime(Buffer, Length, ¬e->Entries[Alarm].Date, "DALARM"); | 143 | SaveVCALDateTime(Buffer, Length, ¬e->Entries[Alarm].Date, "DALARM"); |
144 | } else { | 144 | } else { |
145 | SaveVCALDateTime(Buffer, Length, ¬e->Entries[Alarm].Date, "AALARM"); | 145 | SaveVCALDateTime(Buffer, Length, ¬e->Entries[Alarm].Date, "DALARM"); |
146 | } | 146 | } |
147 | } | 147 | } |
148 | 148 | ||
149 | /* Birthday is known to be recurranced */ | 149 | /* Birthday is known to be recurranced */ |
150 | if (Recurrance != -1 && note->Type != GSM_CAL_BIRTHDAY) { | 150 | if (Recurrance != -1 && note->Type != GSM_CAL_BIRTHDAY) { |
151 | switch(note->Entries[Recurrance].Number/24) { | 151 | switch(note->Entries[Recurrance].Number/24) { |
152 | case 1 : *Length+=sprintf(Buffer+(*Length), "RRULE:D1 #0%c%c",13,10); break; | 152 | case 1 : *Length+=sprintf(Buffer+(*Length), "RRULE:D1 #0%c%c",13,10); break; |
153 | case 7 : *Length+=sprintf(Buffer+(*Length), "RRULE:W1 #0%c%c",13,10); break; | 153 | case 7 : *Length+=sprintf(Buffer+(*Length), "RRULE:W1 #0%c%c",13,10); break; |
diff --git a/gammu/emb/gammu/gammu.c b/gammu/emb/gammu/gammu.c index 5163d81..a3b93a8 100644 --- a/gammu/emb/gammu/gammu.c +++ b/gammu/emb/gammu/gammu.c | |||
@@ -8236,21 +8236,22 @@ int main(int argc, char *argv[]) | |||
8236 | 8236 | ||
8237 | /* Help? */ | 8237 | /* Help? */ |
8238 | if (strncmp(argv[1 + start], "--help", 6) == 0) { | 8238 | if (strncmp(argv[1 + start], "--help", 6) == 0) { |
8239 | Help(argc - start, argv + start); | 8239 | Help(argc - start, argv + start); |
8240 | exit(1); | 8240 | exit(1); |
8241 | } | 8241 | } |
8242 | 8242 | ||
8243 | /* Is first parameter numeric? If so treat it as config that should be loaded. */ | 8243 | /* Is first parameter numeric? If so treat it as config that should be loaded. */ |
8244 | if (isdigit(argv[1][0])) { | 8244 | //if (isdigit(argv[1][0])) { |
8245 | only_config = atoi(argv[1]); | 8245 | //only_config = atoi(argv[1]); |
8246 | if (only_config >= 0) start++; else only_config = -1; | 8246 | //if (only_config >= 0) start++; else only_config = -1; |
8247 | } | 8247 | //} |
8248 | 8248 | only_config = 0;; | |
8249 | #if 0 | ||
8249 | GSM_ReadConfig(NULL, &s.Config[0], 0); | 8250 | GSM_ReadConfig(NULL, &s.Config[0], 0); |
8250 | s.ConfigNum = 1; | 8251 | s.ConfigNum = 1; |
8251 | GSM_Config *con = &s.Config[0]; | 8252 | GSM_Config *con = &s.Config[0]; |
8252 | 8253 | ||
8253 | char* tempC; | 8254 | char* tempC; |
8254 | tempC = argv[argc-1]+2; | 8255 | tempC = argv[argc-1]+2; |
8255 | if ( *tempC != 0 ) { | 8256 | if ( *tempC != 0 ) { |
8256 | fprintf(stderr,"Using model %s \n",tempC); | 8257 | fprintf(stderr,"Using model %s \n",tempC); |
@@ -8264,17 +8265,17 @@ int main(int argc, char *argv[]) | |||
8264 | } | 8265 | } |
8265 | tempC = argv[argc-3]+2; | 8266 | tempC = argv[argc-3]+2; |
8266 | if ( *tempC != 0 ) { | 8267 | if ( *tempC != 0 ) { |
8267 | fprintf(stderr,"Using connection %s \n",tempC); | 8268 | fprintf(stderr,"Using connection %s \n",tempC); |
8268 | con->Connection = strdup(tempC); | 8269 | con->Connection = strdup(tempC); |
8269 | con->DefaultConnection = false; | 8270 | con->DefaultConnection = false; |
8270 | } | 8271 | } |
8271 | argc = argc-3; | 8272 | argc = argc-3; |
8272 | #if 0 | 8273 | //#if 0 |
8273 | if ( ! mConnection.isEmpty() ) { | 8274 | if ( ! mConnection.isEmpty() ) { |
8274 | cfg->Connection = strdup(mConnection.latin1()); | 8275 | cfg->Connection = strdup(mConnection.latin1()); |
8275 | cfg->DefaultConnection = false; | 8276 | cfg->DefaultConnection = false; |
8276 | qDebug("Connection set %s ", cfg->Connection ); | 8277 | qDebug("Connection set %s ", cfg->Connection ); |
8277 | 8278 | ||
8278 | } | 8279 | } |
8279 | if ( ! mDevice.isEmpty() ) { | 8280 | if ( ! mDevice.isEmpty() ) { |
8280 | cfg->Device = strdup(mDevice.latin1()); | 8281 | cfg->Device = strdup(mDevice.latin1()); |
@@ -8285,17 +8286,17 @@ int main(int argc, char *argv[]) | |||
8285 | if ( ! mModel.isEmpty() ) { | 8286 | if ( ! mModel.isEmpty() ) { |
8286 | strcpy(cfg->Model,mModel.latin1() ); | 8287 | strcpy(cfg->Model,mModel.latin1() ); |
8287 | cfg->DefaultModel = false; | 8288 | cfg->DefaultModel = false; |
8288 | qDebug("Model set %s ",cfg->Model ); | 8289 | qDebug("Model set %s ",cfg->Model ); |
8289 | } | 8290 | } |
8290 | 8291 | ||
8291 | #endif | 8292 | #endif |
8292 | 8293 | ||
8293 | #if 0 | 8294 | |
8294 | cfg=GSM_FindGammuRC(); | 8295 | cfg=GSM_FindGammuRC(); |
8295 | for (i = 0; i <= MAX_CONFIG_NUM; i++) { | 8296 | for (i = 0; i <= MAX_CONFIG_NUM; i++) { |
8296 | if (cfg!=NULL) { | 8297 | if (cfg!=NULL) { |
8297 | cp = INI_GetValue(cfg, "gammu", "gammucoding", false); | 8298 | cp = INI_GetValue(cfg, "gammu", "gammucoding", false); |
8298 | if (cp) di.coding = cp; | 8299 | if (cp) di.coding = cp; |
8299 | 8300 | ||
8300 | s.Config[i].Localize = INI_GetValue(cfg, "gammu", "gammuloc", false); | 8301 | s.Config[i].Localize = INI_GetValue(cfg, "gammu", "gammuloc", false); |
8301 | if (s.Config[i].Localize) { | 8302 | if (s.Config[i].Localize) { |
@@ -8310,16 +8311,17 @@ int main(int argc, char *argv[]) | |||
8310 | tolower(locale[1])); | 8311 | tolower(locale[1])); |
8311 | s.msg = INI_ReadFile(locale_file, true); | 8312 | s.msg = INI_ReadFile(locale_file, true); |
8312 | } | 8313 | } |
8313 | #endif | 8314 | #endif |
8314 | } | 8315 | } |
8315 | } | 8316 | } |
8316 | 8317 | ||
8317 | /* Wanted user specific configuration? */ | 8318 | /* Wanted user specific configuration? */ |
8319 | |||
8318 | if (only_config != -1) { | 8320 | if (only_config != -1) { |
8319 | /* Here we get only in first for loop */ | 8321 | /* Here we get only in first for loop */ |
8320 | if (!GSM_ReadConfig(cfg, &s.Config[0], only_config)) break; | 8322 | if (!GSM_ReadConfig(cfg, &s.Config[0], only_config)) break; |
8321 | } else { | 8323 | } else { |
8322 | if (!GSM_ReadConfig(cfg, &s.Config[i], i) && i != 0) break; | 8324 | if (!GSM_ReadConfig(cfg, &s.Config[i], i) && i != 0) break; |
8323 | } | 8325 | } |
8324 | s.ConfigNum++; | 8326 | s.ConfigNum++; |
8325 | 8327 | ||
@@ -8345,17 +8347,41 @@ int main(int argc, char *argv[]) | |||
8345 | /* If user gave debug file in gammurc, we will use it */ | 8347 | /* If user gave debug file in gammurc, we will use it */ |
8346 | error=GSM_SetDebugFile(s.Config[i].DebugFile, &di); | 8348 | error=GSM_SetDebugFile(s.Config[i].DebugFile, &di); |
8347 | Print_Error(error); | 8349 | Print_Error(error); |
8348 | } | 8350 | } |
8349 | 8351 | ||
8350 | /* We wanted to read just user specified configuration. */ | 8352 | /* We wanted to read just user specified configuration. */ |
8351 | if (only_config != -1) {break;} | 8353 | if (only_config != -1) {break;} |
8352 | } | 8354 | } |
8355 | #if 0 | ||
8356 | GSM_Config *con = &s.Config[0]; | ||
8357 | |||
8358 | char* tempC; | ||
8359 | tempC = argv[argc-1]+2; | ||
8360 | if ( *tempC != 0 ) { | ||
8361 | fprintf(stderr,"Using model %s \n",tempC); | ||
8362 | strcpy(con->Model,tempC ); | ||
8363 | } | ||
8364 | tempC = argv[argc-2]+2; | ||
8365 | if ( *tempC != 0 ) { | ||
8366 | fprintf(stderr,"Using device %s \n",tempC); | ||
8367 | con->Device = strdup(tempC); | ||
8368 | con->DefaultDevice = false; | ||
8369 | } | ||
8370 | tempC = argv[argc-3]+2; | ||
8371 | if ( *tempC != 0 ) { | ||
8372 | fprintf(stderr,"Using connection %s \n",tempC); | ||
8373 | con->Connection = strdup(tempC); | ||
8374 | con->DefaultConnection = false; | ||
8375 | } | ||
8353 | #endif | 8376 | #endif |
8377 | argc = argc-3; | ||
8378 | |||
8379 | |||
8354 | /* Do we have enough parameters? */ | 8380 | /* Do we have enough parameters? */ |
8355 | if (argc == 1 + start) { | 8381 | if (argc == 1 + start) { |
8356 | HelpGeneral(); | 8382 | HelpGeneral(); |
8357 | printmsg("Too few parameters!\n"); | 8383 | printmsg("Too few parameters!\n"); |
8358 | exit(-2); | 8384 | exit(-2); |
8359 | } | 8385 | } |
8360 | 8386 | ||
8361 | /* Check used version vs. compiled */ | 8387 | /* Check used version vs. compiled */ |
@@ -8364,16 +8390,17 @@ int main(int argc, char *argv[]) | |||
8364 | GetGammuVersion(),VERSION); | 8390 | GetGammuVersion(),VERSION); |
8365 | exit(-1); | 8391 | exit(-1); |
8366 | } | 8392 | } |
8367 | 8393 | ||
8368 | /* Check parameters */ | 8394 | /* Check parameters */ |
8369 | while (Parameters[z].Function != NULL) { | 8395 | while (Parameters[z].Function != NULL) { |
8370 | if (mystrncasecmp(Parameters[z].parameter,argv[1+start], 0)) { | 8396 | if (mystrncasecmp(Parameters[z].parameter,argv[1+start], 0)) { |
8371 | if (argc-2-start >= Parameters[z].min_arg && argc-2-start <= Parameters[z].max_arg) { | 8397 | if (argc-2-start >= Parameters[z].min_arg && argc-2-start <= Parameters[z].max_arg) { |
8398 | fprintf(stderr,"Executing \n"); | ||
8372 | Parameters[z].Function(argc - start, argv + start); | 8399 | Parameters[z].Function(argc - start, argv + start); |
8373 | break; | 8400 | break; |
8374 | } else { | 8401 | } else { |
8375 | count_failed = true; | 8402 | count_failed = true; |
8376 | } | 8403 | } |
8377 | } | 8404 | } |
8378 | z++; | 8405 | z++; |
8379 | } | 8406 | } |