diff options
author | Uros Majstorovic <majstor@majstor.org> | 2023-04-21 21:18:57 +0200 |
---|---|---|
committer | Uros Majstorovic <majstor@majstor.org> | 2023-04-21 21:18:57 +0200 |
commit | 34f60314bedce036f982aa6591b5473ea4b0fa8b (patch) | |
tree | 9a779a703c7c8a2d4905bd0a7c06cb1ec36c9fb5 /fw | |
parent | 9cb8a37e71945800da5aa6fc05a9a32dc7bd0b69 (diff) |
fixed SMS app
Diffstat (limited to 'fw')
-rw-r--r-- | fw/fe310/eos/net/cell.c | 14 | ||||
-rw-r--r-- | fw/fe310/phone/sms.c | 22 |
2 files changed, 24 insertions, 12 deletions
diff --git a/fw/fe310/eos/net/cell.c b/fw/fe310/eos/net/cell.c index b0eb475..b560f52 100644 --- a/fw/fe310/eos/net/cell.c +++ b/fw/fe310/eos/net/cell.c @@ -213,9 +213,17 @@ int eos_cell_sms_send(char *num, char *text, unsigned char *buffer, int sync) { async = !sync; } buffer[0] = EOS_CELL_MTYPE_SMS | EOS_CELL_MTYPE_SMS_MSG; - buffer[1] = (*num == '+' ? EOS_CELL_SMS_ADDRTYPE_INTL : EOS_CELL_SMS_ADDRTYPE_OTHER); - buffer[2] = num_len; - len = 3; + buffer[1] = 0; + buffer[2] = 0; + if (*num == '+') { + buffer[3] = EOS_CELL_SMS_ADDRTYPE_INTL; + num++; + num_len--; + } else { + buffer[3] = EOS_CELL_SMS_ADDRTYPE_OTHER; + } + buffer[4] = num_len; + len = 5; strcpy(buffer + len, num); len += num_len; strcpy(buffer + len, text); diff --git a/fw/fe310/phone/sms.c b/fw/fe310/phone/sms.c index d2819c9..2594464 100644 --- a/fw/fe310/phone/sms.c +++ b/fw/fe310/phone/sms.c @@ -33,7 +33,8 @@ static void handle_cell_sms(unsigned char type, unsigned char *buffer, uint16_t APP_LOG(APP_LOG_ERR, "SMS PARSE ERR:%d\n", rv); break; } - APP_LOG(APP_LOG_DEBUG, "SMS From:%s\n%s\n", num, text); + APP_LOG(APP_LOG_DEBUG, "SMS From:%s\n", num); + APP_LOG(APP_LOG_DEBUG, "%s\n", text); break; } } @@ -58,21 +59,24 @@ void sms_init(void) { int sms_app(EVEWindow *window, EVEViewStack *stack) { EVEFormSpec spec[] = { { - .label.title = "Text:", + .label.title = "To:", .widget.type = EVE_WIDGET_TYPE_STR, - .widget.tspec.str.str_size = EOS_CELL_MAX_SMS_TEXT + 1, + .widget.tspec.str.str_size = EOS_CELL_MAX_DIAL_STR + 1, }, APP_SPACERW(APP_SCREEN_W, 50), { - .label.title = "Phone:", + .label.title = "Text:", + .label.g.w = APP_SCREEN_W, - .widget.type = EVE_WIDGET_TYPE_STR, - .widget.tspec.str.str_size = EOS_CELL_MAX_DIAL_STR + 1, + .widget.type = EVE_WIDGET_TYPE_TEXT, + .widget.g.w = APP_SCREEN_W, + .widget.tspec.text.text_size = EOS_CELL_MAX_SMS_TEXT + 1, + .widget.tspec.text.line_size = 5, }, }; - EVEPage *page = eve_form_create(window, stack, spec, APP_SPEC_SIZE(spec), NULL, sms_close); + EVEPage *page = eve_form_create(window, stack, spec, APP_SPEC_SIZE(spec), sms_uievt, sms_close); if (page == NULL) { APP_LOG(APP_LOG_ERR, "OUT OF MEMORY\n"); return EVE_ERR_NOMEM; @@ -87,8 +91,8 @@ int sms_uievt(EVEPage *page, uint16_t evt, void *param) { switch (evt) { case EVE_UIEVT_WIDGET_FOCUS_OUT: { if (param == eve_page_widget(page, 1)) { - EVEStrWidget *num = param; - EVEStrWidget *text = (EVEStrWidget *)eve_page_widget(page, 0); + EVEStrWidget *num = (EVEStrWidget *)eve_page_widget(page, 0); + EVEStrWidget *text = param; send(num->str, text->str); } |