Changeset 2720
- Timestamp:
- 08/17/07 10:29:08 (6 years ago)
- Location:
- trunk/src/target/gsm
- Files:
-
- 11 edited
-
include/gsmd/sms.h (modified) (1 diff)
-
include/gsmd/usock.h (modified) (1 diff)
-
include/libgsmd/misc.h (modified) (1 diff)
-
include/libgsmd/sms.h (modified) (1 diff)
-
src/gsmd/sms_cb.c (modified) (3 diffs)
-
src/gsmd/usock.c (modified) (11 diffs)
-
src/libgsmd/lgsm_internals.h (modified) (1 diff)
-
src/libgsmd/libgsmd.c (modified) (1 diff)
-
src/libgsmd/libgsmd_sms.c (modified) (8 diffs)
-
src/libgsmd/libgsmd_voicecall.c (modified) (1 diff)
-
src/util/shell.c (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/target/gsm/include/gsmd/sms.h
r2711 r2720 12 12 int pdulen, int len); 13 13 14 extern const char *ts0705_memtype_name[]; 15 int parse_memtype(char *memtype); 16 14 17 #endif /* __GSMD__ */ 15 18 -
trunk/src/target/gsm/include/gsmd/usock.h
r2713 r2720 330 330 }; 331 331 332 /* Refer to GSM 07.05 subclause 3.1 */ 333 enum ts0705_mem_type { 334 GSM0705_MEMTYPE_NONE, 335 GSM0705_MEMTYPE_BROADCAST, 336 GSM0705_MEMTYPE_ME_MESSAGE, 337 GSM0705_MEMTYPE_MT, 338 GSM0705_MEMTYPE_SIM, 339 GSM0705_MEMTYPE_TA, 340 GSM0705_MEMTYPE_SR, 341 }; 342 343 /* Refer to GSM 07.05 subclause 3.2.2 */ 344 struct __gsmd_sms_storage { 345 u_int8_t memtype; 346 u_int8_t pad[3]; 347 u_int16_t used; 348 u_int16_t total; 349 } __attribute__ ((packed)); 350 351 struct gsmd_sms_storage { 352 struct __gsmd_sms_storage mem[3]; 353 } __attribute__ ((packed)); 354 332 355 /* Refer to GSM 07.07 subclause 8.12 */ 333 356 struct gsmd_phonebook_readrg { -
trunk/src/target/gsm/include/libgsmd/misc.h
r2713 r2720 66 66 /* TBD */ 67 67 68 69 /* SMS related functions */70 /* TBD */71 72 73 68 /* GPRS related functions */ 74 69 /* TBD */ -
trunk/src/target/gsm/include/libgsmd/sms.h
r2710 r2720 62 62 63 63 /* Delete Message */ 64 extern int lgsm d_sms_delete(struct lgsm_handle *lh,64 extern int lgsm_sms_delete(struct lgsm_handle *lh, 65 65 const struct lgsm_sms_delete *sms_del); 66 66 67 67 /* Send Message */ 68 extern int lgsm d_sms_send(struct lgsm_handle *lh, const struct lgsm_sms *sms);68 extern int lgsm_sms_send(struct lgsm_handle *lh, const struct lgsm_sms *sms); 69 69 70 70 /* Write Message to Memory */ 71 extern int lgsm d_sms_write(struct lgsm_handle *lh,71 extern int lgsm_sms_write(struct lgsm_handle *lh, 72 72 const struct lgsm_sms_write *sms_write); 73 74 /* Retrieve SMS storage information */ 75 extern int lgsm_sms_get_storage(struct lgsm_handle *lh); 76 77 /* Set preferred SMS storage */ 78 extern int lgsm_sms_set_storage(struct lgsm_handle *lh, 79 enum ts0705_mem_type mem1, enum ts0705_mem_type mem2, 80 enum ts0705_mem_type mem3); 81 82 /* Retrieve current default service centre address */ 83 extern int lgsm_sms_get_smsc(struct lgsm_handle *lh); 84 85 /* Set new default service centre address */ 86 extern int lgsm_sms_set_smsc(struct lgsm_handle *lh, const char *number); 73 87 74 88 /* Packing of 7-bit characters, refer to GSM 03.38 subclause 6.1.2.1.1 */ -
trunk/src/target/gsm/src/gsmd/sms_cb.c
r2712 r2720 39 39 #include <gsmd/unsolicited.h> 40 40 41 enum ts0705_mem_type { 42 GSM0705_MEMTYPE_NONE, 43 GSM0705_MEMTYPE_BROADCAST, 44 GSM0705_MEMTYPE_ME_MESSAGE, 45 GSM0705_MEMTYPE_MT, 46 GSM0705_MEMTYPE_SIM, 47 GSM0705_MEMTYPE_TA, 48 GSM0705_MEMTYPE_SR, 49 }; 50 51 static const char *ts0705_memtype_name[] = { 41 const char *ts0705_memtype_name[] = { 52 42 [GSM0705_MEMTYPE_NONE] = "NONE", 53 43 [GSM0705_MEMTYPE_BROADCAST] = "BM", … … 59 49 }; 60 50 61 staticinline int parse_memtype(char *memtype)51 inline int parse_memtype(char *memtype) 62 52 { 63 53 int i; … … 69 59 70 60 return GSM0705_MEMTYPE_NONE; 71 }72 73 /* TODO: move to headers */74 struct __gsmd_sms_storage {75 u_int8_t memtype;76 u_int8_t pad[3];77 u_int16_t used;78 u_int16_t total;79 } __attribute__ ((packed));80 81 struct gsmd_sms_storage {82 struct __gsmd_sms_storage mem[3];83 } __attribute__ ((packed));84 85 static int usock_cpms_cb(struct gsmd_atcmd *cmd, void *ctx, char *resp)86 {87 struct gsmd_user *gu = ctx;88 struct gsmd_ucmd *ucmd = ucmd_alloc(sizeof(struct gsmd_sms_storage));89 struct gsmd_sms_storage *gss = (typeof(gss)) ucmd->buf;90 char buf[3][3];91 92 DEBUGP("entering(cmd=%p, gu=%p)\n", cmd, gu);93 94 if (!ucmd)95 return -ENOMEM;96 97 ucmd->hdr.version = GSMD_PROTO_VERSION;98 ucmd->hdr.msg_type = GSMD_MSG_SMS;99 ucmd->hdr.msg_subtype = GSMD_SMS_GET_MSG_STORAGE;100 ucmd->hdr.len = sizeof(struct gsmd_sms_storage);101 ucmd->hdr.id = cmd->id;102 103 if (sscanf(resp, "+CPMS: \"%2[A-Z]\",%hi,%hi,"104 "\"%2[A-Z]\",%hi,%hi,\"%2[A-Z]\",%hi,%hi",105 buf[0], &gss->mem[0].used, &gss->mem[0].total,106 buf[1], &gss->mem[1].used, &gss->mem[1].total,107 buf[2], &gss->mem[2].used, &gss->mem[2].total)108 < 9) {109 talloc_free(ucmd);110 return -EINVAL;111 }112 113 gss->mem[0].memtype = parse_memtype(buf[0]);114 gss->mem[1].memtype = parse_memtype(buf[1]);115 gss->mem[2].memtype = parse_memtype(buf[2]);116 117 usock_cmd_enqueue(ucmd, gu);118 119 return 0;120 }121 122 /* main unix socket SMS receiver */123 static int usock_rcv_sms(struct gsmd_user *gu, struct gsmd_msg_hdr *gph,124 int len)125 {126 struct gsmd_atcmd *cmd;127 128 switch (gph->msg_subtype) {129 case GSMD_SMS_GET_SERVICE_CENTRE:130 return;131 case GSMD_SMS_SET_SERVICE_CENTRE:132 return;133 case GSMD_SMS_SET_MSG_STORAGE:134 return;135 case GSMD_SMS_GET_MSG_STORAGE:136 cmd = atcmd_fill("AT+CPMS?", 8 + 1, usock_cpms_cb, gu, 0);137 break;138 }139 140 return atcmd_submit(gu->gsmd, cmd);141 61 } 142 62 -
trunk/src/target/gsm/src/gsmd/usock.c
r2713 r2720 40 40 #include <gsmd/talloc.h> 41 41 #include <gsmd/ts0707.h> 42 #include <gsmd/sms.h> 42 43 43 44 static void *__ucmd_ctx, *__gu_ctx; … … 526 527 sscanf(resp, "+CMGL: %i,%i,,%i\n%n", 527 528 &idx, &stat, &len, &cr) < 3 && 528 sscanf(resp, "+CMGL: %i,%i, %*i,%i\n%n",529 sscanf(resp, "+CMGL: %i,%i,\"%*[^\"]\",%i\n%n", 529 530 &idx, &stat, &len, &cr) < 3) 530 531 return -EINVAL; … … 670 671 } 671 672 673 static int usock_cpms_cb(struct gsmd_atcmd *cmd, void *ctx, char *resp) 674 { 675 struct gsmd_user *gu = ctx; 676 struct gsmd_ucmd *ucmd = ucmd_alloc(sizeof(struct gsmd_sms_storage)); 677 struct gsmd_sms_storage *gss = (typeof(gss)) ucmd->buf; 678 char buf[3][3]; 679 680 DEBUGP("entering(cmd=%p, gu=%p)\n", cmd, gu); 681 682 if (!ucmd) 683 return -ENOMEM; 684 685 ucmd->hdr.version = GSMD_PROTO_VERSION; 686 ucmd->hdr.msg_type = GSMD_MSG_SMS; 687 ucmd->hdr.msg_subtype = GSMD_SMS_GET_MSG_STORAGE; 688 ucmd->hdr.len = sizeof(struct gsmd_sms_storage); 689 ucmd->hdr.id = cmd->id; 690 691 if (sscanf(resp, "+CPMS: \"%2[A-Z]\",%hi,%hi," 692 "\"%2[A-Z]\",%hi,%hi,\"%2[A-Z]\",%hi,%hi", 693 buf[0], &gss->mem[0].used, &gss->mem[0].total, 694 buf[1], &gss->mem[1].used, &gss->mem[1].total, 695 buf[2], &gss->mem[2].used, &gss->mem[2].total) 696 < 9) { 697 talloc_free(ucmd); 698 return -EINVAL; 699 } 700 701 gss->mem[0].memtype = parse_memtype(buf[0]); 702 gss->mem[1].memtype = parse_memtype(buf[1]); 703 gss->mem[2].memtype = parse_memtype(buf[2]); 704 705 usock_cmd_enqueue(ucmd, gu); 706 707 return 0; 708 } 709 710 static int usock_get_smsc_cb(struct gsmd_atcmd *cmd, void *ctx, char *resp) 711 { 712 struct gsmd_user *gu = ctx; 713 struct gsmd_ucmd *ucmd; 714 struct gsmd_addr *ga; 715 716 ucmd = gsmd_ucmd_fill(sizeof(struct gsmd_addr), GSMD_MSG_SMS, 717 GSMD_SMS_GET_SERVICE_CENTRE, cmd->id); 718 if (!ucmd) 719 return -ENOMEM; 720 721 ga = (struct gsmd_addr *) ucmd->buf; 722 if (sscanf(resp, "+CSCA: \"%31[^\"]\",%hhi", 723 ga->number, &ga->type) < 2) { 724 talloc_free(ucmd); 725 return -EINVAL; 726 } 727 728 usock_cmd_enqueue(ucmd, gu); 729 return 0; 730 } 731 672 732 static const char *gsmd_cmgl_stat[] = { 673 733 "REC UNREAD", "REC READ", "STO UNSENT", "STO SENT", "ALL", … … 682 742 struct gsmd_sms_submit *gss; 683 743 struct gsmd_sms_write *gsw; 744 struct gsmd_addr *ga; 745 enum ts0705_mem_type *storage; 684 746 int *stat, *index; 685 747 int atcmd_len; … … 694 756 return -EINVAL; 695 757 696 /* FIXME: should we set <mem1> to "SM"/"ME" before that? */697 758 if (gu->gsmd->flags & GSMD_FLAG_SMS_FMT_TEXT) 698 759 atcmd_len = sprintf(buf, "AT+CMGL=\"%s\"", … … 703 764 cmd = atcmd_fill(buf, atcmd_len + 1, 704 765 &sms_list_cb, gu, gph->id); 705 if (!cmd)706 return -ENOMEM;707 766 break; 708 767 … … 712 771 index = (int *) ((void *)gph + sizeof(*gph)); 713 772 714 /* FIXME: should we set <mem1> to "SM"/"ME" before that? */715 773 atcmd_len = sprintf(buf, "AT+CMGR=%i", *index); 716 774 717 775 cmd = atcmd_fill(buf, atcmd_len + 1, 718 776 &sms_read_cb, gu, gph->id); 719 if (!cmd)720 return -ENOMEM;721 777 break; 722 778 … … 741 797 742 798 cmd = atcmd_fill(buf, atcmd_len, &sms_send_cb, gu, gph->id); 743 if (!cmd)744 return -ENOMEM;745 799 break; 746 800 … … 752 806 return -EINVAL; 753 807 754 /* FIXME: should we set <mem2> to "SM"/"ME" before that? */755 808 if (gu->gsmd->flags & GSMD_FLAG_SMS_FMT_TEXT) { 756 809 atcmd_len = sprintf(buf, "AT+CMGW=\"%s\"\n%.*s", … … 769 822 770 823 cmd = atcmd_fill(buf, atcmd_len, &sms_write_cb, gu, gph->id); 771 if (!cmd)772 return -ENOMEM;773 824 break; 774 825 … … 782 833 783 834 cmd = atcmd_fill(buf, atcmd_len + 1, 784 &sms_delete_cb, gu, gph->id); 785 if (!cmd) 786 return -ENOMEM; 835 &sms_delete_cb, gu, gph->id); 836 break; 837 838 case GSMD_SMS_GET_MSG_STORAGE: 839 cmd = atcmd_fill("AT+CPMS?", 8 + 1, usock_cpms_cb, gu, 0); 840 break; 841 842 case GSMD_SMS_SET_MSG_STORAGE: 843 if (len < sizeof(*gph) + 3 * sizeof(enum ts0705_mem_type)) 844 return -EINVAL; 845 storage = (enum ts0705_mem_type *) 846 ((void *) gph + sizeof(*gph)); 847 atcmd_len = sprintf(buf, "AT+CPMS=\"%s\",\"%s\",\"%s\"", 848 ts0705_memtype_name[storage[0]], 849 ts0705_memtype_name[storage[1]], 850 ts0705_memtype_name[storage[2]]); 851 cmd = atcmd_fill(buf, atcmd_len + 1, 852 &null_cmd_cb, gu, gph->id); 787 853 break; 854 855 case GSMD_SMS_GET_SERVICE_CENTRE: 856 cmd = atcmd_fill("AT+CSCA?", 8 + 1, &usock_get_smsc_cb, gu, 0); 857 break; 858 859 case GSMD_SMS_SET_SERVICE_CENTRE: 860 if (len < sizeof(*gph) + sizeof(struct gsmd_addr)) 861 return -EINVAL; 862 ga = (struct gsmd_addr *) ((void *) gph + sizeof(*gph)); 863 atcmd_len = sprintf(buf, "AT+CSCA=\"%s\",%i", 864 ga->number, ga->type); 865 cmd = atcmd_fill(buf, atcmd_len + 1, 866 &null_cmd_cb, gu, gph->id); 867 break; 868 788 869 default: 789 870 return -EINVAL; 790 871 } 791 872 873 if (!cmd) 874 return -ENOMEM; 875 792 876 gsmd_log(GSMD_DEBUG, "%s\n", cmd ? cmd->buf : 0); 793 if (cmd) 794 return atcmd_submit(gu->gsmd, cmd); 795 else 796 return 0; 877 return atcmd_submit(gu->gsmd, cmd); 797 878 } 798 879 -
trunk/src/target/gsm/src/libgsmd/lgsm_internals.h
r2713 r2720 12 12 13 13 int lgsm_send(struct lgsm_handle *lh, struct gsmd_msg_hdr *gmh); 14 int lgsm_send_simple(struct lgsm_handle *lh, int type, int sub_type); 14 15 struct gsmd_msg_hdr *lgsm_gmh_fill(int type, int subtype, int payload_len); 15 16 #define lgsm_gmh_free(x) free(x) -
trunk/src/target/gsm/src/libgsmd/libgsmd.c
r1314 r2720 208 208 } 209 209 210 int lgsm_send_simple(struct lgsm_handle *lh, int type, int sub_type) 211 { 212 struct gsmd_msg_hdr *gmh; 213 int rc; 214 215 gmh = lgsm_gmh_fill(type, sub_type, 0); 216 if (!gmh) 217 return -ENOMEM; 218 rc = lgsm_send(lh, gmh); 219 if (rc < gmh->len + sizeof(*gmh)) { 220 lgsm_gmh_free(gmh); 221 return -EIO; 222 } 223 lgsm_gmh_free(gmh); 224 225 return 0; 226 } -
trunk/src/target/gsm/src/libgsmd/libgsmd_sms.c
r2710 r2720 58 58 } 59 59 60 int lgsm d_sms_delete(struct lgsm_handle *lh,60 int lgsm_sms_delete(struct lgsm_handle *lh, 61 61 const struct lgsm_sms_delete *sms_del) 62 62 { … … 84 84 } 85 85 86 int lgsm d_number2addr(struct gsmd_addr *dst, const char *src)86 int lgsm_number2addr(struct gsmd_addr *dst, const char *src, int skipplus) 87 87 { 88 88 char *ch; … … 95 95 GSMD_TOA_TON_INTERNATIONAL | 96 96 GSMD_TOA_RESERVED; 97 strcpy(dst->number, src + 1);97 strcpy(dst->number, src + skipplus); 98 98 } else { 99 99 dst->type = … … 110 110 } 111 111 112 int lgsm d_sms_send(struct lgsm_handle *lh,112 int lgsm_sms_send(struct lgsm_handle *lh, 113 113 const struct lgsm_sms *sms) 114 114 { … … 124 124 gss = (struct gsmd_sms_submit *) gmh->data; 125 125 126 if (lgsm d_number2addr(&gss->addr, sms->addr))126 if (lgsm_number2addr(&gss->addr, sms->addr, 1)) 127 127 return -EINVAL; 128 128 … … 143 143 } 144 144 145 int lgsm d_sms_write(struct lgsm_handle *lh,145 int lgsm_sms_write(struct lgsm_handle *lh, 146 146 const struct lgsm_sms_write *sms_write) 147 147 { … … 159 159 gsw->stat = sms_write->stat; 160 160 161 if (lgsm d_number2addr(&gsw->sms.addr, sms_write->sms.addr))161 if (lgsm_number2addr(&gsw->sms.addr, sms_write->sms.addr, 1)) 162 162 return -EINVAL; 163 163 … … 176 176 lgsm_gmh_free(gmh); 177 177 178 return 0; 179 } 180 181 int lgsm_sms_get_storage(struct lgsm_handle *lh) 182 { 183 return lgsm_send_simple(lh, GSMD_MSG_SMS, GSMD_SMS_GET_MSG_STORAGE); 184 } 185 186 int lgsm_sms_set_storage(struct lgsm_handle *lh, enum ts0705_mem_type mem1, 187 enum ts0705_mem_type mem2, enum ts0705_mem_type mem3) 188 { 189 struct gsmd_msg_hdr *gmh = 190 lgsm_gmh_fill(GSMD_MSG_SMS, GSMD_SMS_SET_MSG_STORAGE, 191 3 * sizeof(enum ts0705_mem_type)); 192 if (!gmh) 193 return -ENOMEM; 194 195 ((enum ts0705_mem_type *) gmh->data)[0] = mem1; 196 ((enum ts0705_mem_type *) gmh->data)[1] = mem2; 197 ((enum ts0705_mem_type *) gmh->data)[2] = mem3; 198 199 if (lgsm_send(lh, gmh) < gmh->len + sizeof(*gmh)) { 200 lgsm_gmh_free(gmh); 201 return -EIO; 202 } 203 204 lgsm_gmh_free(gmh); 205 return 0; 206 } 207 208 int lgsm_sms_get_smsc(struct lgsm_handle *lh) 209 { 210 return lgsm_send_simple(lh, GSMD_MSG_SMS, GSMD_SMS_GET_SERVICE_CENTRE); 211 } 212 213 int lgsm_sms_set_smsc(struct lgsm_handle *lh, const char *number) 214 { 215 struct gsmd_msg_hdr *gmh = 216 lgsm_gmh_fill(GSMD_MSG_SMS, GSMD_SMS_SET_SERVICE_CENTRE, 217 sizeof(struct gsmd_addr)); 218 if (!gmh) 219 return -ENOMEM; 220 221 if (lgsm_number2addr((struct gsmd_addr *) gmh->data, number, 0)) { 222 lgsm_gmh_free(gmh); 223 return -EINVAL; 224 } 225 226 if (lgsm_send(lh, gmh) < gmh->len + sizeof(*gmh)) { 227 lgsm_gmh_free(gmh); 228 return -EIO; 229 } 230 231 lgsm_gmh_free(gmh); 178 232 return 0; 179 233 } -
trunk/src/target/gsm/src/libgsmd/libgsmd_voicecall.c
r1282 r2720 28 28 29 29 #include "lgsm_internals.h" 30 31 int lgsm_send_simple(struct lgsm_handle *lh, int type, int sub_type)32 {33 struct gsmd_msg_hdr *gmh;34 int rc;35 36 gmh = lgsm_gmh_fill(type, sub_type, 0);37 if (!gmh)38 return -ENOMEM;39 rc = lgsm_send(lh, gmh);40 if (rc < gmh->len + sizeof(*gmh)) {41 lgsm_gmh_free(gmh);42 return -EIO;43 }44 lgsm_gmh_free(gmh);45 46 return 0;47 }48 30 49 31 int lgsm_voice_out_init(struct lgsm_handle *lh, -
trunk/src/target/gsm/src/util/shell.c
r2713 r2720 82 82 int *result; 83 83 struct gsmd_sms_list *sms; 84 static const char *type[] = { "Unread", "Received", "Unsent", "Sent" }; 84 struct gsmd_addr *addr; 85 struct gsmd_sms_storage *mem; 86 static const char *msgtype[] = { 87 "Unread", "Received", "Unsent", "Sent" 88 }; 89 static const char *memtype[] = { 90 "Unknown", "Broadcast", "Me message", "MT", "SIM", "TA", "SR" 91 }; 85 92 86 93 switch (gmh->msg_subtype) { … … 89 96 sms = (struct gsmd_sms_list *) ((void *) gmh + sizeof(*gmh)); 90 97 printf("%s message %i from/to %s%s, at %i%i-%i%i-%i%i " 91 "%i%i:%i%i:%i%i, GMT%c%i\n", type[sms->stat],92 sms->index,98 "%i%i:%i%i:%i%i, GMT%c%i\n", 99 msgtype[sms->stat], sms->index, 93 100 ((sms->addr.type & __GSMD_TOA_TON_MASK) == 94 101 GSMD_TOA_TON_INTERNATIONAL) ? "+" : "", … … 167 174 } 168 175 break; 176 case GSMD_SMS_GET_MSG_STORAGE: 177 mem = (struct gsmd_sms_storage *) 178 ((void *) gmh + sizeof(*gmh)); 179 printf("mem1: %s (%i) Occupied: %i / %i\n", 180 memtype[mem->mem[0].memtype], 181 mem->mem[0].memtype, 182 mem->mem[0].used, 183 mem->mem[0].total); 184 printf("mem2: %s (%i) Occupied: %i / %i\n", 185 memtype[mem->mem[1].memtype], 186 mem->mem[1].memtype, 187 mem->mem[1].used, 188 mem->mem[1].total); 189 printf("mem3: %s (%i) Occupied: %i / %i\n", 190 memtype[mem->mem[2].memtype], 191 mem->mem[2].memtype, 192 mem->mem[2].used, 193 mem->mem[2].total); 194 break; 195 case GSMD_SMS_GET_SERVICE_CENTRE: 196 addr = (struct gsmd_addr *) ((void *) gmh + sizeof(*gmh)); 197 printf("Number of the default Service Centre is %s\n", 198 addr->number); 199 break; 169 200 default: 170 201 return -EINVAL; … … 245 276 "\tss\tSMS Send (ss=number,text)\n" 246 277 "\tsw\tSMS Write (sw=stat,number,text)\n" 278 "\tsm\tSMS Storage stats\n" 279 "\tsM\tSMS Set preferred storage (sM=mem1,mem2,mem3)\n" 280 "\tsc\tSMS Show Service Centre\n" 281 "\tsC\tSMS Set Service Centre (sC=number)\n" 247 282 "\tq\tQuit\n" 248 283 ); … … 358 393 printf("Delete Phonebook Entry\n"); 359 394 ptr = strchr(buf, '='); 360 lgsmd_pb_del_entry(lgsmh, atoi(ptr+1)); 395 lgsmd_pb_del_entry(lgsmh, atoi(ptr+1)); 361 396 } else if ( !strncmp(buf, "prr", 3)) { 362 397 printf("Read Phonebook Entries\n"); … … 372 407 printf("Read Phonebook Entry\n"); 373 408 ptr = strchr(buf, '='); 374 lgsm_pb_read_entry(lgsmh, atoi(ptr+1)); 409 lgsm_pb_read_entry(lgsmh, atoi(ptr+1)); 375 410 } else if ( !strncmp(buf, "pf", 2)) { 376 411 printf("Find Phonebook Entry\n"); … … 403 438 } else if ( !strncmp(buf, "ps", 2)) { 404 439 printf("Get Phonebook Support\n"); 405 lgsm_pb_get_support(lgsmh); 440 lgsm_pb_get_support(lgsmh); 406 441 } else if ( !strncmp(buf, "sd", 2)) { 407 442 printf("Delete SMS\n"); … … 413 448 sms_del.delflg = atoi(ptr+1); 414 449 415 lgsm d_sms_delete(lgsmh, &sms_del);450 lgsm_sms_delete(lgsmh, &sms_del); 416 451 } else if ( !strncmp(buf, "sl", 2)) { 417 452 printf("List SMS\n"); … … 434 469 packing_7bit_character(fcomma+1, &sms); 435 470 436 lgsm d_sms_send(lgsmh, &sms);471 lgsm_sms_send(lgsmh, &sms); 437 472 } else if ( !strncmp(buf, "sw", 2)) { 438 473 printf("Write SMS\n"); … … 449 484 lcomma+1, &sms_write.sms); 450 485 451 lgsmd_sms_write(lgsmh, &sms_write); 486 lgsm_sms_write(lgsmh, &sms_write); 487 } else if (!strncmp(buf, "sm", 2)) { 488 printf("Get SMS storage preferences\n"); 489 lgsm_sms_get_storage(lgsmh); 490 } else if (!strncmp(buf, "sM", 2)) { 491 int mem[3]; 492 493 printf("Set SMS storage preferences\n"); 494 if (sscanf(buf, "sM=%i,%i,%i", mem, mem + 1, 495 mem + 2) < 3) 496 printf("No.\n"); 497 else 498 lgsm_sms_set_storage(lgsmh, mem[0], 499 mem[1], mem[2]); 500 } else if (!strncmp(buf, "sc", 2)) { 501 printf("Get the default SMSC\n"); 502 lgsm_sms_get_smsc(lgsmh); 503 } else if (!strncmp(buf, "sC", 2)) { 504 printf("Set the default SMSC\n"); 505 ptr = strchr(buf, '='); 506 if (!ptr || strlen(ptr) < 6) 507 printf("No.\n"); 508 else 509 lgsm_sms_set_smsc(lgsmh, ptr + 1); 452 510 } else { 453 511 printf("Unknown command `%s'\n", buf);
Note: See TracChangeset
for help on using the changeset viewer.
