lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 1 | #include <stdio.h>
|
| 2 | #include <sys/types.h>
|
| 3 | #include <sys/socket.h>
|
| 4 | #include <arpa/inet.h>
|
| 5 | #include <fcntl.h>
|
| 6 | #include <string.h>
|
| 7 | #include <stdlib.h>
|
| 8 | #include <unistd.h>
|
| 9 | #include <binder/Parcel.h>
|
| 10 | #include <log/log.h>
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 11 | #include <cutils/jstring.h>
|
| 12 | #include <pthread.h>
|
| 13 | #include "liblog/lynq_deflog.h"
|
lh | 228a7b8 | 2022-01-10 02:24:31 -0800 | [diff] [blame] | 14 | #include <sys/time.h>
|
lh | 59e0d00 | 2022-01-27 00:27:12 -0800 | [diff] [blame] | 15 | #include <string.h>
|
q.huang | fe1b405 | 2022-04-18 00:09:50 -0400 | [diff] [blame] | 16 | #include <vendor-ril/telephony/ril.h>
|
| 17 | #include <vendor-ril/telephony/mtk_ril_sp.h>
|
| 18 | #include <vendor-ril/telephony/mtk_ril_ivt.h>
|
| 19 | #include "lynq_call.h"
|
| 20 |
|
| 21 |
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 22 | #define LYNQ_SERVICE_PORT 8088
|
rjw | 8bdc56b | 2022-02-28 15:01:49 +0800 | [diff] [blame] | 23 | #define DSET_IP_ADDRESS "127.0.0.1"
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 24 | #define LYNQ_URC_SERVICE_PORT 8086
|
| 25 | #define LYNQ_REC_BUF 8192
|
| 26 | #define LYNQ_REQUEST_PARAM_BUF 8192
|
| 27 | #define LYQN_SEDN_BUF 1024*8+sizeof(int)*3
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 28 | #define INVALID_ID (-1)
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 29 | #define USER_LOG_TAG "LYNQ_CALL"
|
| 30 |
|
| 31 | using ::android::Parcel;
|
| 32 | typedef enum {
|
| 33 | LYNQ_CALL_ACTIVE = 0,
|
| 34 | LYNQ_CALL_HOLDING = 1,
|
| 35 | LYNQ_CALL_DIALING = 2, /* MO call only */
|
| 36 | LYNQ_CALL_ALERTING = 3, /* MO call only */
|
| 37 | LYNQ_CALL_INCOMING = 4, /* MT call only */
|
lh | 8657e74 | 2022-04-26 00:45:44 -0700 | [diff] [blame] | 38 | LYNQ_CALL_WAITING = 5, /* MT call only */
|
| 39 | /*warren add for T800 platform 2022/04/26 start*/
|
| 40 | LYNQ_CALL_END = 6, /*CALL END*/
|
| 41 | /*warren add for T800 platform 2022/04/26 end*/
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 42 | }lynq_call_state_t;
|
| 43 |
|
| 44 | typedef struct{
|
| 45 | int uToken;
|
| 46 | int request;
|
| 47 | int paramLen;
|
| 48 | char param[LYNQ_REQUEST_PARAM_BUF];
|
| 49 | }lynq_client_t;
|
| 50 | typedef struct
|
| 51 | {
|
| 52 | int used;
|
| 53 | int call_id;
|
| 54 | int call_state;
|
| 55 | int toa;
|
| 56 | int direction;/*0: MO call,1:MT call*/
|
| 57 | char addr[LYNQ_PHONE_NUMBER_MAX];
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 58 | }lynq_call_list_e_t;
|
| 59 | typedef struct
|
| 60 | {
|
| 61 | int call_id;
|
| 62 | int call_state;
|
| 63 | int toa;
|
| 64 | int direction;/*0: MO call,1:MT call*/
|
| 65 | char addr[LYNQ_PHONE_NUMBER_MAX];
|
| 66 | }lynq_call_list_t;
|
| 67 |
|
| 68 | lynq_call_list_e_t lynq_call_lists[LYNQ_CALL_MAX]={};
|
| 69 | static pthread_mutex_t call_state_change_mutex = PTHREAD_MUTEX_INITIALIZER;
|
| 70 | static pthread_cond_t call_state_change_cond = PTHREAD_COND_INITIALIZER;
|
ll | 375c94d | 2022-01-27 05:54:38 +0000 | [diff] [blame] | 71 | static pthread_mutex_t s_urc_call_state_change_mutex = PTHREAD_MUTEX_INITIALIZER;
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 72 | static pthread_cond_t s_urc_call_state_change_cond = PTHREAD_COND_INITIALIZER;
|
| 73 | static pthread_mutex_t s_incoming_call_mutex = PTHREAD_MUTEX_INITIALIZER;
|
| 74 | static pthread_cond_t s_incoming_call_cond = PTHREAD_COND_INITIALIZER;
|
ll | 1343a5b | 2022-03-17 05:31:33 +0000 | [diff] [blame] | 75 | pthread_t lynq_call_urc_tid = -1;
|
| 76 | pthread_t lynq_call_list_loop_tid = -1;
|
lh | cdf816a | 2022-02-13 23:56:05 -0800 | [diff] [blame] | 77 |
|
rjw | 8bdc56b | 2022-02-28 15:01:49 +0800 | [diff] [blame] | 78 | /*lei add*/
|
| 79 | /* socket文件描述符 */
|
| 80 | int len_addr_serv;
|
| 81 | struct sockaddr_in addr_serv;
|
| 82 | lynq_client_t client_t;
|
| 83 | int client_size = 0;
|
| 84 | /*lei add*/
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 85 |
|
lh | a35d4ee | 2022-01-25 18:47:39 -0800 | [diff] [blame] | 86 | int s_call_urc_event_complete = 1;
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 87 |
|
| 88 | enum{
|
| 89 | CALL_OFF=0,
|
| 90 | CALL_ON=1
|
| 91 | }call_state;
|
ll | 375c94d | 2022-01-27 05:54:38 +0000 | [diff] [blame] | 92 | typedef enum{
|
| 93 | LYNQ_E_CARDSTATE_ERROR=8000,
|
| 94 | /* The voice service state is out of service*/
|
| 95 | LYNQ_E_STATE_OUT_OF_SERVICE=8001,
|
| 96 | /* The voice service state is EMERGENCY_ONLY*/
|
| 97 | LYNQ_E_STATE_EMERGENCY_ONLY=8002,
|
| 98 | /* The radio power is power off*/
|
| 99 | LYNQ_E_STATE_POWER_OFF=8003,
|
| 100 | LYNQ_E_TIME_OUT=8004,
|
| 101 | /*create or open sms DB fail */
|
| 102 | LYNQ_E_SMS_DB_FAIL=8005,
|
| 103 | /*Failed to execute sql statement*/
|
| 104 | LYNQ_E_SMS_SQL_FAIL = 8006,
|
| 105 | LYNQ_E_SMS_NOT_FIND = 8007,
|
| 106 | /* The logic conflict*/
|
| 107 | LYNQ_E_CONFLICT=9000,
|
| 108 | /*Null anomaly*/
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 109 | LYNQ_E_NULL_ANONALY=9001,
|
| 110 | /*Invalid id anomaly*/
|
| 111 | LYNQ_E_INVALID_ID_ANONALY=9002,
|
| 112 | #ifdef ECALL_SUPPORT
|
| 113 | LYNQ_E_ECALL_BEING_RUNNING =9003,
|
| 114 | LYNQ_E_ECALL_MSD_LENGTH_ERROR =9004,
|
| 115 | #endif
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 116 | }LYNQ_E;
|
q.huang | b0eb7b0 | 2022-03-29 04:17:32 -0400 | [diff] [blame] | 117 | typedef enum{
|
| 118 | LYNQ_E_VOLUMN_SET_DTMF,
|
| 119 | LYNQ_E_VOLUMN_SET_SPEECH
|
| 120 | }LYNQ_E_VOLUMN_SET;
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 121 |
|
| 122 | int lynq_call_state =CALL_OFF;
|
lh | a35d4ee | 2022-01-25 18:47:39 -0800 | [diff] [blame] | 123 | int lynq_call_client_sockfd = 0;
|
| 124 | int Global_uToken_call = 0;
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 125 | int global_call_count =0;
|
| 126 | int global_call_auto_answer = 0;
|
lh | a35d4ee | 2022-01-25 18:47:39 -0800 | [diff] [blame] | 127 | bool urc_call_recive_status = 1;
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 128 | bool call_list_loop = 1;
|
| 129 | int isDial = 0;
|
| 130 | int lynqIncomingCallId = 0;
|
q.huang | 18d08bf | 2022-04-19 20:27:44 -0400 | [diff] [blame] | 131 |
|
| 132 | #ifdef ECALL_SUPPORT
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 133 | int lynq_set_common_request(int request_id, int argc, const char* format,...);
|
| 134 | int is_ecall_dial = 0;
|
| 135 | int g_ecallId = INVALID_ID;
|
q.huang | 18d08bf | 2022-04-19 20:27:44 -0400 | [diff] [blame] | 136 | typedef enum{
|
| 137 | LYNQ_ECALL_TYPE_TEST = 0, /* Test eCall */
|
| 138 | LYNQ_ECALL_TYPE_RECONFIG = 1, /* Reconfiguration eCall */
|
q.huang | fe1b405 | 2022-04-18 00:09:50 -0400 | [diff] [blame] | 139 | LYNQ_ECALL_MANUAL_EMERGENCY = 2, /*Manual Emergency eCall */
|
| 140 | LYNQ_ECALL_TYPE_AUTO_EMERGENCY = 3, /* Automatic Emergency eCall */\
|
| 141 | }LYNQ_ECall_Type;
|
| 142 |
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 143 | char e_call_addr[LYNQ_ECALL_VAR_MAX][LYNQ_PHONE_NUMBER_MAX]={"test_ecall","emergency_ecall","reconf_ecall"};
|
q.huang | 18d08bf | 2022-04-19 20:27:44 -0400 | [diff] [blame] | 144 |
|
| 145 | static pthread_mutex_t s_incoming_e_call_mutex = PTHREAD_MUTEX_INITIALIZER;
|
| 146 | static pthread_cond_t s_incoming_e_call_cond = PTHREAD_COND_INITIALIZER;
|
| 147 |
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 148 | LYNQ_ECall_Indication g_lynqIncomingEcallIndication;
|
q.huang | 18d08bf | 2022-04-19 20:27:44 -0400 | [diff] [blame] | 149 |
|
| 150 | void sendSignalIncomingECallEvent()
|
| 151 | {
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 152 | LYINFLOG("send incoming ecall event signal");;
|
q.huang | 18d08bf | 2022-04-19 20:27:44 -0400 | [diff] [blame] | 153 | pthread_mutex_lock(&s_incoming_e_call_mutex);
|
| 154 | pthread_cond_signal(&s_incoming_e_call_cond);
|
| 155 | pthread_mutex_unlock(&s_incoming_e_call_mutex);
|
| 156 | }
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 157 |
|
| 158 | int lynq_is_msd_suc(LYNQ_ECall_Indication lynqIncomingEcallIndication)
|
| 159 | {
|
| 160 | if(LYNQ_ECALL_LLACK_RECEIVED == lynqIncomingEcallIndication ||
|
| 161 | LYNQ_ECALL_ALACK_POSITIVE_RECEIVED == lynqIncomingEcallIndication ||
|
| 162 | LYNQ_ECALL_ALACK_CLEARDOWN_RECEIVED == lynqIncomingEcallIndication ||
|
| 163 | LYNQ_ECALL_T5_TIMER_OUT == lynqIncomingEcallIndication ||
|
| 164 | LYNQ_ECALL_T6_TIMER_OUT == lynqIncomingEcallIndication ||
|
| 165 | LYNQ_ECALL_T7_TIMER_OUT == lynqIncomingEcallIndication)
|
| 166 | {
|
| 167 | return 1;
|
| 168 | }
|
| 169 |
|
| 170 | return 0;
|
| 171 | }
|
| 172 |
|
| 173 | int lynq_ecall_is_running()
|
| 174 | {
|
| 175 | return (is_ecall_dial!=0) || (g_ecallId !=INVALID_ID);
|
| 176 | }
|
| 177 |
|
q.huang | 18d08bf | 2022-04-19 20:27:44 -0400 | [diff] [blame] | 178 | #endif
|
q.huang | fe1b405 | 2022-04-18 00:09:50 -0400 | [diff] [blame] | 179 |
|
ll | 1343a5b | 2022-03-17 05:31:33 +0000 | [diff] [blame] | 180 | /**
|
| 181 | * @brief mark call initialization state
|
| 182 | * 0: deinit state
|
| 183 | * 1: init state
|
| 184 | */
|
| 185 | int g_lynq_call_init_flag = 0;
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 186 |
|
| 187 | int JumpHeader(Parcel &p,int *resp_type,int *request,int *slot_id,int *error)
|
| 188 | {
|
| 189 | if(p.dataAvail() > 0)
|
| 190 | {
|
| 191 | p.readInt32(resp_type);
|
| 192 | p.readInt32(request);
|
| 193 | p.readInt32(slot_id);
|
| 194 | p.readInt32(error);
|
| 195 | return 0;
|
| 196 | }
|
| 197 | else
|
| 198 | {
|
| 199 | return -1;
|
| 200 | }
|
| 201 | }
|
| 202 | int send_request(int sockfd,lynq_client_t *client_tmp)
|
| 203 | {
|
| 204 | int ret=0;
|
rjw | 8bdc56b | 2022-02-28 15:01:49 +0800 | [diff] [blame] | 205 | ret = sendto(sockfd, client_tmp, client_size, 0, (struct sockaddr *)&addr_serv, len_addr_serv);
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 206 | if(ret==-1)
|
| 207 | {
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 208 | LYERRLOG("sendto error");
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 209 | return -1;
|
| 210 | }
|
| 211 | return 0;
|
| 212 | }
|
| 213 |
|
| 214 | int get_response(int sockfd,Parcel &p)
|
| 215 | {
|
| 216 | int len = 0;
|
| 217 | char recvline[LYNQ_REC_BUF];
|
| 218 | bzero(recvline,LYNQ_REC_BUF);
|
| 219 | /* receive data from server */
|
rjw | 8bdc56b | 2022-02-28 15:01:49 +0800 | [diff] [blame] | 220 | len = recvfrom(sockfd,recvline,LYNQ_REC_BUF, 0, (struct sockaddr *)&addr_serv,(socklen_t*)&len_addr_serv);
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 221 | if(len == -1)
|
| 222 | {
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 223 | LYERRLOG("recvfrom error");
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 224 | return -1;
|
| 225 | }
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 226 | if (recvline != NULL) {
|
| 227 | p.setData((uint8_t *)recvline,len); // p.setData((uint8_t *) buffer, buflen);
|
| 228 | p.setDataPosition(0);
|
| 229 | }
|
| 230 | return 0;
|
| 231 | }
|
| 232 | static char *strdupReadString(Parcel &p) {
|
ll | 375c94d | 2022-01-27 05:54:38 +0000 | [diff] [blame] | 233 | size_t stringlen;
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 234 | const char16_t *s16;
|
| 235 | s16 = p.readString16Inplace(&stringlen);
|
ll | 375c94d | 2022-01-27 05:54:38 +0000 | [diff] [blame] | 236 | return strndup16to8(s16, stringlen);
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 237 | }
|
| 238 |
|
| 239 | int lynq_get_current_call_list(lynq_call_list_t call_list[LYNQ_CALL_MAX])
|
| 240 | {
|
| 241 | Parcel p;
|
| 242 | lynq_client_t client;
|
| 243 | int resp_type = -1;
|
| 244 | int request = -1;
|
| 245 | int slot_id = -1;
|
| 246 | int error = -1;
|
| 247 | int call_num = 0;
|
| 248 | int temp = 0;
|
| 249 | char *remote_phoneNum = NULL;
|
| 250 | char *remote_name= NULL;
|
| 251 | char *uusData = NULL;
|
lh | a35d4ee | 2022-01-25 18:47:39 -0800 | [diff] [blame] | 252 | client.uToken = Global_uToken_call;
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 253 | client.request = 9;//RIL_REQUEST_GET_CURRENT_CALLS
|
| 254 | client.paramLen = 0;
|
| 255 | bzero(client.param,LYNQ_REQUEST_PARAM_BUF);
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 256 | LYINFLOG("uToken=%d,request=%d,paralen=%d,param=%s",client.uToken,client.request,client.paramLen,client.param);
|
lh | a35d4ee | 2022-01-25 18:47:39 -0800 | [diff] [blame] | 257 | if(send_request(lynq_call_client_sockfd,&client)==-1)
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 258 | {
|
| 259 | LYERRLOG("send request fail");
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 260 | return -1;
|
| 261 | }
|
lh | a35d4ee | 2022-01-25 18:47:39 -0800 | [diff] [blame] | 262 | get_response(lynq_call_client_sockfd,p);
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 263 | JumpHeader(p,&resp_type,&request,&slot_id,&error);
|
| 264 | LYINFLOG("resp_type=%d,request=%d,slot_id=%d,error_code=%d",resp_type,request,slot_id,error);
|
| 265 | if(error == 0)
|
| 266 | {
|
| 267 | p.readInt32(&call_num);
|
| 268 | global_call_count = call_num;
|
| 269 | if(call_num<=0)
|
| 270 | {
|
| 271 | lynq_call_state = CALL_OFF;
|
lh | cdf816a | 2022-02-13 23:56:05 -0800 | [diff] [blame] | 272 | LYINFLOG("lynq_call_state:%d",lynq_call_state);
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 273 | return 0;
|
| 274 | }
|
lh | cdf816a | 2022-02-13 23:56:05 -0800 | [diff] [blame] | 275 | lynq_call_state = CALL_ON;
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 276 | LYINFLOG("lynq_call_state:%d, call num is %d ",lynq_call_state,call_num);
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 277 | for(int i = 0;i < call_num;i++)
|
| 278 | {
|
| 279 | p.readInt32(&temp);
|
| 280 | call_list[i].call_state = temp;
|
| 281 | p.readInt32(&call_list[i].call_id);
|
| 282 | p.readInt32(&call_list[i].toa);
|
| 283 | p.readInt32(&temp);
|
| 284 | p.readInt32(&temp);
|
| 285 | call_list[i].direction = temp;
|
| 286 | p.readInt32(&temp);
|
| 287 | p.readInt32(&temp);
|
| 288 | p.readInt32(&temp);
|
| 289 | remote_phoneNum = strdupReadString(p);
|
| 290 | memcpy(call_list[i].addr,remote_phoneNum,strlen(remote_phoneNum));
|
| 291 | LYINFLOG("call_id=%d,call_state=%d,direction=%d,addr=%s,toa=%d",call_list[i].call_id,call_list[i].call_state,
|
| 292 | call_list[i].direction,call_list[i].addr,call_list[i].toa);
|
| 293 | p.readInt32(&temp);
|
| 294 | remote_name = strdupReadString(p);
|
| 295 | p.readInt32(&temp);
|
| 296 | p.readInt32(&temp);
|
| 297 | if(temp==0)
|
| 298 | {
|
| 299 | continue;
|
| 300 | }
|
| 301 | p.readInt32(&temp); /* UUS Information is present */
|
| 302 | p.readInt32(&temp);
|
| 303 | p.readInt32(&temp);
|
| 304 | p.read(uusData,temp);
|
| 305 | }
|
| 306 | }
|
| 307 | return 0;
|
| 308 | }
|
| 309 |
|
| 310 | void cleanCallList(int lynq_call_id)
|
| 311 | {
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 312 | LYINFLOG("cleanCall local idx is %d, id is %d",lynq_call_id,lynq_call_lists[lynq_call_id].call_id);
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 313 | lynq_call_lists[lynq_call_id].call_id = 0;
|
lh | 8657e74 | 2022-04-26 00:45:44 -0700 | [diff] [blame] | 314 | lynq_call_lists[lynq_call_id].call_state = (int)LYNQ_CALL_END;
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 315 | lynq_call_lists[lynq_call_id].toa = 0;
|
| 316 | lynq_call_lists[lynq_call_id].direction = 0;
|
| 317 | lynq_call_lists[lynq_call_id].used = 0;
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 318 | memset(lynq_call_lists[lynq_call_id].addr,0,sizeof(lynq_call_lists[lynq_call_id].addr));
|
| 319 | }
|
| 320 | int getUnusedElement()
|
| 321 | {
|
| 322 | for(int i=0;i < LYNQ_CALL_MAX; i++)
|
| 323 | {
|
| 324 | if(lynq_call_lists[i].used!=1)
|
| 325 | {
|
| 326 | return i;
|
| 327 | }
|
| 328 | }
|
| 329 | return -1;
|
| 330 | }
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 331 | int addAddr(char addr[])
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 332 | {
|
| 333 | int ret = 0;
|
| 334 | ret = getUnusedElement();
|
| 335 | memcpy(lynq_call_lists[ret].addr,addr,strlen(addr)+1);
|
| 336 | lynq_call_lists[ret].used = 1;
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 337 | LYINFLOG("add local idx is %d addr is %s",ret,addr);
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 338 | return ret;
|
| 339 | }
|
| 340 | void updateCallList(lynq_call_list_e_t *callList, int call_id,int call_state,int toa,int direction)
|
| 341 | {
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 342 | LYINFLOG("Update original local id is %d, new local id is %d",callList->call_id,call_id);
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 343 | callList->call_id = call_id;
|
| 344 | callList->call_state = call_state;
|
| 345 | callList->toa = toa;
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 346 | callList->direction = direction;
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 347 | return;
|
| 348 | }
|
| 349 | int waitCallstateChange(int mtime)
|
| 350 | {
|
lh | be92dd1 | 2022-04-19 06:01:25 -0700 | [diff] [blame] | 351 | LYINFLOG("wait Call state Change");
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 352 | int ret = 0;
|
| 353 | int sec = 0;
|
| 354 | int usec = 0;
|
lh | 228a7b8 | 2022-01-10 02:24:31 -0800 | [diff] [blame] | 355 | struct timeval now;
|
| 356 | struct timespec timeout;
|
| 357 | gettimeofday(&now,NULL);
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 358 | sec = mtime/1000;
|
| 359 | usec = mtime%1000;
|
lh | 228a7b8 | 2022-01-10 02:24:31 -0800 | [diff] [blame] | 360 | timeout.tv_sec = now.tv_sec+sec;
|
| 361 | timeout.tv_nsec = now.tv_usec*1000+usec*1000000;
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 362 | pthread_mutex_lock(&call_state_change_mutex);
|
lh | 228a7b8 | 2022-01-10 02:24:31 -0800 | [diff] [blame] | 363 | ret = pthread_cond_timedwait(&call_state_change_cond,&call_state_change_mutex,&timeout);
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 364 | pthread_mutex_unlock(&call_state_change_mutex);
|
| 365 | return ret;
|
| 366 | }
|
| 367 | int waitIncomingCall()
|
| 368 | {
|
lh | be92dd1 | 2022-04-19 06:01:25 -0700 | [diff] [blame] | 369 | LYINFLOG("wait incming call");
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 370 | int ret = 0;
|
| 371 | pthread_mutex_lock(&s_incoming_call_mutex);
|
| 372 | ret = pthread_cond_wait(&s_incoming_call_cond,&s_incoming_call_mutex);
|
| 373 | pthread_mutex_unlock(&s_incoming_call_mutex);
|
| 374 | return ret;
|
| 375 | }
|
| 376 | int checkHasCall(char addr[])
|
| 377 | {
|
| 378 | for(int i = 0;i<LYNQ_CALL_MAX;i++)
|
| 379 | {
|
| 380 | if(strcmp(lynq_call_lists[i].addr,addr)==0)
|
| 381 | {
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 382 | LYINFLOG("checkHasCall addr is %s idx is %d id is %d",addr,i,lynq_call_lists[i].call_id);
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 383 | return 1;
|
| 384 | }
|
| 385 | }
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 386 | LYINFLOG("checkHasCall addr is %s , no idx is found",addr);
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 387 | return 0;
|
| 388 | }
|
lh | be92dd1 | 2022-04-19 06:01:25 -0700 | [diff] [blame] | 389 | int find_call_id_with_addr(char *addr)
|
| 390 | {
|
lh | be92dd1 | 2022-04-19 06:01:25 -0700 | [diff] [blame] | 391 | for(int id = 0; id < LYNQ_CALL_MAX; id++)
|
| 392 | {
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 393 | if(lynq_call_lists[id].used && (strcmp(lynq_call_lists[id].addr,addr) == 0))
|
lh | be92dd1 | 2022-04-19 06:01:25 -0700 | [diff] [blame] | 394 | {
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 395 | LYINFLOG("find addr %s in local list, local idx is %d id is %d",addr,id,lynq_call_lists[id].call_id);
|
lh | be92dd1 | 2022-04-19 06:01:25 -0700 | [diff] [blame] | 396 | return id;
|
| 397 | }
|
| 398 | }
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 399 | LYINFLOG("find addr %s in local list , not found",addr);
|
lh | be92dd1 | 2022-04-19 06:01:25 -0700 | [diff] [blame] | 400 | return -1;
|
| 401 | }
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 402 | int find_call_id_with_call_id(int call_id)
|
| 403 | {
|
| 404 | for(int id = 0; id < LYNQ_CALL_MAX; id++)
|
| 405 | {
|
| 406 | if(lynq_call_lists[id].used && (lynq_call_lists[id].call_id == call_id))
|
| 407 | {
|
| 408 | LYINFLOG("find id %d in local list, local idx is %d, addr is %s",call_id,id,lynq_call_lists[id].addr);
|
| 409 | return id;
|
| 410 | }
|
| 411 | }
|
| 412 | LYINFLOG("find id %d in local list , not found",call_id);
|
| 413 | return INVALID_ID;
|
| 414 | }
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 415 | void sendSignalToWaitCallStateChange()
|
| 416 | {
|
lh | be92dd1 | 2022-04-19 06:01:25 -0700 | [diff] [blame] | 417 | LYINFLOG("send Signal To Wait Call State Change");
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 418 | pthread_mutex_lock(&call_state_change_mutex);
|
| 419 | pthread_cond_signal(&call_state_change_cond);
|
| 420 | pthread_mutex_unlock(&call_state_change_mutex);
|
| 421 | }
|
| 422 | void sendSignalIncomingCall()
|
| 423 | {
|
lh | be92dd1 | 2022-04-19 06:01:25 -0700 | [diff] [blame] | 424 | LYINFLOG("send incoming call signal");
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 425 | pthread_mutex_lock(&s_incoming_call_mutex);
|
| 426 | pthread_cond_signal(&s_incoming_call_cond);
|
| 427 | pthread_mutex_unlock(&s_incoming_call_mutex);
|
| 428 | }
|
| 429 |
|
| 430 | void addCallListToLynqCallList(lynq_call_list_e_t *callList, int call_id,int call_state,int toa,int direction,char addr[LYNQ_PHONE_NUMBER_MAX])
|
| 431 | {
|
| 432 | callList->call_id = call_id;
|
| 433 | callList->call_state = call_state;
|
| 434 | callList->toa = toa;
|
| 435 | callList->direction = direction;
|
| 436 | memcpy(callList->addr,addr,strlen(addr)+1);
|
| 437 | callList->used = 1;
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 438 | return;
|
| 439 | }
|
| 440 |
|
| 441 | void *triggerGetCallList(void *parg)
|
ll | 375c94d | 2022-01-27 05:54:38 +0000 | [diff] [blame] | 442 | {
|
| 443 | int ret=0;
|
lh | be92dd1 | 2022-04-19 06:01:25 -0700 | [diff] [blame] | 444 | bool call_end;
|
ll | 375c94d | 2022-01-27 05:54:38 +0000 | [diff] [blame] | 445 | lynq_call_list_t call_list[LYNQ_CALL_MAX];
|
q.huang | 18d08bf | 2022-04-19 20:27:44 -0400 | [diff] [blame] | 446 | int update=0;
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 447 | int cnt;
|
| 448 | int i,n;
|
| 449 |
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 450 | while(call_list_loop)
|
ll | 375c94d | 2022-01-27 05:54:38 +0000 | [diff] [blame] | 451 | {
|
q.huang | 18d08bf | 2022-04-19 20:27:44 -0400 | [diff] [blame] | 452 | update=0;
|
ll | 375c94d | 2022-01-27 05:54:38 +0000 | [diff] [blame] | 453 | pthread_mutex_lock(&s_urc_call_state_change_mutex);
|
| 454 | pthread_cond_wait(&s_urc_call_state_change_cond, &s_urc_call_state_change_mutex);
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 455 | LYDBGLOG("triggerGetCallList event!!!");
|
ll | 375c94d | 2022-01-27 05:54:38 +0000 | [diff] [blame] | 456 | memset(call_list,0,sizeof(call_list));
|
| 457 | ret = lynq_get_current_call_list(call_list);
|
| 458 | if(ret != 0)
|
| 459 | {
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 460 | LYDBGLOG("get current call list failure!!!");
|
ll | 2210140 | 2022-04-11 05:49:51 +0000 | [diff] [blame] | 461 | continue;
|
ll | 375c94d | 2022-01-27 05:54:38 +0000 | [diff] [blame] | 462 | }
|
lh | be92dd1 | 2022-04-19 06:01:25 -0700 | [diff] [blame] | 463 | LYINFLOG("++++++++++++++triggerGetCallList++++++++++++++");
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 464 | LYINFLOG("clear local index begin");
|
| 465 | cnt=0;
|
| 466 | for(i = 0;i < LYNQ_CALL_MAX;i++)
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 467 | {
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 468 | if(lynq_call_lists[i].used ==0)
|
| 469 | {
|
| 470 | continue;
|
| 471 | }
|
| 472 | cnt++;
|
| 473 | LYINFLOG("local idx is %d id is %d addr is %s state is %d direction is %d",i,lynq_call_lists[i].call_id,lynq_call_lists[i].addr,lynq_call_lists[i].call_state,lynq_call_lists[i].direction);
|
| 474 |
|
| 475 | if(lynq_call_lists[i].call_id > 0)
|
lh | be92dd1 | 2022-04-19 06:01:25 -0700 | [diff] [blame] | 476 | {
|
| 477 | call_end = 0;
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 478 | for(n = 0; n < LYNQ_CALL_MAX; n++)
|
lh | be92dd1 | 2022-04-19 06:01:25 -0700 | [diff] [blame] | 479 | {
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 480 | if(call_list[n].call_id == lynq_call_lists[i].call_id)
|
lh | be92dd1 | 2022-04-19 06:01:25 -0700 | [diff] [blame] | 481 | {
|
| 482 | call_end = 1;
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 483 | LYINFLOG("find lynq call local idx %d, service idx %d id is %d!!!",i,n,lynq_call_lists[i].call_id);
|
| 484 | break;
|
lh | be92dd1 | 2022-04-19 06:01:25 -0700 | [diff] [blame] | 485 | }
|
| 486 | }
|
| 487 | if(call_end == 0)
|
| 488 | {
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 489 | LYINFLOG("MT hungup,then clean call info local idx is %d id is %d",i, lynq_call_lists[i].call_id);
|
| 490 | cleanCallList(i);
|
lh | be92dd1 | 2022-04-19 06:01:25 -0700 | [diff] [blame] | 491 | }
|
| 492 | } //fix bug API-54
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 493 | else
|
| 494 | {
|
| 495 | LYINFLOG("local id is 0");
|
| 496 | }
|
| 497 | }
|
| 498 | LYINFLOG("clear local index end, local used cnt is %d", cnt);
|
| 499 |
|
| 500 | LYINFLOG("add or update local index begin ");
|
| 501 | for (i = 0;i < LYNQ_CALL_MAX;i++)
|
| 502 | {
|
| 503 | if(call_list[i].call_id==0)
|
| 504 | {
|
| 505 | break;
|
| 506 | }
|
| 507 |
|
| 508 | LYINFLOG("servie idx %d begin: call_id=%d, call_state=%d, direction=%d, addr=%s, toa=%d",i,call_list[i].call_id, call_list[i].call_state,
|
| 509 | call_list[i].direction,call_list[i].addr,call_list[i].toa);
|
| 510 |
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 511 | if(call_list[i].direction == 1)//MT call
|
| 512 | {
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 513 | LYINFLOG("This is a MT CALL");
|
lh | 4256e1b | 2022-05-13 03:02:19 -0700 | [diff] [blame] | 514 | /*MT CALL state code
|
| 515 | **LYNQ_CALL_INCOMING = 4,
|
| 516 | **LYNQ_CALL_WAITING = 5,
|
| 517 | */
|
| 518 | if((call_list[i].call_state ==4) || (call_list[i].call_state ==5))
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 519 | {
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 520 | #ifdef ECALL_SUPPORT
|
| 521 | if(lynq_ecall_is_running())
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 522 | {
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 523 | lynq_call_hungup(&(call_list[i].call_id));
|
| 524 | continue;
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 525 | }
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 526 | #endif
|
| 527 | }
|
| 528 | /*you call me, and i call you,One party failed to dial*/
|
| 529 | n = find_call_id_with_addr(call_list[i].addr);
|
| 530 | if(n ==INVALID_ID)
|
| 531 | {
|
| 532 | n = addAddr(call_list[i].addr);
|
| 533 | updateCallList(&lynq_call_lists[n],call_list[i].call_id,call_list[i].call_state,call_list[i].toa,call_list[i].direction);
|
| 534 | lynqIncomingCallId = call_list[i].call_id;
|
| 535 | sendSignalIncomingCall();
|
| 536 | }
|
| 537 | else if(lynq_call_lists[n].call_state == call_list[i].call_state)
|
| 538 | {
|
| 539 | LYINFLOG("state not changed, state is %d ",call_list[i].call_state);
|
| 540 | if(call_list[i].call_state ==4 || call_list[i].call_state ==5)
|
lh | be92dd1 | 2022-04-19 06:01:25 -0700 | [diff] [blame] | 541 | {
|
lh | be92dd1 | 2022-04-19 06:01:25 -0700 | [diff] [blame] | 542 | /*if call state not change,Maybe this call was ignored, so we need to continue to inform the user of
|
| 543 | **an incoming call until the status changes.
|
| 544 | **fix bug API-54
|
| 545 | */
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 546 | LYINFLOG("resend incoming call signal");
|
| 547 | sendSignalIncomingCall();
|
lh | be92dd1 | 2022-04-19 06:01:25 -0700 | [diff] [blame] | 548 | }
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 549 | }
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 550 | else
|
ll | 45d3ea9 | 2022-03-24 10:22:25 +0800 | [diff] [blame] | 551 | {
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 552 | LYINFLOG("state changed from %d to %d",lynq_call_lists[n].call_state,call_list[i].call_state);
|
| 553 |
|
| 554 | updateCallList(&lynq_call_lists[n],call_list[i].call_id,call_list[i].call_state,call_list[i].toa,call_list[i].direction);
|
| 555 | }
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 556 | }
|
| 557 | else
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 558 | {
|
| 559 | LYINFLOG("This is a MO CALL");
|
| 560 | call_end = 0;
|
| 561 | for(n = 0 ; n < LYNQ_CALL_MAX; n++)
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 562 | {
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 563 | if(lynq_call_lists[n].used && ((strcmp(call_list[i].addr,lynq_call_lists[n].addr)==0)||(call_list[i].call_id==lynq_call_lists[n].call_id)))
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 564 | {
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 565 | if(lynq_call_lists[n].call_id==0)
|
| 566 | {
|
| 567 | LYINFLOG("add a call id");
|
| 568 | update=1;
|
| 569 | }
|
| 570 | LYINFLOG("local idx %d updated, original call id is %d origial addr is %s original state is %d",n,lynq_call_lists[n].call_id,lynq_call_lists[n].addr,lynq_call_lists[n].call_state);
|
| 571 | updateCallList(&lynq_call_lists[n],call_list[i].call_id,call_list[i].call_state,call_list[i].toa,call_list[i].direction);
|
| 572 | call_end = 1;
|
| 573 | break;
|
| 574 | }
|
| 575 | }
|
| 576 |
|
| 577 | if(call_end == 0)
|
| 578 | {
|
| 579 | LYINFLOG("need to hangup id %d", call_list[i].call_id);
|
| 580 | #ifdef ECALL_SUPPORT
|
| 581 | if(is_ecall_dial==1)
|
| 582 | {
|
| 583 | LYINFLOG("ecall is dialing, for the timebeing, don't huangup");
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 584 | continue;
|
| 585 | }
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 586 | #endif
|
| 587 | LYINFLOG("hang up service call id %d",call_list[i].call_id);
|
| 588 | lynq_call_hungup(&(call_list[i].call_id));
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 589 | }
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 590 | }
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 591 | LYDBGLOG("servie idx %d end",i);
|
ll | 375c94d | 2022-01-27 05:54:38 +0000 | [diff] [blame] | 592 | }
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 593 | LYINFLOG("add or update local index end ");
|
lh | a35d4ee | 2022-01-25 18:47:39 -0800 | [diff] [blame] | 594 | s_call_urc_event_complete = 1;
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 595 | if(isDial==1)
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 596 | {
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 597 | LYINFLOG("now is dialing");
|
| 598 | if(update==1)
|
| 599 | {
|
| 600 | LYINFLOG("find added call");
|
| 601 | sendSignalToWaitCallStateChange();
|
| 602 | isDial = 0;
|
| 603 | }
|
| 604 | else
|
| 605 | {
|
| 606 | LYINFLOG("not find added call");
|
| 607 | }
|
| 608 | }
|
| 609 | else
|
| 610 | {
|
| 611 | LYINFLOG("now is not dialing");
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 612 | }
|
ll | 375c94d | 2022-01-27 05:54:38 +0000 | [diff] [blame] | 613 | pthread_mutex_unlock(&s_urc_call_state_change_mutex);
|
| 614 | }
|
| 615 | return NULL;
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 616 | }
|
| 617 |
|
| 618 | void lynqRespWatingEvent()
|
ll | 375c94d | 2022-01-27 05:54:38 +0000 | [diff] [blame] | 619 | {
|
| 620 | if(s_call_urc_event_complete==1)
|
| 621 | {
|
| 622 | pthread_mutex_lock(&s_urc_call_state_change_mutex);
|
| 623 | pthread_cond_signal(&s_urc_call_state_change_cond);
|
| 624 | s_call_urc_event_complete = 0;
|
| 625 | pthread_mutex_unlock(&s_urc_call_state_change_mutex);
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 626 | }
|
ll | 375c94d | 2022-01-27 05:54:38 +0000 | [diff] [blame] | 627 | return;
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 628 | }
|
| 629 |
|
| 630 | /*Warren add for T800 platform 2021/11/19 start*/
|
| 631 | int lynq_socket_client_start()
|
rjw | 8bdc56b | 2022-02-28 15:01:49 +0800 | [diff] [blame] | 632 | {
|
| 633 | #if 0
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 634 | struct sockaddr_in lynq_socket_server_addr;
|
| 635 | /* init lynq_socket_server_addr */
|
| 636 | bzero(&lynq_socket_server_addr, sizeof(lynq_socket_server_addr));
|
| 637 | lynq_socket_server_addr.sin_family = AF_INET;
|
| 638 | lynq_socket_server_addr.sin_port = htons(LYNQ_SERVICE_PORT);
|
| 639 | lynq_socket_server_addr.sin_addr.s_addr = htons(INADDR_ANY);
|
rjw | 8bdc56b | 2022-02-28 15:01:49 +0800 | [diff] [blame] | 640 |
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 641 | /*
|
| 642 | if(inet_pton(AF_INET,"127.0.0.1", &lynq_socket_server_addr.sin_addr) <= 0)
|
| 643 | {
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 644 | LYDBGLOG("[%s] is not a valid IPaddress", argv[1]);
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 645 | exit(1);
|
| 646 | }
|
| 647 | */
|
lh | a35d4ee | 2022-01-25 18:47:39 -0800 | [diff] [blame] | 648 | lynq_call_client_sockfd = socket(AF_INET, SOCK_DGRAM, 0);
|
| 649 | if(connect(lynq_call_client_sockfd, (struct sockaddr *)&lynq_socket_server_addr, sizeof(lynq_socket_server_addr)) == -1)
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 650 | {
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 651 | LYERRLOG("connect error");
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 652 | return -1;
|
| 653 | }
|
rjw | 8bdc56b | 2022-02-28 15:01:49 +0800 | [diff] [blame] | 654 | #endif
|
| 655 | lynq_call_client_sockfd = socket(AF_INET, SOCK_DGRAM, 0);
|
| 656 | if (-1 == lynq_call_client_sockfd)
|
| 657 | {
|
| 658 | return lynq_call_client_sockfd;
|
| 659 | }
|
| 660 | /* 设置address */
|
| 661 | memset(&addr_serv, 0, sizeof(addr_serv));
|
| 662 | addr_serv.sin_family = AF_INET;
|
| 663 | addr_serv.sin_addr.s_addr = inet_addr(DSET_IP_ADDRESS);
|
| 664 | addr_serv.sin_port = htons(LYNQ_SERVICE_PORT);
|
| 665 | len_addr_serv = sizeof(addr_serv);
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 666 | return 0;
|
| 667 | }
|
| 668 | int lynq_update_call_list_loop()
|
| 669 | {
|
| 670 | int ret = 0;
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 671 | pthread_attr_t attr;
|
| 672 | pthread_attr_init(&attr);
|
| 673 | pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
|
lh | cdf816a | 2022-02-13 23:56:05 -0800 | [diff] [blame] | 674 | ret = pthread_create(&lynq_call_list_loop_tid,&attr,triggerGetCallList,NULL);
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 675 | if(ret < 0)
|
| 676 | {
|
| 677 | LYERRLOG("lynq_update_call_list_loop fail!!!");
|
| 678 | return -1;
|
| 679 | }
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 680 | LYDBGLOG("lynq_update_call_list_loop success!!!");
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 681 | return 0;
|
| 682 |
|
| 683 | }
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 684 |
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 685 | void *thread_urc_recv(void *parg)
|
ll | 375c94d | 2022-01-27 05:54:38 +0000 | [diff] [blame] | 686 | {
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 687 | int socket_fd = (int64_t)parg;
|
| 688 | int len=0;
|
| 689 | socklen_t addr_len=0;
|
| 690 | uint8_t *dataLength = NULL;
|
| 691 | char urc_data[LYNQ_REC_BUF];
|
| 692 | int slot_id = -1;
|
| 693 | int resp_type = -1;
|
| 694 | int urcid = -1;
|
| 695 | Parcel *p = NULL;
|
| 696 | struct sockaddr_in dest_addr;
|
q.huang | 18d08bf | 2022-04-19 20:27:44 -0400 | [diff] [blame] | 697 | #ifdef ECALL_SUPPORT
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 698 | int ecall_ind;
|
| 699 | int ecallId;
|
| 700 | int unused_callid;
|
q.huang | 18d08bf | 2022-04-19 20:27:44 -0400 | [diff] [blame] | 701 | #endif
|
| 702 |
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 703 | LYINFLOG("thread_urc_recv in running....");
|
lh | a35d4ee | 2022-01-25 18:47:39 -0800 | [diff] [blame] | 704 | while(urc_call_recive_status)
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 705 | {
|
| 706 | bzero(urc_data,LYNQ_REC_BUF);
|
| 707 | //get data msg
|
| 708 | len = recvfrom(socket_fd,urc_data,LYNQ_REC_BUF,0,(struct sockaddr *)&dest_addr,&addr_len);
|
| 709 | if(len <= 0)
|
ll | 375c94d | 2022-01-27 05:54:38 +0000 | [diff] [blame] | 710 | {
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 711 | LYERRLOG("thread_urc_recv step2 fail");
|
ll | 375c94d | 2022-01-27 05:54:38 +0000 | [diff] [blame] | 712 | break;
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 713 | }
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 714 | LYDBGLOG("=====>urc data len<=====:%d",len);
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 715 | p = new Parcel();
|
| 716 | if(p==NULL)
|
| 717 | {
|
lh | 59e0d00 | 2022-01-27 00:27:12 -0800 | [diff] [blame] | 718 | LYERRLOG("new parcel failure!!!");
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 719 | break;
|
| 720 | }
|
| 721 | p->setData((uint8_t *)urc_data,len); // p.setData((uint8_t *) buffer, buflen);
|
| 722 | p->setDataPosition(0);
|
| 723 | if(p->dataAvail() > 0)
|
| 724 | {
|
| 725 | p->readInt32(&resp_type);
|
| 726 | p->readInt32(&urcid);
|
| 727 | p->readInt32(&slot_id);
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 728 | //LYDBGLOG("*******Warren test*******:resp_type=%d,urcid=%d,slot_id=%d",resp_type,urcid,slot_id);
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 729 | switch (urcid)
|
| 730 | {
|
| 731 | case 1001://RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED
|
| 732 | {
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 733 | LYINFLOG("**************:resp_type=%d,urcid=%d,slot_id=%d",resp_type,urcid,slot_id);
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 734 | lynqRespWatingEvent();
|
| 735 | break;
|
| 736 | }
|
| 737 | case 1018://RIL_UNSOL_CALL_RING
|
| 738 | {
|
| 739 | if(global_call_auto_answer==1)
|
| 740 | {
|
| 741 | lynq_call_answer();
|
| 742 | }
|
| 743 | break;
|
| 744 | }
|
| 745 | case 1029://RIL_UNSOL_RINGBACK_TONE
|
| 746 | case 3049://RIL_UNSOL_CALL_INFO_INDICATION
|
| 747 | {
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 748 | LYINFLOG("**************:resp_type=%d,urcid=%d,slot_id=%d",resp_type,urcid,slot_id);
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 749 | break;
|
| 750 | }
|
q.huang | 18d08bf | 2022-04-19 20:27:44 -0400 | [diff] [blame] | 751 | #ifdef ECALL_SUPPORT
|
| 752 | case RIL_UNSOL_ECALL_INDICATIONS:
|
| 753 | {
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 754 | p->readInt32(&ecall_ind);
|
| 755 | g_lynqIncomingEcallIndication = ecall_ind;
|
| 756 | p->readInt32(&ecallId);
|
| 757 | LYINFLOG("**************:RIL_UNSOL_ECALL_INDICATIONS ,Id %d, ind %d, ecall dialing is %d, normal dialing is %d, local ecall id is %d",ecallId,ecall_ind,is_ecall_dial,isDial,g_ecallId);
|
| 758 | if(lynq_is_msd_suc(g_lynqIncomingEcallIndication))
|
| 759 | {
|
| 760 | if(is_ecall_dial)
|
| 761 | {
|
| 762 | LYINFLOG("ecall is dialing, recv suc indication");
|
| 763 | is_ecall_dial=0;
|
| 764 | if(ecallId >0 && find_call_id_with_call_id(ecallId)==INVALID_ID)
|
| 765 | {
|
| 766 | LYINFLOG("add ecall in loacl list");
|
| 767 | g_ecallId = ecallId;
|
| 768 | unused_callid=addAddr("ecall");
|
| 769 | lynq_call_lists[unused_callid].call_id=g_ecallId;
|
| 770 | }
|
q.huang | 18d08bf | 2022-04-19 20:27:44 -0400 | [diff] [blame] | 771 | sendSignalToWaitCallStateChange();
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 772 | }
|
| 773 | else if(ecallId >0 && (find_call_id_with_call_id(ecallId)==INVALID_ID)){
|
| 774 | LYERRLOG("ecall is not in dialing and first recv suc indication, hangup");
|
| 775 | lynq_call_hungup(&ecallId);
|
| 776 | }
|
| 777 | else
|
| 778 | {
|
| 779 | LYERRLOG("ecall is not in dialing and not first recv suc indication");
|
| 780 | }
|
| 781 | }
|
| 782 | else if (LYNQ_ECALL_PSAP_CALLBACK_START == g_lynqIncomingEcallIndication)
|
| 783 | {
|
| 784 | if(lynq_ecall_is_running()==0)
|
| 785 | {
|
| 786 | LYINFLOG("ecall is not running, recv psap call back msd start, set ecall in dialing");
|
| 787 | is_ecall_dial=1;
|
| 788 | if(isDial)
|
| 789 | {
|
| 790 | LYINFLOG("stop normal dial");
|
| 791 | sendSignalToWaitCallStateChange();
|
| 792 | }
|
| 793 | else
|
| 794 | {
|
| 795 | LYINFLOG("no normal dial");
|
| 796 | }
|
| 797 | }
|
| 798 | else
|
| 799 | {
|
| 800 | LYERRLOG("ecall is running, recv psap call back msd start");
|
| 801 | }
|
| 802 | }
|
| 803 | else if (LYNQ_ECALL_ABNORMAL_HANGUP == g_lynqIncomingEcallIndication)
|
| 804 | {
|
| 805 | if(is_ecall_dial==0)
|
| 806 | {
|
| 807 | LYERRLOG("ecall is not in dialing, recv abnormal hangup");
|
| 808 | g_ecallId = INVALID_ID;
|
| 809 | }
|
| 810 | else
|
| 811 | {
|
| 812 | LYINFLOG("ecall is in dialing, recv abnormal hangup");
|
| 813 | }
|
| 814 | }
|
| 815 | else if (LYNQ_ECALL_DISCONNECTED == g_lynqIncomingEcallIndication ||
|
| 816 | LYNQ_ECALL_REDIAL_TIMER_OUT == g_lynqIncomingEcallIndication ||
|
| 817 | LYNQ_ECALL_T2_TIMER_OUT == g_lynqIncomingEcallIndication)
|
| 818 | {
|
| 819 | g_ecallId = INVALID_ID;
|
| 820 | if(is_ecall_dial)
|
| 821 | {
|
| 822 | LYERRLOG("ecall is in dialing, recv like disconnect indication");
|
| 823 | is_ecall_dial=0;
|
| 824 | sendSignalToWaitCallStateChange();
|
| 825 | }
|
| 826 | else
|
| 827 | {
|
| 828 | LYINFLOG("ecall is not in dialing, recv like disconnect indication");
|
| 829 | }
|
| 830 | }
|
| 831 | else
|
| 832 | {
|
| 833 | LYINFLOG("not special indication");
|
| 834 | }
|
q.huang | 18d08bf | 2022-04-19 20:27:44 -0400 | [diff] [blame] | 835 | sendSignalIncomingECallEvent();
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 836 | LYINFLOG("**************:RIL_UNSOL_ECALL_INDICATIONS, local ecall id is %d", g_ecallId);
|
q.huang | 18d08bf | 2022-04-19 20:27:44 -0400 | [diff] [blame] | 837 | break;
|
| 838 | }
|
| 839 | #endif
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 840 | default:
|
| 841 | break;
|
| 842 | }
|
| 843 | }
|
| 844 | delete p;
|
| 845 | p = NULL;
|
| 846 | }
|
| 847 | close(socket_fd);
|
| 848 | }
|
| 849 | int lynq_socket_urc_start()
|
| 850 | {
|
| 851 | int socket_fd=0;
|
| 852 | int rt=0;
|
| 853 | int len=0;
|
| 854 | int on=1;
|
| 855 | struct sockaddr_in urc_local_addr;
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 856 | pthread_attr_t attr;
|
ll | 375c94d | 2022-01-27 05:54:38 +0000 | [diff] [blame] | 857 | socket_fd = socket(AF_INET,SOCK_DGRAM,0);
|
ll | 375c94d | 2022-01-27 05:54:38 +0000 | [diff] [blame] | 858 | if(socket_fd < 0)
|
| 859 | {
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 860 | LYERRLOG("creaet socket for udp fail");
|
ll | 375c94d | 2022-01-27 05:54:38 +0000 | [diff] [blame] | 861 | return -1;
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 862 | }
|
| 863 | urc_local_addr.sin_family = AF_INET;
|
| 864 | urc_local_addr.sin_port = htons(LYNQ_URC_SERVICE_PORT);
|
| 865 | urc_local_addr.sin_addr.s_addr = htons(INADDR_ANY);
|
| 866 | /* Set socket to allow reuse of address and port, SO_REUSEADDR value is 2*/
|
ll | 375c94d | 2022-01-27 05:54:38 +0000 | [diff] [blame] | 867 | rt = setsockopt(socket_fd,SOL_SOCKET,SO_REUSEADDR,&on,sizeof on);
|
| 868 | if(rt<0)
|
| 869 | {
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 870 | LYERRLOG("SO_REUSEADDR fail");
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 871 | return -1;
|
| 872 | }
|
| 873 | rt = bind(socket_fd ,(struct sockaddr*)&urc_local_addr, sizeof(urc_local_addr));
|
ll | 375c94d | 2022-01-27 05:54:38 +0000 | [diff] [blame] | 874 | if (rt == -1)
|
| 875 | {
|
lh | 59e0d00 | 2022-01-27 00:27:12 -0800 | [diff] [blame] | 876 | LYERRLOG("bind failed");
|
ll | 375c94d | 2022-01-27 05:54:38 +0000 | [diff] [blame] | 877 | return -1;
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 878 | }
|
| 879 | pthread_attr_init(&attr);
|
| 880 | pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
|
lh | cdf816a | 2022-02-13 23:56:05 -0800 | [diff] [blame] | 881 | rt = pthread_create(&lynq_call_urc_tid,&attr,thread_urc_recv,(void *)socket_fd);
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 882 | if(rt < 0)
|
| 883 | {
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 884 | LYERRLOG("urc loop failure!!!");
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 885 | return -1;
|
| 886 | }
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 887 | LYDBGLOG("urc loop success!!!");
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 888 | return 0;
|
| 889 | }
|
| 890 | int getSelfElement(char addr[])
|
| 891 | {
|
| 892 | for(int i=0;i < LYNQ_CALL_MAX; i++)
|
| 893 | {
|
| 894 | if(lynq_call_lists[i].used==1)
|
| 895 | {
|
| 896 | if(strcmp(lynq_call_lists[i].addr,addr)==0)
|
| 897 | {
|
| 898 | return i;
|
| 899 | }
|
| 900 |
|
| 901 | }
|
| 902 | }
|
| 903 | return -1;
|
| 904 | }
|
| 905 |
|
| 906 | void lynq_call_state_change_test(int soc_id)
|
| 907 | {
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 908 | LYDBGLOG("call state change,sim:%d",soc_id);
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 909 | }
|
| 910 | int lynq_init_call(int uToken)
|
ll | 1343a5b | 2022-03-17 05:31:33 +0000 | [diff] [blame] | 911 | {
|
| 912 | if(g_lynq_call_init_flag == 1){
|
| 913 | LYDBGLOG("lynq init call failed!!!");
|
| 914 | return -1;
|
| 915 | }
|
| 916 | g_lynq_call_init_flag = 1;
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 917 | int result = 0;
|
lh | a35d4ee | 2022-01-25 18:47:39 -0800 | [diff] [blame] | 918 | Global_uToken_call = uToken;
|
lh | 59e0d00 | 2022-01-27 00:27:12 -0800 | [diff] [blame] | 919 | urc_call_recive_status = 1;
|
rjw | 8bdc56b | 2022-02-28 15:01:49 +0800 | [diff] [blame] | 920 | client_size = sizeof(client_t);
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 921 | LYLOGSET(LOG_INFO);
|
| 922 | LYLOGEINIT(USER_LOG_TAG);
|
| 923 | result = lynq_socket_client_start();
|
| 924 | if(result!=0)
|
| 925 | {
|
| 926 | return -1;
|
| 927 | }
|
| 928 | result = lynq_socket_urc_start();
|
| 929 | if(result!=0)
|
| 930 | {
|
| 931 | return -1;
|
| 932 | }
|
| 933 | result = lynq_update_call_list_loop();
|
| 934 | if(result!=0)
|
| 935 | {
|
| 936 | return -1;
|
| 937 | }
|
| 938 | memset(lynq_call_lists,0,sizeof(lynq_call_lists));
|
| 939 | LYDBGLOG("lynq init call success!!!");
|
| 940 | return 0;
|
| 941 | }
|
| 942 | int lynq_deinit_call()
|
| 943 | {
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 944 | int ret;
|
ll | 1343a5b | 2022-03-17 05:31:33 +0000 | [diff] [blame] | 945 | if(g_lynq_call_init_flag == 0)
|
lh | cdf816a | 2022-02-13 23:56:05 -0800 | [diff] [blame] | 946 | {
|
ll | 1343a5b | 2022-03-17 05:31:33 +0000 | [diff] [blame] | 947 | LYDBGLOG("lynq_deinit_call failed!!!");
|
| 948 | return -1;
|
lh | cdf816a | 2022-02-13 23:56:05 -0800 | [diff] [blame] | 949 | }
|
ll | 1343a5b | 2022-03-17 05:31:33 +0000 | [diff] [blame] | 950 | else
|
| 951 | {
|
| 952 | g_lynq_call_init_flag = 0;
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 953 | lynq_call_hungup_all();
|
ll | 1343a5b | 2022-03-17 05:31:33 +0000 | [diff] [blame] | 954 | if(lynq_call_client_sockfd>0)
|
| 955 | {
|
| 956 | close(lynq_call_client_sockfd);
|
| 957 | }
|
| 958 | urc_call_recive_status = 0;
|
| 959 | call_list_loop = 0;
|
| 960 | if(lynq_call_urc_tid == -1 || lynq_call_list_loop_tid == -1)
|
| 961 | {
|
| 962 | return -1;
|
| 963 | }
|
| 964 | ret = pthread_cancel(lynq_call_urc_tid);
|
| 965 | LYDBGLOG("pthread cancel ret = %d",ret);
|
| 966 | ret = pthread_cancel(lynq_call_list_loop_tid);
|
| 967 | LYDBGLOG("pthread cancel ret = %d",ret);
|
| 968 | ret = pthread_join(lynq_call_urc_tid,NULL);
|
| 969 | LYDBGLOG("pthread join ret = %d",ret);
|
| 970 | ret = pthread_join(lynq_call_list_loop_tid,NULL);
|
| 971 | LYDBGLOG("pthread join ret = %d",ret);
|
| 972 | return 0;
|
| 973 | }
|
rita | 47debb9 | 2022-04-07 06:08:13 -0400 | [diff] [blame] | 974 | }
|
q.huang | fe1b405 | 2022-04-18 00:09:50 -0400 | [diff] [blame] | 975 |
|
| 976 | int lynq_set_common_request(int request_id, int argc, const char* format,...)
|
rita | 9b436d8 | 2022-04-07 01:55:39 -0400 | [diff] [blame] | 977 | {
|
| 978 | Parcel p;
|
| 979 | lynq_client_t client;
|
| 980 | int resp_type = -1;
|
| 981 | int request = -1;
|
| 982 | int slot_id = -1;
|
| 983 | int error = -1;
|
rita | 9b436d8 | 2022-04-07 01:55:39 -0400 | [diff] [blame] | 984 |
|
| 985 | client.uToken = Global_uToken_call;
|
q.huang | fe1b405 | 2022-04-18 00:09:50 -0400 | [diff] [blame] | 986 | client.request = request_id;
|
| 987 | client.paramLen = argc;
|
rita | 9b436d8 | 2022-04-07 01:55:39 -0400 | [diff] [blame] | 988 | bzero(client.param,LYNQ_REQUEST_PARAM_BUF);
|
q.huang | fe1b405 | 2022-04-18 00:09:50 -0400 | [diff] [blame] | 989 | if(argc!=0)
|
| 990 | {
|
| 991 | va_list args;
|
| 992 | va_start(args, format);
|
| 993 | vsnprintf(client.param, LYNQ_REQUEST_PARAM_BUF, format, args);
|
| 994 | va_end(args);
|
| 995 | }
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 996 | LYINFLOG("uToken=%d,request=%d,paralen=%d,param=%s",client.uToken,client.request,client.paramLen,client.param);
|
rita | 9b436d8 | 2022-04-07 01:55:39 -0400 | [diff] [blame] | 997 | if(send_request(lynq_call_client_sockfd,&client)==-1)
|
| 998 | {
|
| 999 | LYERRLOG("send request fail");
|
| 1000 | return -1;
|
| 1001 | }
|
q.huang | fe1b405 | 2022-04-18 00:09:50 -0400 | [diff] [blame] | 1002 | if(get_response(lynq_call_client_sockfd,p)==0)
|
| 1003 | {
|
| 1004 | JumpHeader(p,&resp_type,&request,&slot_id,&error);
|
| 1005 | LYINFLOG("resp_type=%d,request=%d,slot_id=%d,error_code=%d",resp_type,request,slot_id,error);
|
| 1006 | }
|
rita | 9b436d8 | 2022-04-07 01:55:39 -0400 | [diff] [blame] | 1007 | return error;
|
| 1008 | }
|
| 1009 |
|
q.huang | fe1b405 | 2022-04-18 00:09:50 -0400 | [diff] [blame] | 1010 | int lynq_get_common_request(int request_id, int* status)
|
rita | 9b436d8 | 2022-04-07 01:55:39 -0400 | [diff] [blame] | 1011 | {
|
| 1012 | Parcel p;
|
| 1013 | lynq_client_t client;
|
| 1014 | int resp_type = -1;
|
| 1015 | int request = -1;
|
| 1016 | int slot_id = -1;
|
| 1017 | int error = -1;
|
q.huang | fe1b405 | 2022-04-18 00:09:50 -0400 | [diff] [blame] | 1018 | if(status==NULL)
|
| 1019 | {
|
| 1020 | LYERRLOG("status is null");
|
| 1021 | return -1;
|
| 1022 | }
|
rita | 9b436d8 | 2022-04-07 01:55:39 -0400 | [diff] [blame] | 1023 | client.uToken = Global_uToken_call;
|
q.huang | fe1b405 | 2022-04-18 00:09:50 -0400 | [diff] [blame] | 1024 | client.request = request_id;
|
| 1025 | client.paramLen = 0;
|
rita | 9b436d8 | 2022-04-07 01:55:39 -0400 | [diff] [blame] | 1026 | bzero(client.param,LYNQ_REQUEST_PARAM_BUF);
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 1027 | LYINFLOG("uToken=%d,request=%d,paralen=%d,param=%s",client.uToken,client.request,client.paramLen,client.param);
|
rita | 9b436d8 | 2022-04-07 01:55:39 -0400 | [diff] [blame] | 1028 | if(send_request(lynq_call_client_sockfd,&client)==-1)
|
| 1029 | {
|
| 1030 | LYERRLOG("send request fail");
|
| 1031 | return -1;
|
| 1032 | }
|
q.huang | fe1b405 | 2022-04-18 00:09:50 -0400 | [diff] [blame] | 1033 | if(get_response(lynq_call_client_sockfd,p)==0)
|
rita | 9b436d8 | 2022-04-07 01:55:39 -0400 | [diff] [blame] | 1034 | {
|
q.huang | fe1b405 | 2022-04-18 00:09:50 -0400 | [diff] [blame] | 1035 | JumpHeader(p,&resp_type,&request,&slot_id,&error);
|
| 1036 | p.readInt32(status);
|
| 1037 | LYINFLOG("resp_type=%d,request=%d,slot_id=%d,error_code=%d",resp_type,request,slot_id,error);
|
rita | 9b436d8 | 2022-04-07 01:55:39 -0400 | [diff] [blame] | 1038 | }
|
rita | 9b436d8 | 2022-04-07 01:55:39 -0400 | [diff] [blame] | 1039 | return error;
|
| 1040 | }
|
| 1041 |
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 1042 | int lynq_call(int* handle,char addr[])
|
| 1043 | {
|
| 1044 | Parcel p;
|
| 1045 | lynq_client_t client;
|
| 1046 | int resp_type = -1;
|
| 1047 | int request = -1;
|
| 1048 | int slot_id = -1;
|
| 1049 | int error = -1;
|
| 1050 | int lynq_call_id = -1;
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 1051 |
|
| 1052 | LYINFLOG("lynq_call begin addr %s",addr);
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 1053 | if(addr==NULL)
|
| 1054 | {
|
| 1055 | LYERRLOG("Phone num is null!!!");
|
| 1056 | return -1;
|
| 1057 | }
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 1058 |
|
| 1059 | if(find_call_id_with_addr(addr)!=INVALID_ID)
|
| 1060 | {
|
| 1061 | LYERRLOG("addr %s exists",addr);
|
| 1062 | return LYNQ_E_CONFLICT;
|
| 1063 | }
|
| 1064 |
|
| 1065 | #ifdef ECALL_SUPPORT
|
| 1066 | if(lynq_ecall_is_running())
|
| 1067 | {
|
| 1068 | LYERRLOG("lynq_fast_ecall ecall is running");
|
| 1069 | return LYNQ_E_ECALL_BEING_RUNNING;
|
| 1070 | }
|
| 1071 | #endif
|
| 1072 |
|
lh | a35d4ee | 2022-01-25 18:47:39 -0800 | [diff] [blame] | 1073 | client.uToken = Global_uToken_call;
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 1074 | client.request = 10;//RIL_REQUEST_DIAL
|
| 1075 | client.paramLen = 2;
|
| 1076 | bzero(client.param,LYNQ_REQUEST_PARAM_BUF);
|
| 1077 | memcpy(client.param,addr,strlen(addr)+1);
|
| 1078 | strcat(client.param," 0");
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 1079 | lynq_call_id = addAddr(addr);
|
| 1080 | LYINFLOG("uToken=%d,request=%d,paralen=%d,param=%s",client.uToken,client.request,client.paramLen,client.param);
|
lh | a35d4ee | 2022-01-25 18:47:39 -0800 | [diff] [blame] | 1081 | if(send_request(lynq_call_client_sockfd,&client)==-1)
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 1082 | {
|
| 1083 | LYERRLOG("send request fail");
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 1084 | cleanCallList(lynq_call_id);
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 1085 | return -1;
|
| 1086 | }
|
lh | a35d4ee | 2022-01-25 18:47:39 -0800 | [diff] [blame] | 1087 | get_response(lynq_call_client_sockfd,p);
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 1088 | JumpHeader(p,&resp_type,&request,&slot_id,&error);
|
| 1089 | LYINFLOG("resp_type=%d,request=%d,slot_id=%d,error_code=%d",resp_type,request,slot_id,error);
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 1090 | if(error==0)
|
| 1091 | {
|
| 1092 | isDial = 1;
|
ll | 45d3ea9 | 2022-03-24 10:22:25 +0800 | [diff] [blame] | 1093 | if(waitCallstateChange(6000)==ETIMEDOUT)//6000ms
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 1094 | {
|
lh | be92dd1 | 2022-04-19 06:01:25 -0700 | [diff] [blame] | 1095 | //if timeout,this call need destroy.
|
| 1096 | isDial = 0;
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 1097 | error = LYNQ_E_TIME_OUT;
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 1098 | LYERRLOG("lynq_call timeout:wait Call state fail!!! clear local idx %d",lynq_call_id);
|
| 1099 | cleanCallList(lynq_call_id);
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 1100 | return error;
|
| 1101 | }
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 1102 | isDial = 0;
|
| 1103 | *handle = lynq_call_lists[lynq_call_id].call_id;
|
| 1104 | if(*handle > 0)
|
| 1105 | {
|
| 1106 | LYINFLOG("lynq_call dial addr %s suc, id is %d",addr,*handle);
|
| 1107 | return 0;
|
| 1108 | }
|
| 1109 | else
|
| 1110 | {
|
| 1111 | LYERRLOG("lynq_call dial addr %s fail, invalid id",addr);
|
| 1112 | cleanCallList(lynq_call_id);
|
| 1113 | return LYNQ_E_INVALID_ID_ANONALY;
|
| 1114 | }
|
| 1115 |
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 1116 | }
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 1117 | LYERRLOG("lynq_call dial addr %s fail, service error %d",addr, error);
|
| 1118 | cleanCallList(lynq_call_id);
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 1119 | return error;
|
| 1120 | }
|
| 1121 | int lynq_call_answer()
|
| 1122 | {
|
| 1123 | Parcel p;
|
| 1124 | lynq_client_t client;
|
| 1125 | int resp_type = -1;
|
| 1126 | int request = -1;
|
| 1127 | int slot_id = -1;
|
| 1128 | int error = -1;
|
lh | a35d4ee | 2022-01-25 18:47:39 -0800 | [diff] [blame] | 1129 | client.uToken = Global_uToken_call;
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 1130 | client.request = 40;//RIL_REQUEST_DIAL
|
| 1131 | client.paramLen = 0;
|
| 1132 | bzero(client.param,LYNQ_REQUEST_PARAM_BUF);
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 1133 | LYINFLOG("uToken=%d,request=%d,paralen=%d,param=%s",client.uToken,client.request,client.paramLen,client.param);
|
lh | a35d4ee | 2022-01-25 18:47:39 -0800 | [diff] [blame] | 1134 | if(send_request(lynq_call_client_sockfd,&client)==-1)
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 1135 | {
|
| 1136 | LYERRLOG("send request fail");
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 1137 | return -1;
|
| 1138 | }
|
lh | a35d4ee | 2022-01-25 18:47:39 -0800 | [diff] [blame] | 1139 | get_response(lynq_call_client_sockfd,p);
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 1140 | JumpHeader(p,&resp_type,&request,&slot_id,&error);
|
| 1141 | LYINFLOG("resp_type=%d,request=%d,slot_id=%d,error_code=%d",resp_type,request,slot_id,error);
|
| 1142 | return error;
|
| 1143 | }
|
| 1144 | int lynq_call_hungup(int* handle)
|
| 1145 | {
|
| 1146 | Parcel p;
|
| 1147 | lynq_client_t client;
|
| 1148 | int resp_type = -1;
|
| 1149 | int request = -1;
|
| 1150 | int slot_id = -1;
|
| 1151 | int error = -1;
|
| 1152 | int call_id = 0;
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 1153 | int lynq_call_id;
|
lh | a35d4ee | 2022-01-25 18:47:39 -0800 | [diff] [blame] | 1154 | if(handle==NULL||!((*handle>=0)&&(*handle<10)))
|
| 1155 | {
|
| 1156 | LYERRLOG("[%s] illegal input!!!!",__FUNCTION__);
|
| 1157 | return LYNQ_E_CONFLICT;
|
| 1158 | }
|
| 1159 | client.uToken = Global_uToken_call;
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 1160 | client.request = 12;//RIL_REQUEST_HUNGUP
|
| 1161 | client.paramLen = 1;
|
| 1162 | bzero(client.param,LYNQ_REQUEST_PARAM_BUF);
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 1163 | call_id = *handle;
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 1164 | sprintf(client.param,"%d",call_id);
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 1165 | LYINFLOG("uToken=%d,request=%d,paralen=%d,param=%s",client.uToken,client.request,client.paramLen,client.param);
|
lh | a35d4ee | 2022-01-25 18:47:39 -0800 | [diff] [blame] | 1166 | if(send_request(lynq_call_client_sockfd,&client)==-1)
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 1167 | {
|
| 1168 | LYERRLOG("send request fail");
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 1169 | return -1;
|
| 1170 | }
|
lh | a35d4ee | 2022-01-25 18:47:39 -0800 | [diff] [blame] | 1171 | get_response(lynq_call_client_sockfd,p);
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 1172 | JumpHeader(p,&resp_type,&request,&slot_id,&error);
|
| 1173 | LYINFLOG("resp_type=%d,request=%d,slot_id=%d,error_code=%d",resp_type,request,slot_id,error);
|
| 1174 | if(error==0)
|
| 1175 | {
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 1176 | lynq_call_id=find_call_id_with_call_id(call_id);
|
| 1177 | if(lynq_call_id!=INVALID_ID)
|
| 1178 | {
|
| 1179 | cleanCallList(lynq_call_id);
|
| 1180 | }
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 1181 | }
|
| 1182 | return error;
|
| 1183 | }
|
| 1184 | int lynq_call_hungup_all()
|
| 1185 | {
|
| 1186 | Parcel p;
|
| 1187 | lynq_client_t client;
|
| 1188 | int resp_type = -1;
|
| 1189 | int request = -1;
|
| 1190 | int slot_id = -1;
|
| 1191 | int error = -1;
|
lh | a35d4ee | 2022-01-25 18:47:39 -0800 | [diff] [blame] | 1192 | client.uToken = Global_uToken_call;
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 1193 | client.request = 17;//RIL_REQUEST_UDUB
|
| 1194 | client.paramLen = 0;
|
| 1195 | bzero(client.param,LYNQ_REQUEST_PARAM_BUF);
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 1196 | LYDBGLOG("uToken=%d,request=%d,paralen=%d,param=%s",client.uToken,client.request,client.paramLen,client.param);
|
lh | a35d4ee | 2022-01-25 18:47:39 -0800 | [diff] [blame] | 1197 | if(send_request(lynq_call_client_sockfd,&client)==-1)
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 1198 | {
|
| 1199 | LYERRLOG("send request fail");
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 1200 | return -1;
|
| 1201 | }
|
lh | a35d4ee | 2022-01-25 18:47:39 -0800 | [diff] [blame] | 1202 | get_response(lynq_call_client_sockfd,p);
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 1203 | JumpHeader(p,&resp_type,&request,&slot_id,&error);
|
| 1204 | LYINFLOG("resp_type=%d,request=%d,slot_id=%d,error_code=%d",resp_type,request,slot_id,error);
|
| 1205 | return error;
|
| 1206 | }
|
| 1207 | int lynq_wait_incoming_call(int *handle)
|
| 1208 | {
|
| 1209 | waitIncomingCall();
|
| 1210 | *handle = lynqIncomingCallId;
|
| 1211 | LYINFLOG("lynq incoming call id:%d",lynqIncomingCallId);
|
| 1212 | return 0;
|
| 1213 | }
|
| 1214 |
|
| 1215 | int lynq_set_auto_answercall(const int mode)
|
| 1216 | {
|
| 1217 | global_call_auto_answer = mode;
|
| 1218 | LYINFLOG("auto answer call mode =%d",mode);
|
| 1219 | return 0;
|
| 1220 | }
|
q.huang | b0eb7b0 | 2022-03-29 04:17:32 -0400 | [diff] [blame] | 1221 | int lynq_get_current_call_state(int *handle, int *call_state,int *toa,int *direction,char addr[])
|
| 1222 | {
|
| 1223 | int lynq_call_id = 0;
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 1224 | LYINFLOG("lynq_get_current_call_state begin ");
|
q.huang | b0eb7b0 | 2022-03-29 04:17:32 -0400 | [diff] [blame] | 1225 | if(handle==NULL)
|
| 1226 | {
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 1227 | LYERRLOG("handle is NULL");
|
q.huang | b0eb7b0 | 2022-03-29 04:17:32 -0400 | [diff] [blame] | 1228 | return LYNQ_E_NULL_ANONALY;
|
| 1229 | }
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 1230 | lynq_call_id = find_call_id_with_call_id(*handle);
|
| 1231 | if(lynq_call_id==INVALID_ID)
|
| 1232 | {
|
| 1233 | return LYNQ_E_INVALID_ID_ANONALY;
|
| 1234 | }
|
q.huang | b0eb7b0 | 2022-03-29 04:17:32 -0400 | [diff] [blame] | 1235 | *call_state = lynq_call_lists[lynq_call_id].call_state;
|
| 1236 | *toa = lynq_call_lists[lynq_call_id].toa;
|
| 1237 | *direction = lynq_call_lists[lynq_call_id].direction;
|
| 1238 | memcpy(addr,lynq_call_lists[lynq_call_id].addr,strlen(lynq_call_lists[lynq_call_id].addr)+1);
|
| 1239 | return 0;
|
| 1240 | }
|
| 1241 |
|
| 1242 | /*audio begin*/
|
ll | 7e055f2 | 2022-01-24 12:16:22 +0000 | [diff] [blame] | 1243 | static int judge_mic(const int enable){
|
ll | c603006 | 2022-02-14 08:58:16 +0000 | [diff] [blame] | 1244 | switch(enable){
|
| 1245 | case 0:
|
| 1246 | return 1;
|
| 1247 | case 1:
|
| 1248 | return 1;
|
| 1249 | default:
|
| 1250 | return 0;
|
ll | 7e055f2 | 2022-01-24 12:16:22 +0000 | [diff] [blame] | 1251 | }
|
| 1252 | }
|
| 1253 |
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 1254 | int lynq_set_mute_mic(const int enable)
|
ll | 7e055f2 | 2022-01-24 12:16:22 +0000 | [diff] [blame] | 1255 | {
|
| 1256 | if(!judge_mic(enable)){
|
| 1257 | return LYNQ_E_CONFLICT;
|
| 1258 | }
|
q.huang | b0eb7b0 | 2022-03-29 04:17:32 -0400 | [diff] [blame] | 1259 | return lynq_set_common_request(53,1,"%d",enable); //RIL_REQUEST_SET_MUTE
|
| 1260 | }
|
| 1261 | int lynq_get_mute_mic(int *status)
|
| 1262 | {
|
| 1263 | return lynq_get_common_request(54,status);//RIL_REQUEST_GET_MUTE
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 1264 | }
|
ll | 45d3ea9 | 2022-03-24 10:22:25 +0800 | [diff] [blame] | 1265 |
|
| 1266 | /**
|
| 1267 | * @brief Check whether DTMF is valid
|
| 1268 | *
|
| 1269 | * @param callnum dtmf eg:0-9 * #
|
| 1270 | * @return int
|
| 1271 | */
|
| 1272 | static int judge_dtmf(const char callnum)
|
| 1273 | {
|
| 1274 | if(callnum == '#')
|
| 1275 | {
|
| 1276 | return 1;
|
| 1277 | }
|
| 1278 | if(callnum == '*')
|
| 1279 | {
|
| 1280 | return 1;
|
| 1281 | }
|
| 1282 | if(callnum >= '0'&& callnum <= '9')
|
| 1283 | {
|
| 1284 | return 1;
|
| 1285 | }
|
| 1286 | return 0;
|
| 1287 | }
|
| 1288 |
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 1289 | int lynq_set_DTMF(const char callnum)
|
| 1290 | {
|
ll | 45d3ea9 | 2022-03-24 10:22:25 +0800 | [diff] [blame] | 1291 | if(!judge_dtmf(callnum))
|
| 1292 | {
|
| 1293 | return LYNQ_E_CONFLICT;
|
| 1294 | }
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 1295 | if(!lynq_call_state)
|
| 1296 | {
|
| 1297 | LYERRLOG("LYNQ_E_CONFLICT");
|
| 1298 | return LYNQ_E_CONFLICT;
|
| 1299 | }
|
q.huang | b0eb7b0 | 2022-03-29 04:17:32 -0400 | [diff] [blame] | 1300 | return lynq_set_common_request(24,1,"%c",callnum); //RIL_REQUEST_DTMF
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 1301 | }
|
q.huang | b0eb7b0 | 2022-03-29 04:17:32 -0400 | [diff] [blame] | 1302 | static int judge_volume(LYNQ_E_VOLUMN_SET set,const int volume){
|
| 1303 | if(set==LYNQ_E_VOLUMN_SET_DTMF){
|
| 1304 | if(volume < 0 ||volume >36){
|
| 1305 | return 0;
|
| 1306 | }
|
| 1307 | }
|
| 1308 | else if (set==LYNQ_E_VOLUMN_SET_SPEECH)
|
| 1309 | {
|
| 1310 | if(volume < 1 ||volume >7){
|
| 1311 | return 0;
|
| 1312 | }
|
ll | 7e055f2 | 2022-01-24 12:16:22 +0000 | [diff] [blame] | 1313 | }
|
ll | 375c94d | 2022-01-27 05:54:38 +0000 | [diff] [blame] | 1314 | return 1;
|
ll | 7e055f2 | 2022-01-24 12:16:22 +0000 | [diff] [blame] | 1315 | }
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 1316 | int lynq_set_DTMF_volume(const int volume)
|
ll | 7e055f2 | 2022-01-24 12:16:22 +0000 | [diff] [blame] | 1317 | {
|
q.huang | b0eb7b0 | 2022-03-29 04:17:32 -0400 | [diff] [blame] | 1318 | if(!judge_volume(LYNQ_E_VOLUMN_SET_DTMF,volume)){
|
ll | 7e055f2 | 2022-01-24 12:16:22 +0000 | [diff] [blame] | 1319 | return LYNQ_E_CONFLICT;
|
| 1320 | }
|
q.huang | b0eb7b0 | 2022-03-29 04:17:32 -0400 | [diff] [blame] | 1321 | return lynq_set_common_request(8003,1,"%d",volume);//LYNQ_REQUEST_SET_DTMF_VOLUME
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 1322 | }
|
q.huang | 9ee6d5b | 2022-04-05 23:11:02 -0400 | [diff] [blame] | 1323 | int lynq_set_speech_volume(const int volume)//mixer_set_volume
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 1324 | {
|
q.huang | b0eb7b0 | 2022-03-29 04:17:32 -0400 | [diff] [blame] | 1325 | if(!judge_volume(LYNQ_E_VOLUMN_SET_SPEECH,volume))
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 1326 | {
|
q.huang | b0eb7b0 | 2022-03-29 04:17:32 -0400 | [diff] [blame] | 1327 | return LYNQ_E_CONFLICT;
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 1328 | }
|
q.huang | b0eb7b0 | 2022-03-29 04:17:32 -0400 | [diff] [blame] | 1329 | return lynq_set_common_request(8009,1,"%d",volume); //LYNQ_REQUEST_SET_SPEECH_VOLUME
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 1330 | }
|
q.huang | b0eb7b0 | 2022-03-29 04:17:32 -0400 | [diff] [blame] | 1331 | int lynq_get_speech_volume(int* volumn)//mixer_get_volume
|
| 1332 | {
|
| 1333 | return lynq_get_common_request(8010,volumn);//LYNQ_REQUEST_GET_SPEECH_VOLUME
|
| 1334 | }
|
q.huang | 9ee6d5b | 2022-04-05 23:11:02 -0400 | [diff] [blame] | 1335 | int lynq_incall_record_start(const char* file_path)
|
q.huang | b0eb7b0 | 2022-03-29 04:17:32 -0400 | [diff] [blame] | 1336 | {
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 1337 | return lynq_set_common_request(8011,2,"%s %s","1",file_path); //LYNQ_REQUEST_RECORD
|
q.huang | b0eb7b0 | 2022-03-29 04:17:32 -0400 | [diff] [blame] | 1338 | }
|
| 1339 | int lynq_incall_record_stop()
|
| 1340 | {
|
q.huang | 9ee6d5b | 2022-04-05 23:11:02 -0400 | [diff] [blame] | 1341 | const char* unused_file="just_ocuupy_paramter_postion";
|
| 1342 | return lynq_set_common_request(8011,2,"%s %s","0",unused_file); //LYNQ_REQUEST_RECORD
|
q.huang | b0eb7b0 | 2022-03-29 04:17:32 -0400 | [diff] [blame] | 1343 | }
|
| 1344 | /*audio end*/
|
q.huang | fe1b405 | 2022-04-18 00:09:50 -0400 | [diff] [blame] | 1345 |
|
| 1346 | #ifdef ECALL_SUPPORT
|
| 1347 | LYNQ_ECall_Variant lynq_get_lynq_ecall_variant_from_lynq_type(LYNQ_ECall_Type type)
|
| 1348 | {
|
| 1349 | switch(type)
|
| 1350 | {
|
| 1351 | case LYNQ_ECALL_TYPE_TEST:
|
| 1352 | return LYNQ_ECALL_TEST;
|
| 1353 | case LYNQ_ECALL_TYPE_RECONFIG:
|
| 1354 | return LYNQ_ECALL_RECONFIG;
|
| 1355 | default:
|
| 1356 | return LYNQ_ECALL_EMERGENCY;
|
| 1357 | }
|
| 1358 | }
|
| 1359 |
|
| 1360 | RIL_ECall_Variant lynq_get_ril_ecall_variant_from_lynq_variant(LYNQ_ECall_Variant type)
|
| 1361 | {
|
| 1362 | switch(type)
|
| 1363 | {
|
| 1364 | case LYNQ_ECALL_TEST:
|
| 1365 | return ECALL_TEST;
|
| 1366 | case LYNQ_ECALL_RECONFIG:
|
| 1367 | return ECALL_RECONFIG;
|
| 1368 | default:
|
| 1369 | return ECALL_EMERGENCY;
|
| 1370 | }
|
| 1371 | }
|
| 1372 |
|
| 1373 | RIL_ECall_Category lynq_get_ril_ecall_cat_from_lynq_cat(LYNQ_ECall_Category cat)
|
| 1374 | {
|
| 1375 | switch(cat)
|
| 1376 | {
|
| 1377 | case LYNQ_EMER_CAT_MANUAL_ECALL:
|
| 1378 | return EMER_CAT_MANUAL_ECALL;
|
| 1379 | default:
|
| 1380 | return EMER_CAT_AUTO_ECALL;
|
| 1381 | }
|
| 1382 | }
|
| 1383 |
|
| 1384 |
|
| 1385 | int lynq_set_test_num(LYNQ_ECall_Set_Type type, const char *test_num, int test_num_length)
|
| 1386 | {
|
| 1387 | int error;
|
| 1388 |
|
| 1389 | if(test_num==NULL || test_num_length > LYNQ_PHONE_NUMBER_MAX )
|
| 1390 | {
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 1391 | LYERRLOG("test_num is null or test_num_length %d s greater than %d ",test_num_length,LYNQ_PHONE_NUMBER_MAX);
|
q.huang | fe1b405 | 2022-04-18 00:09:50 -0400 | [diff] [blame] | 1392 | return -1;
|
| 1393 | }
|
| 1394 |
|
| 1395 | error=lynq_set_common_request(RIL_REQUEST_ECALL_SET_TEST_NUM,2,"%d %s",type,test_num);
|
| 1396 |
|
| 1397 | if(error==0)
|
| 1398 | {
|
| 1399 | snprintf(e_call_addr[LYNQ_ECALL_TEST],LYNQ_PHONE_NUMBER_MAX,"%s",test_num);
|
| 1400 | }
|
| 1401 |
|
| 1402 | return error;
|
| 1403 | }
|
| 1404 |
|
q.huang | 892722f | 2022-05-10 20:37:21 +0800 | [diff] [blame] | 1405 | int lynq_fast_ecall(int* handle, LYNQ_ECall_Category lynq_ecall_cat, LYNQ_ECall_Variant lynq_ecall_variant, const char *addr, int addr_length, const unsigned char *msd_data,int msd_length)
|
q.huang | fe1b405 | 2022-04-18 00:09:50 -0400 | [diff] [blame] | 1406 | {
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 1407 | int error;
|
q.huang | fe1b405 | 2022-04-18 00:09:50 -0400 | [diff] [blame] | 1408 | RIL_ECall_Variant ril_ecall_variant = lynq_get_ril_ecall_variant_from_lynq_variant (lynq_ecall_variant);
|
q.huang | 9a9b876 | 2022-04-19 05:20:12 -0400 | [diff] [blame] | 1409 | RIL_ECall_Category ril_ecall_cat = lynq_get_ril_ecall_cat_from_lynq_cat(lynq_ecall_cat);
|
q.huang | 6a11976 | 2022-05-11 20:10:38 +0800 | [diff] [blame] | 1410 | char lynq_msd_data[MSD_MAX_LENGTH*2+1]={0};
|
| 1411 | unsigned int i;
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 1412 | if(lynq_ecall_is_running())
|
q.huang | 892722f | 2022-05-10 20:37:21 +0800 | [diff] [blame] | 1413 | {
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 1414 | LYERRLOG("lynq_fast_ecall ecall is running");
|
| 1415 | return LYNQ_E_ECALL_BEING_RUNNING;
|
| 1416 | }
|
| 1417 |
|
| 1418 | if(msd_length > MSD_MAX_LENGTH || msd_length <=0)
|
| 1419 | {
|
| 1420 | LYERRLOG("lynq_fast_ecall msd_length %d is greater than %d or <= 0, parameter error",msd_length,MSD_MAX_LENGTH);
|
| 1421 | return LYNQ_E_ECALL_MSD_LENGTH_ERROR;
|
q.huang | 892722f | 2022-05-10 20:37:21 +0800 | [diff] [blame] | 1422 | }
|
q.huang | 892722f | 2022-05-10 20:37:21 +0800 | [diff] [blame] | 1423 |
|
q.huang | 6a11976 | 2022-05-11 20:10:38 +0800 | [diff] [blame] | 1424 | for(i =0; i<msd_length;i++)
|
q.huang | 892722f | 2022-05-10 20:37:21 +0800 | [diff] [blame] | 1425 | {
|
q.huang | 6a11976 | 2022-05-11 20:10:38 +0800 | [diff] [blame] | 1426 | sprintf(&(lynq_msd_data[i<<1]),"%02x",msd_data[i]);
|
q.huang | 892722f | 2022-05-10 20:37:21 +0800 | [diff] [blame] | 1427 | }
|
| 1428 |
|
q.huang | 18d08bf | 2022-04-19 20:27:44 -0400 | [diff] [blame] | 1429 |
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 1430 | LYINFLOG("lynq_fast_ecall addr is %s",e_call_addr[lynq_ecall_variant]);
|
q.huang | 18d08bf | 2022-04-19 20:27:44 -0400 | [diff] [blame] | 1431 |
|
q.huang | 892722f | 2022-05-10 20:37:21 +0800 | [diff] [blame] | 1432 | error=lynq_set_common_request(RIL_REQUEST_ECALL_FAST_MAKE_ECALL,4,"%d %d %s %s",ril_ecall_cat, ril_ecall_variant, "null", lynq_msd_data);
|
q.huang | fe1b405 | 2022-04-18 00:09:50 -0400 | [diff] [blame] | 1433 |
|
| 1434 | if(error==0)
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 1435 | {
|
| 1436 | is_ecall_dial = 1;
|
| 1437 | if(waitCallstateChange(180000)==ETIMEDOUT)//180000ms
|
q.huang | fe1b405 | 2022-04-18 00:09:50 -0400 | [diff] [blame] | 1438 | {
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 1439 | LYERRLOG("lynq_fast_ecall timeout:wait Call state time out!!!");
|
| 1440 | is_ecall_dial = 0;
|
| 1441 | lynqRespWatingEvent();
|
| 1442 | return LYNQ_E_TIME_OUT;
|
q.huang | fe1b405 | 2022-04-18 00:09:50 -0400 | [diff] [blame] | 1443 | }
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 1444 | is_ecall_dial = 0;
|
| 1445 | lynqRespWatingEvent();
|
q.huang | 18d08bf | 2022-04-19 20:27:44 -0400 | [diff] [blame] | 1446 |
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 1447 | if(g_ecallId != INVALID_ID)
|
| 1448 | {
|
| 1449 | *handle=g_ecallId;
|
| 1450 | LYINFLOG("lynq_fast_ecall id is %d",g_ecallId);
|
| 1451 | return 0;
|
| 1452 | }
|
| 1453 | else
|
| 1454 | {
|
| 1455 | LYERRLOG("lynq_fast_ecall service return fail");
|
| 1456 | return LYNQ_E_INVALID_ID_ANONALY;
|
| 1457 | }
|
q.huang | fe1b405 | 2022-04-18 00:09:50 -0400 | [diff] [blame] | 1458 | }
|
| 1459 |
|
| 1460 | return error;
|
| 1461 | }
|
| 1462 |
|
| 1463 | int lynq_set_psap(int enable)
|
| 1464 | {
|
| 1465 | return lynq_set_common_request(RIL_REQUEST_ECALL_SET_PSAP,1,"%d",enable);
|
| 1466 | }
|
| 1467 |
|
| 1468 | int lynq_psap_pull_msd()
|
| 1469 | {
|
| 1470 | return lynq_set_common_request(RIL_REQUEST_ECALL_PSAP_PULL_MSD,0,"");
|
| 1471 | }
|
| 1472 |
|
| 1473 | int lynq_make_ecall(int* handle, LYNQ_ECall_Type type)
|
| 1474 | {
|
| 1475 | LYNQ_ECall_Variant lynq_ecall_variant;
|
| 1476 | int error = -1;
|
| 1477 | int lynq_call_id = -1;
|
| 1478 |
|
| 1479 | if(handle==NULL)
|
| 1480 | {
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 1481 | LYERRLOG("handle is NULL, parameter error ");
|
q.huang | fe1b405 | 2022-04-18 00:09:50 -0400 | [diff] [blame] | 1482 | return -1;
|
| 1483 | }
|
| 1484 |
|
| 1485 | error=lynq_set_common_request(RIL_REQUEST_ECALL_MAKE_ECALL,1,"%d",type);
|
| 1486 |
|
| 1487 | if(error==0)
|
| 1488 | {
|
| 1489 | lynq_ecall_variant=lynq_get_lynq_ecall_variant_from_lynq_type(type);
|
| 1490 |
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 1491 | lynq_call_id = addAddr(e_call_addr[lynq_ecall_variant]);
|
q.huang | fe1b405 | 2022-04-18 00:09:50 -0400 | [diff] [blame] | 1492 | isDial = 1;
|
| 1493 | if(waitCallstateChange(10000)==ETIMEDOUT)//10000ms
|
| 1494 | {
|
| 1495 | error = LYNQ_E_TIME_OUT;
|
| 1496 | LYERRLOG("timeout:wait Call state fail!!!");
|
q.huang | fe1b405 | 2022-04-18 00:09:50 -0400 | [diff] [blame] | 1497 | return error;
|
| 1498 | }
|
| 1499 |
|
| 1500 | *handle = lynq_call_id;
|
| 1501 | }
|
| 1502 |
|
| 1503 | return error;
|
| 1504 | }
|
| 1505 |
|
| 1506 |
|
q.huang | bd6a306 | 2022-05-10 20:49:46 +0800 | [diff] [blame] | 1507 | int lynq_set_msd(int* handle, const unsigned char *msd_data, int msd_length)
|
q.huang | fe1b405 | 2022-04-18 00:09:50 -0400 | [diff] [blame] | 1508 | {
|
q.huang | 6a11976 | 2022-05-11 20:10:38 +0800 | [diff] [blame] | 1509 | char lynq_msd_data[MSD_MAX_LENGTH*2+1]={0};
|
| 1510 | unsigned int i;
|
| 1511 |
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 1512 | if(handle==NULL || ((*handle) >= LYNQ_CALL_MAX) || msd_length > MSD_MAX_LENGTH || msd_length == 0 || msd_data ==NULL)
|
q.huang | fe1b405 | 2022-04-18 00:09:50 -0400 | [diff] [blame] | 1513 | {
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 1514 | LYERRLOG("lynq_set_msd handle is NULL or *handle %d is greater or equeal to %d or msd_length %d is greater than %d or msd_data %s is NULL, parameter error",*handle,LYNQ_CALL_MAX,msd_length,MSD_MAX_LENGTH, msd_data);
|
q.huang | bd6a306 | 2022-05-10 20:49:46 +0800 | [diff] [blame] | 1515 | return -1;
|
| 1516 | }
|
q.huang | bd6a306 | 2022-05-10 20:49:46 +0800 | [diff] [blame] | 1517 |
|
q.huang | 6a11976 | 2022-05-11 20:10:38 +0800 | [diff] [blame] | 1518 | for(i=0; i<msd_length;i++)
|
q.huang | bd6a306 | 2022-05-10 20:49:46 +0800 | [diff] [blame] | 1519 | {
|
q.huang | 6a11976 | 2022-05-11 20:10:38 +0800 | [diff] [blame] | 1520 | sprintf(&(lynq_msd_data[i<<1]),"%02x",msd_data[i]);
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 1521 | }
|
| 1522 |
|
| 1523 | LYINFLOG("lynq_set_msd ");
|
q.huang | fe1b405 | 2022-04-18 00:09:50 -0400 | [diff] [blame] | 1524 |
|
q.huang | bd6a306 | 2022-05-10 20:49:46 +0800 | [diff] [blame] | 1525 | return lynq_set_common_request(RIL_REQUEST_ECALL_SET_MSD,2,"%d %s",lynq_call_lists[(*handle)].call_id,lynq_msd_data);
|
q.huang | fe1b405 | 2022-04-18 00:09:50 -0400 | [diff] [blame] | 1526 | }
|
| 1527 |
|
| 1528 | int lynq_set_ivs(int enable)
|
| 1529 | {
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 1530 | if(enable<0)
|
| 1531 | {
|
| 1532 | lynq_set_common_request(RIL_REQUEST_ECALL_SET_IVS,1,"%d",enable);
|
| 1533 | return 0;
|
| 1534 | }
|
| 1535 |
|
| 1536 | return lynq_set_common_request(RIL_REQUEST_ECALL_SET_IVS,1,"%d",enable);
|
q.huang | fe1b405 | 2022-04-18 00:09:50 -0400 | [diff] [blame] | 1537 | }
|
| 1538 |
|
| 1539 | int lynq_reset_ivs()
|
| 1540 | {
|
| 1541 | return lynq_set_common_request(RIL_REQUEST_ECALL_RESET_IVS,0,"");
|
| 1542 | }
|
| 1543 |
|
| 1544 | int lynq_ivs_push_msd()
|
| 1545 | {
|
| 1546 | return lynq_set_common_request(RIL_REQUEST_ECALL_IVS_PUSH_MSD,0,"");
|
| 1547 | }
|
q.huang | 18d08bf | 2022-04-19 20:27:44 -0400 | [diff] [blame] | 1548 |
|
| 1549 | int wait_ecall_event()
|
| 1550 | {
|
| 1551 | int ret = 0;
|
| 1552 | pthread_mutex_lock(&s_incoming_e_call_mutex);
|
| 1553 | ret = pthread_cond_wait(&s_incoming_e_call_cond,&s_incoming_e_call_mutex);
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 1554 | pthread_mutex_unlock(&s_incoming_e_call_mutex);
|
q.huang | 18d08bf | 2022-04-19 20:27:44 -0400 | [diff] [blame] | 1555 | return ret;
|
| 1556 | }
|
| 1557 |
|
| 1558 | int lynq_wait_ecall_indication(LYNQ_ECall_Indication *eCall_Indication)
|
| 1559 | {
|
| 1560 | wait_ecall_event();
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 1561 | *eCall_Indication = g_lynqIncomingEcallIndication;
|
| 1562 | LYINFLOG("lynq_wait_ecall_indication id: %d",g_lynqIncomingEcallIndication);
|
q.huang | 18d08bf | 2022-04-19 20:27:44 -0400 | [diff] [blame] | 1563 | return 0;
|
| 1564 | }
|
| 1565 |
|
q.huang | fe1b405 | 2022-04-18 00:09:50 -0400 | [diff] [blame] | 1566 | #endif
|
| 1567 |
|
q.huang | 877d6b3 | 2022-06-06 16:15:31 +0800 | [diff] [blame^] | 1568 | /*Audio Path setting begin*/
|
| 1569 | /*set*/
|
| 1570 | int lynq_set_voice_audio_mode(const LYNQ_Audio_Mode audio_mode)
|
| 1571 | {
|
| 1572 | return 0;
|
| 1573 | }
|
| 1574 | int lynq_set_rtp_ip(const LYNQ_Rtp_Mode rtp_mode,const char* ip, const int ip_length)
|
| 1575 | {
|
| 1576 | return 0;
|
| 1577 | }
|
| 1578 | int lynq_set_rtp_port(const int port)
|
| 1579 | {
|
| 1580 | return 0;
|
| 1581 | }
|
| 1582 | int lynq_set_rtp_param(const int clock_rate,const int channels,const int latency) //only for client mode
|
| 1583 | {
|
| 1584 | return 0;
|
| 1585 | }
|
| 1586 | /*get*/
|
| 1587 | LYNQ_Audio_Mode lynq_get_voice_audio_mode()
|
| 1588 | {
|
| 1589 | return AUDIO_MODE_CODEC;
|
| 1590 | }
|
| 1591 | int lynq_get_rtp_ip(const LYNQ_Rtp_Mode rtp_mode, char* ip, const int ip_length)
|
| 1592 | {
|
| 1593 | if(ip==NULL)
|
| 1594 | {
|
| 1595 | return 1;
|
| 1596 | }
|
| 1597 | return 0;
|
| 1598 | }
|
| 1599 | int lynq_get_rtp_port(const LYNQ_Rtp_Mode rtp_mode, int* port)
|
| 1600 | {
|
| 1601 | if(port==NULL)
|
| 1602 | {
|
| 1603 | return 1;
|
| 1604 | }
|
| 1605 | return 0;
|
| 1606 | }
|
| 1607 | int lynq_get_rtp_param(int* clock_rate, int* channels, int* latency)//only for client mode
|
| 1608 | {
|
| 1609 | if(clock_rate == NULL || channels ==NULL || latency ==NULL)
|
| 1610 | {
|
| 1611 | return 1;
|
| 1612 | }
|
| 1613 |
|
| 1614 | return 0;
|
| 1615 | }
|
| 1616 | /*Audio Path setting end*/
|
| 1617 |
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 1618 | #if 0
|
| 1619 | int main(int argc,char **argv)
|
| 1620 | {
|
| 1621 | int n = 0;
|
| 1622 | n = lynq_init_call(lynq_call_state_change_test,2222);
|
| 1623 | if(n<0)
|
| 1624 | {
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 1625 | LYDBGLOG("lynq init call fail!!!");
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 1626 | return -1;
|
| 1627 | }
|
q.huang | 783ed5d | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 1628 | LYDBGLOG("lynq call init success!!!");
|
lh | 2582795 | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 1629 | char phoneNum[LYNQ_PHONE_NUMBER_MAX];
|
| 1630 | sprintf(phoneNum,"18180053406 0",strlen("18180053406 0")+1);
|
| 1631 | lynq_call(phoneNum);
|
| 1632 | while(1)
|
| 1633 | {
|
| 1634 | sleep(1);
|
| 1635 | }
|
| 1636 | return 0;
|
| 1637 | }
|
| 1638 | #endif
|
| 1639 | /*Warren add for T800 platform 2021/11/19 end*/
|