liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 1 | /** |
| 2 | * \file dtmf_test.c |
| 3 | * \brief A Documented file. |
| 4 | * |
| 5 | * Detailed description |
| 6 | * \Author: jinLuo |
| 7 | * \Version: 1.0.0 |
| 8 | * \Date: 2022-12-1 |
| 9 | */ |
| 10 | |
| 11 | /******************************************************************************\ |
| 12 | * Include files |
| 13 | \******************************************************************************/ |
| 14 | #include <pthread.h> |
| 15 | #include <time.h> |
| 16 | #include <sys/ioctl.h> |
| 17 | #include <fcntl.h> |
| 18 | #include <unistd.h> |
| 19 | #include <sys/types.h> |
| 20 | #include <sys/stat.h> |
| 21 | #include <fcntl.h> |
| 22 | #include <string.h> |
| 23 | #include <stdio.h> |
| 24 | #include <signal.h> |
| 25 | #include <unistd.h> |
| 26 | #include <fcntl.h> |
| 27 | #include <errno.h> |
| 28 | #include <string.h> |
| 29 | #include <stdlib.h> |
| 30 | #include <poll.h> |
| 31 | #include <stdlib.h> |
| 32 | |
| 33 | #include <sys/ioctl.h> |
| 34 | #include <sys/types.h> |
| 35 | #include <sys/stat.h> |
| 36 | #include "lynq/lynq_sms_api.h" |
| 37 | |
| 38 | |
| 39 | int main(int argc, char *argv[]) |
| 40 | { |
| 41 | char operator[20]; |
| 42 | int opt; |
| 43 | int ret, uToken; |
| 44 | char serNum[50] = {0}; |
| 45 | |
| 46 | while(1) |
| 47 | { |
| 48 | printf("=========audio main=========\n" |
| 49 | "\t0 exit\n" |
| 50 | "\t1 sms init\n" |
| 51 | "\t2 send sms\n" |
| 52 | "\t3 wait receive new sms\n" |
| 53 | "\t4 delete sms(int index);\n" |
| 54 | "\t5 list sms\n" |
| 55 | "\t6 query sms storage status\n" |
| 56 | "\t7 query service number\n" |
| 57 | "\t8 set service number\n" |
| 58 | "\t9 deinit sms\n" |
| 59 | "operator: >> "); |
| 60 | fgets(operator, sizeof(operator), stdin); |
| 61 | fflush(stdin); |
| 62 | opt = atoi(operator); |
| 63 | switch (opt) |
| 64 | { |
| 65 | case 0: |
| 66 | printf("main exit\n"); |
| 67 | return 0; |
| 68 | case 1: |
| 69 | lynq_init_sms(uToken); |
| 70 | break; |
| 71 | case 2: |
| 72 | printf("please input volume (0~1): \n"); |
| 73 | fgets(operator, sizeof(operator), stdin); |
| 74 | fflush(stdin); |
| 75 | opt = atoi(operator); |
| 76 | if(opt) |
| 77 | { |
| 78 | lynq_send_sms("15775590631", 1, "nihaoma,wohenhao"); //text mode |
| 79 | } |
| 80 | else{ |
| 81 | lynq_send_sms("29", 0, "0891683108200805F011000D91685177550996F70008A80E4F60597D5417FF1F62115F88597D"); //pud mode |
| 82 | } |
| 83 | break; |
| 84 | case 3: |
| 85 | lynq_wait_receive_new_sms(&uToken); |
| 86 | break; |
| 87 | case 4: |
| 88 | printf("please input volume (0~100): \n"); |
| 89 | fgets(operator, sizeof(operator), stdin); |
| 90 | fflush(stdin); |
| 91 | opt = atoi(operator); |
| 92 | lynq_delete_sms(opt); |
| 93 | break; |
| 94 | case 5: |
| 95 | printf("please input index (0~50): \n"); |
| 96 | fgets(operator, sizeof(operator), stdin); |
| 97 | fflush(stdin); |
| 98 | opt = atoi(operator); |
| 99 | lynq_list_sms(1, opt, "ALL" ); |
| 100 | //opt : 0 ; Query all stored SMS messages |
| 101 | //opt : > 0 ; Gets the content of the SMS message starting from the index number |
| 102 | break; |
| 103 | case 6: |
| 104 | lynq_query_sms_storage_status(); |
| 105 | break; |
| 106 | case 7: |
| 107 | ret = lynq_get_smsc_address(serNum); |
| 108 | if(!ret) |
| 109 | printf("get_smsc:%s\n", serNum); |
| 110 | break; |
| 111 | case 8: |
| 112 | printf("please input service num: \n"); |
| 113 | fgets(operator, sizeof(operator), stdin); |
| 114 | fflush(stdin); |
| 115 | ret= lynq_set_smsc_address(operator); |
| 116 | break; |
| 117 | case 9: |
| 118 | lynq_deinit_sms(); |
| 119 | break; |
| 120 | default: |
| 121 | break; |
| 122 | } |
| 123 | } |
| 124 | |
| 125 | return 0; |
| 126 | } |