ll | 630be41 | 2022-07-25 05:52:14 +0000 | [diff] [blame] | 1 |
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 2 | #include <stdio.h>
|
| 3 | #include <sys/types.h>
|
| 4 | #include <sys/socket.h>
|
| 5 | #include <arpa/inet.h>
|
| 6 | #include <fcntl.h>
|
| 7 | #include <string.h>
|
| 8 | #include <stdlib.h>
|
| 9 | #include <unistd.h>
|
| 10 | #include <binder/Parcel.h>
|
| 11 | #include <log/log.h>
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 12 | #include <cutils/jstring.h>
|
| 13 | #include <pthread.h>
|
| 14 | #include "liblog/lynq_deflog.h"
|
lh | 2afc773 | 2022-01-10 02:24:31 -0800 | [diff] [blame] | 15 | #include <sys/time.h>
|
lh | 21502f5 | 2022-01-27 00:27:12 -0800 | [diff] [blame] | 16 | #include <string.h>
|
q.huang | 714145d | 2022-04-18 00:09:50 -0400 | [diff] [blame] | 17 | #include <vendor-ril/telephony/ril.h>
|
| 18 | #include <vendor-ril/telephony/mtk_ril_sp.h>
|
| 19 | #include <vendor-ril/telephony/mtk_ril_ivt.h>
|
| 20 | #include "lynq_call.h"
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 21 | #include "lynq_module_common.h"
|
| 22 | #include "lynq_module_socket.h"
|
| 23 | #include "lynq_call_common.h"
|
q.huang | 714145d | 2022-04-18 00:09:50 -0400 | [diff] [blame] | 24 |
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 25 | #define CALL_OFF (0)
|
| 26 | #define CALL_ON (1)
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 27 | #define USER_LOG_TAG "LYNQ_CALL"
|
| 28 |
|
| 29 | using ::android::Parcel;
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 30 |
|
| 31 | /**
|
| 32 | * @brief mark call initialization state
|
| 33 | * 0: deinit state
|
| 34 | * 1: init state
|
| 35 | */
|
| 36 | int g_module_init_flag = 0;
|
| 37 |
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 38 | typedef enum {
|
| 39 | LYNQ_CALL_ACTIVE = 0,
|
| 40 | LYNQ_CALL_HOLDING = 1,
|
| 41 | LYNQ_CALL_DIALING = 2, /* MO call only */
|
| 42 | LYNQ_CALL_ALERTING = 3, /* MO call only */
|
| 43 | LYNQ_CALL_INCOMING = 4, /* MT call only */
|
lh | e45b700 | 2022-04-26 00:45:44 -0700 | [diff] [blame] | 44 | LYNQ_CALL_WAITING = 5, /* MT call only */
|
| 45 | /*warren add for T800 platform 2022/04/26 start*/
|
| 46 | LYNQ_CALL_END = 6, /*CALL END*/
|
| 47 | /*warren add for T800 platform 2022/04/26 end*/
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 48 | }lynq_call_state_t;
|
| 49 |
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 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 | 7b0674a | 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 |
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 68 | static lynq_call_list_e_t s_call_lists[LYNQ_CALL_MAX]={};
|
| 69 | static bool s_call_list_loop = 0;
|
| 70 | static pthread_t s_call_list_loop_tid = -1;
|
| 71 | static pthread_mutex_t s_notice_get_call_list_mutex = PTHREAD_MUTEX_INITIALIZER;
|
| 72 | static pthread_cond_t s_notice_get_call_list_cond = PTHREAD_COND_INITIALIZER;
|
| 73 |
|
| 74 | static int s_module_isDial = 0;
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 75 | static pthread_mutex_t call_state_change_mutex = PTHREAD_MUTEX_INITIALIZER;
|
| 76 | static pthread_cond_t call_state_change_cond = PTHREAD_COND_INITIALIZER;
|
ll | b392107 | 2023-01-10 14:47:46 +0800 | [diff] [blame^] | 77 | static int s_CallId = 0;
|
| 78 | static pthread_mutex_t s_call_state_change_mutex = PTHREAD_MUTEX_INITIALIZER;
|
| 79 | static pthread_cond_t s_call_state_change_cond = PTHREAD_COND_INITIALIZER;
|
lh | ec17b0a | 2022-02-13 23:56:05 -0800 | [diff] [blame] | 80 |
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 81 | static int s_module_call_state =CALL_OFF;
|
| 82 | static int s_call_auto_answer = 0;
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 83 |
|
q.huang | ec88da9 | 2022-03-29 04:17:32 -0400 | [diff] [blame] | 84 | typedef enum{
|
| 85 | LYNQ_E_VOLUMN_SET_DTMF,
|
| 86 | LYNQ_E_VOLUMN_SET_SPEECH
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 87 | }LYNQ_E_VOLUMN_SET;
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 88 |
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 89 | #if 0
|
q.huang | 7de1d66 | 2022-09-13 14:19:24 +0800 | [diff] [blame] | 90 | int JumpHeader(Parcel &p,int *resp_type,int* token,int *request,int *slot_id,int *error)
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 91 | {
|
| 92 | if(p.dataAvail() > 0)
|
| 93 | {
|
| 94 | p.readInt32(resp_type);
|
q.huang | 7de1d66 | 2022-09-13 14:19:24 +0800 | [diff] [blame] | 95 | p.readInt32(token);
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 96 | p.readInt32(request);
|
| 97 | p.readInt32(slot_id);
|
| 98 | p.readInt32(error);
|
| 99 | return 0;
|
| 100 | }
|
| 101 | else
|
| 102 | {
|
| 103 | return -1;
|
| 104 | }
|
| 105 | }
|
| 106 | int send_request(int sockfd,lynq_client_t *client_tmp)
|
| 107 | {
|
| 108 | int ret=0;
|
rjw | 5d2a50e | 2022-02-28 15:01:49 +0800 | [diff] [blame] | 109 | ret = sendto(sockfd, client_tmp, client_size, 0, (struct sockaddr *)&addr_serv, len_addr_serv);
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 110 | if(ret==-1)
|
| 111 | {
|
q.huang | 70b7649 | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 112 | LYERRLOG("sendto error");
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 113 | return -1;
|
| 114 | }
|
| 115 | return 0;
|
| 116 | }
|
| 117 |
|
| 118 | int get_response(int sockfd,Parcel &p)
|
| 119 | {
|
| 120 | int len = 0;
|
| 121 | char recvline[LYNQ_REC_BUF];
|
| 122 | bzero(recvline,LYNQ_REC_BUF);
|
| 123 | /* receive data from server */
|
rjw | 5d2a50e | 2022-02-28 15:01:49 +0800 | [diff] [blame] | 124 | len = recvfrom(sockfd,recvline,LYNQ_REC_BUF, 0, (struct sockaddr *)&addr_serv,(socklen_t*)&len_addr_serv);
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 125 | if(len == -1)
|
| 126 | {
|
q.huang | 70b7649 | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 127 | LYERRLOG("recvfrom error");
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 128 | return -1;
|
| 129 | }
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 130 | if (recvline != NULL) {
|
| 131 | p.setData((uint8_t *)recvline,len); // p.setData((uint8_t *) buffer, buflen);
|
| 132 | p.setDataPosition(0);
|
| 133 | }
|
| 134 | return 0;
|
| 135 | }
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 136 | #endif
|
| 137 | static char *strdupReadString(Parcel* &p) {
|
ll | 04ae414 | 2022-01-27 05:54:38 +0000 | [diff] [blame] | 138 | size_t stringlen;
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 139 | const char16_t *s16;
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 140 | s16 = p->readString16Inplace(&stringlen);
|
ll | 04ae414 | 2022-01-27 05:54:38 +0000 | [diff] [blame] | 141 | return strndup16to8(s16, stringlen);
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 142 | }
|
| 143 |
|
| 144 | int lynq_get_current_call_list(lynq_call_list_t call_list[LYNQ_CALL_MAX])
|
| 145 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 146 | Parcel* p=NULL;
|
| 147 | int ret=lynq_send_common_request(p,8,RIL_REQUEST_GET_CURRENT_CALLS,0,"");
|
| 148 | if(ret!=0)
|
| 149 | {
|
| 150 | return ret;
|
| 151 | }
|
| 152 |
|
| 153 | int call_num = 0;
|
| 154 | int temp = 0;
|
| 155 | char *remote_phoneNum;
|
| 156 | char *remote_name;
|
| 157 | char uusData[128];
|
| 158 |
|
| 159 | p->readInt32(&call_num);
|
| 160 |
|
| 161 | if(call_num<=0)
|
| 162 | {
|
| 163 | s_module_call_state = CALL_OFF;
|
| 164 | LYINFLOG("lynq_call_state:%d",s_module_call_state);
|
| 165 | delete p;
|
| 166 | return RESULT_OK;
|
| 167 | }
|
| 168 | s_module_call_state = CALL_ON;
|
| 169 | LYINFLOG("lynq_call_state:%d, call num is %d ",s_module_call_state,call_num);
|
| 170 | for(int i = 0;i < call_num;i++)
|
| 171 | {
|
| 172 | p->readInt32(&temp);
|
| 173 | call_list[i].call_state = temp;
|
| 174 | p->readInt32(&call_list[i].call_id);
|
| 175 | p->readInt32(&call_list[i].toa);
|
| 176 | p->readInt32(&temp);
|
| 177 | p->readInt32(&temp);
|
| 178 | call_list[i].direction = temp;
|
| 179 | p->readInt32(&temp);
|
| 180 | p->readInt32(&temp);
|
| 181 | p->readInt32(&temp);
|
| 182 | remote_phoneNum = strdupReadString(p);
|
| 183 | memcpy(call_list[i].addr,remote_phoneNum,strlen(remote_phoneNum));
|
| 184 | if(remote_phoneNum !=NULL)
|
| 185 | {
|
| 186 | free(remote_phoneNum);
|
| 187 | }
|
| 188 | LYINFLOG("call_id=%d,call_state=%d,direction=%d,addr=%s,toa=%d",call_list[i].call_id,call_list[i].call_state,
|
| 189 | call_list[i].direction,call_list[i].addr,call_list[i].toa);
|
| 190 | p->readInt32(&temp);
|
| 191 | remote_name = strdupReadString(p);
|
| 192 | if(remote_name !=NULL)
|
| 193 | {
|
| 194 | free(remote_name);
|
| 195 | }
|
| 196 | p->readInt32(&temp);
|
| 197 | p->readInt32(&temp);
|
| 198 | if(temp==0)
|
| 199 | {
|
| 200 | continue;
|
| 201 | }
|
| 202 | p->readInt32(&temp); /* UUS Information is present */
|
| 203 | p->readInt32(&temp);
|
| 204 | p->readInt32(&temp);
|
| 205 | if(temp<=128)
|
| 206 | {
|
| 207 | p->read(uusData,temp);
|
| 208 | }
|
| 209 | else
|
| 210 | {
|
| 211 | LYERRLOG("%s len %d is too great",__func__,temp);
|
| 212 | delete p;
|
| 213 | return LYNQ_E_MALLOC_ERROR;
|
| 214 | }
|
| 215 | }
|
| 216 |
|
| 217 | delete p;
|
| 218 | return RESULT_OK;
|
| 219 |
|
| 220 | #if 0
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 221 | Parcel p;
|
| 222 | lynq_client_t client;
|
| 223 | int resp_type = -1;
|
q.huang | 7de1d66 | 2022-09-13 14:19:24 +0800 | [diff] [blame] | 224 | int token;
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 225 | int request = -1;
|
| 226 | int slot_id = -1;
|
| 227 | int error = -1;
|
| 228 | int call_num = 0;
|
| 229 | int temp = 0;
|
| 230 | char *remote_phoneNum = NULL;
|
| 231 | char *remote_name= NULL;
|
| 232 | char *uusData = NULL;
|
lh | 42c1e57 | 2022-01-25 18:47:39 -0800 | [diff] [blame] | 233 | client.uToken = Global_uToken_call;
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 234 | client.request = 9;//RIL_REQUEST_GET_CURRENT_CALLS
|
| 235 | client.paramLen = 0;
|
| 236 | bzero(client.param,LYNQ_REQUEST_PARAM_BUF);
|
q.huang | 70b7649 | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 237 | LYINFLOG("uToken=%d,request=%d,paralen=%d,param=%s",client.uToken,client.request,client.paramLen,client.param);
|
lh | 42c1e57 | 2022-01-25 18:47:39 -0800 | [diff] [blame] | 238 | if(send_request(lynq_call_client_sockfd,&client)==-1)
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 239 | {
|
| 240 | LYERRLOG("send request fail");
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 241 | return -1;
|
| 242 | }
|
lh | 42c1e57 | 2022-01-25 18:47:39 -0800 | [diff] [blame] | 243 | get_response(lynq_call_client_sockfd,p);
|
q.huang | 7de1d66 | 2022-09-13 14:19:24 +0800 | [diff] [blame] | 244 | JumpHeader(p,&resp_type,&token,&request,&slot_id,&error);
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 245 | LYINFLOG("resp_type=%d,request=%d,slot_id=%d,error_code=%d",resp_type,request,slot_id,error);
|
| 246 | if(error == 0)
|
| 247 | {
|
| 248 | p.readInt32(&call_num);
|
| 249 | global_call_count = call_num;
|
| 250 | if(call_num<=0)
|
| 251 | {
|
| 252 | lynq_call_state = CALL_OFF;
|
lh | ec17b0a | 2022-02-13 23:56:05 -0800 | [diff] [blame] | 253 | LYINFLOG("lynq_call_state:%d",lynq_call_state);
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 254 | return 0;
|
| 255 | }
|
lh | ec17b0a | 2022-02-13 23:56:05 -0800 | [diff] [blame] | 256 | lynq_call_state = CALL_ON;
|
q.huang | 70b7649 | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 257 | LYINFLOG("lynq_call_state:%d, call num is %d ",lynq_call_state,call_num);
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 258 | for(int i = 0;i < call_num;i++)
|
| 259 | {
|
| 260 | p.readInt32(&temp);
|
| 261 | call_list[i].call_state = temp;
|
| 262 | p.readInt32(&call_list[i].call_id);
|
| 263 | p.readInt32(&call_list[i].toa);
|
| 264 | p.readInt32(&temp);
|
| 265 | p.readInt32(&temp);
|
| 266 | call_list[i].direction = temp;
|
| 267 | p.readInt32(&temp);
|
| 268 | p.readInt32(&temp);
|
| 269 | p.readInt32(&temp);
|
| 270 | remote_phoneNum = strdupReadString(p);
|
| 271 | memcpy(call_list[i].addr,remote_phoneNum,strlen(remote_phoneNum));
|
| 272 | LYINFLOG("call_id=%d,call_state=%d,direction=%d,addr=%s,toa=%d",call_list[i].call_id,call_list[i].call_state,
|
| 273 | call_list[i].direction,call_list[i].addr,call_list[i].toa);
|
| 274 | p.readInt32(&temp);
|
| 275 | remote_name = strdupReadString(p);
|
| 276 | p.readInt32(&temp);
|
| 277 | p.readInt32(&temp);
|
| 278 | if(temp==0)
|
| 279 | {
|
| 280 | continue;
|
| 281 | }
|
| 282 | p.readInt32(&temp); /* UUS Information is present */
|
| 283 | p.readInt32(&temp);
|
| 284 | p.readInt32(&temp);
|
| 285 | p.read(uusData,temp);
|
| 286 | }
|
| 287 | }
|
| 288 | return 0;
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 289 | #endif
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 290 | }
|
| 291 |
|
| 292 | void cleanCallList(int lynq_call_id)
|
| 293 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 294 | LYINFLOG("cleanCall local idx is %d, id is %d",lynq_call_id,s_call_lists[lynq_call_id].call_id);
|
| 295 | s_call_lists[lynq_call_id].call_id = 0;
|
| 296 | s_call_lists[lynq_call_id].call_state = (int)LYNQ_CALL_END;
|
| 297 | s_call_lists[lynq_call_id].toa = 0;
|
| 298 | s_call_lists[lynq_call_id].direction = 0;
|
| 299 | s_call_lists[lynq_call_id].used = 0;
|
| 300 | memset(s_call_lists[lynq_call_id].addr,0,sizeof(s_call_lists[lynq_call_id].addr));
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 301 | }
|
ll | b392107 | 2023-01-10 14:47:46 +0800 | [diff] [blame^] | 302 |
|
| 303 |
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 304 | int getUnusedElement()
|
| 305 | {
|
| 306 | for(int i=0;i < LYNQ_CALL_MAX; i++)
|
| 307 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 308 | if(s_call_lists[i].used!=1)
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 309 | {
|
| 310 | return i;
|
| 311 | }
|
| 312 | }
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 313 | return INVALID_ID;
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 314 | }
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 315 | int addAddr(char addr[], int call_id)
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 316 | {
|
| 317 | int ret = 0;
|
| 318 | ret = getUnusedElement();
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 319 | memcpy(s_call_lists[ret].addr,addr,strlen(addr)+1);
|
| 320 | s_call_lists[ret].call_id=call_id;
|
| 321 | s_call_lists[ret].used = 1;
|
q.huang | 70b7649 | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 322 | LYINFLOG("add local idx is %d addr is %s",ret,addr);
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 323 | return ret;
|
| 324 | }
|
| 325 | void updateCallList(lynq_call_list_e_t *callList, int call_id,int call_state,int toa,int direction)
|
| 326 | {
|
q.huang | 70b7649 | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 327 | LYINFLOG("Update original local id is %d, new local id is %d",callList->call_id,call_id);
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 328 | callList->call_id = call_id;
|
| 329 | callList->call_state = call_state;
|
| 330 | callList->toa = toa;
|
q.huang | 70b7649 | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 331 | callList->direction = direction;
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 332 | return;
|
| 333 | }
|
ll | b392107 | 2023-01-10 14:47:46 +0800 | [diff] [blame^] | 334 |
|
| 335 | void wait_call_state()
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 336 | {
|
ll | b392107 | 2023-01-10 14:47:46 +0800 | [diff] [blame^] | 337 | LYINFLOG("call state changed");
|
| 338 | pthread_mutex_lock(&s_call_state_change_mutex);
|
| 339 | pthread_cond_wait(&s_call_state_change_cond,&s_call_state_change_mutex);
|
| 340 | pthread_mutex_unlock(&s_call_state_change_mutex);
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 341 | }
|
ll | b392107 | 2023-01-10 14:47:46 +0800 | [diff] [blame^] | 342 |
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 343 | int checkHasCall(char addr[])
|
| 344 | {
|
| 345 | for(int i = 0;i<LYNQ_CALL_MAX;i++)
|
| 346 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 347 | if(strcmp(s_call_lists[i].addr,addr)==0)
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 348 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 349 | LYINFLOG("checkHasCall addr is %s idx is %d id is %d",addr,i,s_call_lists[i].call_id);
|
| 350 | return true;
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 351 | }
|
| 352 | }
|
q.huang | 70b7649 | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 353 | LYINFLOG("checkHasCall addr is %s , no idx is found",addr);
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 354 | return false;
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 355 | }
|
lh | d1e457c | 2022-04-19 06:01:25 -0700 | [diff] [blame] | 356 | int find_call_id_with_addr(char *addr)
|
| 357 | {
|
lh | d1e457c | 2022-04-19 06:01:25 -0700 | [diff] [blame] | 358 | for(int id = 0; id < LYNQ_CALL_MAX; id++)
|
| 359 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 360 | if(s_call_lists[id].used && (strcmp(s_call_lists[id].addr,addr) == 0))
|
lh | d1e457c | 2022-04-19 06:01:25 -0700 | [diff] [blame] | 361 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 362 | LYINFLOG("find addr %s in local list, local idx is %d id is %d",addr,id,s_call_lists[id].call_id);
|
lh | d1e457c | 2022-04-19 06:01:25 -0700 | [diff] [blame] | 363 | return id;
|
| 364 | }
|
| 365 | }
|
q.huang | 70b7649 | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 366 | LYINFLOG("find addr %s in local list , not found",addr);
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 367 | return INVALID_ID;
|
lh | d1e457c | 2022-04-19 06:01:25 -0700 | [diff] [blame] | 368 | }
|
q.huang | 70b7649 | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 369 | int find_call_id_with_call_id(int call_id)
|
| 370 | {
|
| 371 | for(int id = 0; id < LYNQ_CALL_MAX; id++)
|
| 372 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 373 | if(s_call_lists[id].used && (s_call_lists[id].call_id == call_id))
|
q.huang | 70b7649 | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 374 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 375 | LYINFLOG("find id %d in local list, local idx is %d, addr is %s",call_id,id,s_call_lists[id].addr);
|
q.huang | 70b7649 | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 376 | return id;
|
| 377 | }
|
| 378 | }
|
| 379 | LYINFLOG("find id %d in local list , not found",call_id);
|
| 380 | return INVALID_ID;
|
| 381 | }
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 382 | void sendSignalToWaitCallStateChange()
|
| 383 | {
|
lh | d1e457c | 2022-04-19 06:01:25 -0700 | [diff] [blame] | 384 | LYINFLOG("send Signal To Wait Call State Change");
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 385 | pthread_mutex_lock(&call_state_change_mutex);
|
| 386 | pthread_cond_signal(&call_state_change_cond);
|
| 387 | pthread_mutex_unlock(&call_state_change_mutex);
|
| 388 | }
|
ll | b392107 | 2023-01-10 14:47:46 +0800 | [diff] [blame^] | 389 | void send_call_state_change()
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 390 | {
|
ll | b392107 | 2023-01-10 14:47:46 +0800 | [diff] [blame^] | 391 | LYINFLOG("send call state change");
|
| 392 | pthread_mutex_lock(&s_call_state_change_mutex);
|
| 393 | pthread_cond_signal(&s_call_state_change_cond);
|
| 394 | pthread_mutex_unlock(&s_call_state_change_mutex);
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 395 | }
|
| 396 |
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 397 | void cleanup_call_list_mutex(void *arg)
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 398 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 399 | pthread_mutex_unlock(&s_notice_get_call_list_mutex);
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 400 | }
|
ll | b392107 | 2023-01-10 14:47:46 +0800 | [diff] [blame^] | 401 |
|
| 402 | void update_end_state(int lynq_call_id)
|
| 403 | {
|
| 404 | LYINFLOG("update_end_state local idx is %d, id is %d",lynq_call_id,s_call_lists[lynq_call_id].call_id);
|
| 405 | s_call_lists[lynq_call_id].call_state = (int)LYNQ_CALL_END;
|
| 406 | }
|
| 407 |
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 408 | void *triggerGetCallList(void *parg)
|
ll | 04ae414 | 2022-01-27 05:54:38 +0000 | [diff] [blame] | 409 | {
|
| 410 | int ret=0;
|
lh | d1e457c | 2022-04-19 06:01:25 -0700 | [diff] [blame] | 411 | bool call_end;
|
ll | 04ae414 | 2022-01-27 05:54:38 +0000 | [diff] [blame] | 412 | lynq_call_list_t call_list[LYNQ_CALL_MAX];
|
q.huang | 8b33ed5 | 2022-04-19 20:27:44 -0400 | [diff] [blame] | 413 | int update=0;
|
q.huang | 70b7649 | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 414 | int cnt;
|
| 415 | int i,n;
|
q.huang | e97cfcf | 2022-08-29 20:04:31 +0800 | [diff] [blame] | 416 | #ifdef ECALL_SUPPORT
|
| 417 | int handupIncomingMT=0;
|
| 418 | #endif
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 419 | pthread_mutex_lock(&s_notice_get_call_list_mutex);
|
| 420 | pthread_cleanup_push(cleanup_call_list_mutex, NULL); // thread cleanup handler
|
| 421 | while(s_call_list_loop)
|
ll | 04ae414 | 2022-01-27 05:54:38 +0000 | [diff] [blame] | 422 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 423 | update=0;
|
| 424 | pthread_cond_wait(&s_notice_get_call_list_cond, &s_notice_get_call_list_mutex);
|
q.huang | 70b7649 | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 425 | LYDBGLOG("triggerGetCallList event!!!");
|
ll | 04ae414 | 2022-01-27 05:54:38 +0000 | [diff] [blame] | 426 | memset(call_list,0,sizeof(call_list));
|
| 427 | ret = lynq_get_current_call_list(call_list);
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 428 | if(ret != RESULT_OK)
|
ll | 04ae414 | 2022-01-27 05:54:38 +0000 | [diff] [blame] | 429 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 430 | LYDBGLOG("get current call list failure!!!");
|
ll | bc03533 | 2022-04-11 05:49:51 +0000 | [diff] [blame] | 431 | continue;
|
ll | 04ae414 | 2022-01-27 05:54:38 +0000 | [diff] [blame] | 432 | }
|
lh | d1e457c | 2022-04-19 06:01:25 -0700 | [diff] [blame] | 433 | LYINFLOG("++++++++++++++triggerGetCallList++++++++++++++");
|
q.huang | 70b7649 | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 434 | LYINFLOG("clear local index begin");
|
| 435 | cnt=0;
|
| 436 | for(i = 0;i < LYNQ_CALL_MAX;i++)
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 437 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 438 | if(s_call_lists[i].used ==0)
|
q.huang | 70b7649 | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 439 | {
|
| 440 | continue;
|
| 441 | }
|
| 442 | cnt++;
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 443 | LYINFLOG("local idx is %d id is %d addr is %s state is %d direction is %d",i,s_call_lists[i].call_id,s_call_lists[i].addr,s_call_lists[i].call_state,s_call_lists[i].direction);
|
q.huang | 70b7649 | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 444 |
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 445 | if(s_call_lists[i].call_id > 0)
|
lh | d1e457c | 2022-04-19 06:01:25 -0700 | [diff] [blame] | 446 | {
|
| 447 | call_end = 0;
|
q.huang | 70b7649 | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 448 | for(n = 0; n < LYNQ_CALL_MAX; n++)
|
lh | d1e457c | 2022-04-19 06:01:25 -0700 | [diff] [blame] | 449 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 450 | if(call_list[n].call_id == s_call_lists[i].call_id)
|
lh | d1e457c | 2022-04-19 06:01:25 -0700 | [diff] [blame] | 451 | {
|
| 452 | call_end = 1;
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 453 | LYINFLOG("find lynq call local idx %d, service idx %d id is %d!!!",i,n,s_call_lists[i].call_id);
|
q.huang | 70b7649 | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 454 | break;
|
lh | d1e457c | 2022-04-19 06:01:25 -0700 | [diff] [blame] | 455 | }
|
| 456 | }
|
| 457 | if(call_end == 0)
|
| 458 | {
|
ll | b392107 | 2023-01-10 14:47:46 +0800 | [diff] [blame^] | 459 | LYINFLOG("MT/MO hungup,then clean call info local idx is %d id is %d",i, s_call_lists[i].call_id);
|
| 460 | //update_end_state(i);//lei modify for:update end state for this call
|
| 461 | cleanCallList(i);
|
| 462 | send_call_state_change();//means mt/mo call is end
|
| 463 | //cleanCallList(i);
|
lh | d1e457c | 2022-04-19 06:01:25 -0700 | [diff] [blame] | 464 | }
|
| 465 | } //fix bug API-54
|
q.huang | 70b7649 | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 466 | else
|
| 467 | {
|
| 468 | LYINFLOG("local id is 0");
|
| 469 | }
|
| 470 | }
|
| 471 | LYINFLOG("clear local index end, local used cnt is %d", cnt);
|
| 472 |
|
| 473 | LYINFLOG("add or update local index begin ");
|
| 474 | for (i = 0;i < LYNQ_CALL_MAX;i++)
|
| 475 | {
|
| 476 | if(call_list[i].call_id==0)
|
| 477 | {
|
| 478 | break;
|
| 479 | }
|
| 480 |
|
| 481 | 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,
|
| 482 | call_list[i].direction,call_list[i].addr,call_list[i].toa);
|
| 483 |
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 484 | if(call_list[i].direction == 1)//MT call
|
| 485 | {
|
q.huang | 70b7649 | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 486 | LYINFLOG("This is a MT CALL");
|
lh | 0fd3b01 | 2022-05-13 03:02:19 -0700 | [diff] [blame] | 487 | /*MT CALL state code
|
| 488 | **LYNQ_CALL_INCOMING = 4,
|
| 489 | **LYNQ_CALL_WAITING = 5,
|
| 490 | */
|
q.huang | e97cfcf | 2022-08-29 20:04:31 +0800 | [diff] [blame] | 491 | #ifdef ECALL_SUPPORT
|
lh | 0fd3b01 | 2022-05-13 03:02:19 -0700 | [diff] [blame] | 492 | if((call_list[i].call_state ==4) || (call_list[i].call_state ==5))
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 493 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 494 | handupIncomingMT=Is_handup_IncomingMT(call_list[i].call_id);
|
q.huang | e97cfcf | 2022-08-29 20:04:31 +0800 | [diff] [blame] | 495 | LYINFLOG("handupIncomingMT is %d",handupIncomingMT);
|
| 496 | if(handupIncomingMT)
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 497 | {
|
q.huang | 70b7649 | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 498 | lynq_call_hungup(&(call_list[i].call_id));
|
| 499 | continue;
|
q.huang | e97cfcf | 2022-08-29 20:04:31 +0800 | [diff] [blame] | 500 | }
|
q.huang | 70b7649 | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 501 | }
|
q.huang | e97cfcf | 2022-08-29 20:04:31 +0800 | [diff] [blame] | 502 | #endif
|
q.huang | 70b7649 | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 503 | /*you call me, and i call you,One party failed to dial*/
|
| 504 | n = find_call_id_with_addr(call_list[i].addr);
|
| 505 | if(n ==INVALID_ID)
|
| 506 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 507 | n = addAddr(call_list[i].addr,call_list[i].call_id);
|
| 508 | updateCallList(&s_call_lists[n],call_list[i].call_id,call_list[i].call_state,call_list[i].toa,call_list[i].direction);
|
ll | b392107 | 2023-01-10 14:47:46 +0800 | [diff] [blame^] | 509 | s_CallId = call_list[i].call_id;
|
| 510 | send_call_state_change();
|
q.huang | 70b7649 | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 511 | }
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 512 | else if(s_call_lists[n].call_state == call_list[i].call_state)
|
q.huang | 70b7649 | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 513 | {
|
| 514 | LYINFLOG("state not changed, state is %d ",call_list[i].call_state);
|
| 515 | if(call_list[i].call_state ==4 || call_list[i].call_state ==5)
|
lh | d1e457c | 2022-04-19 06:01:25 -0700 | [diff] [blame] | 516 | {
|
lh | d1e457c | 2022-04-19 06:01:25 -0700 | [diff] [blame] | 517 | /*if call state not change,Maybe this call was ignored, so we need to continue to inform the user of
|
| 518 | **an incoming call until the status changes.
|
| 519 | **fix bug API-54
|
| 520 | */
|
q.huang | 70b7649 | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 521 | LYINFLOG("resend incoming call signal");
|
ll | b392107 | 2023-01-10 14:47:46 +0800 | [diff] [blame^] | 522 | send_call_state_change();
|
lh | d1e457c | 2022-04-19 06:01:25 -0700 | [diff] [blame] | 523 | }
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 524 | }
|
q.huang | 70b7649 | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 525 | else
|
ll | 72bf6c1 | 2022-03-24 10:22:25 +0800 | [diff] [blame] | 526 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 527 | LYINFLOG("state changed from %d to %d",s_call_lists[n].call_state,call_list[i].call_state);
|
q.huang | 70b7649 | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 528 |
|
ll | b392107 | 2023-01-10 14:47:46 +0800 | [diff] [blame^] | 529 | updateCallList(&s_call_lists[n],call_list[i].call_id,call_list[i].call_state,call_list[i].toa,call_list[i].direction);//update mt call
|
| 530 | }
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 531 | }
|
| 532 | else
|
q.huang | 70b7649 | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 533 | {
|
| 534 | LYINFLOG("This is a MO CALL");
|
| 535 | call_end = 0;
|
| 536 | for(n = 0 ; n < LYNQ_CALL_MAX; n++)
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 537 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 538 | if(s_call_lists[n].used && ((strcmp(call_list[i].addr,s_call_lists[n].addr)==0)||(call_list[i].call_id==s_call_lists[n].call_id)))
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 539 | {
|
ll | b392107 | 2023-01-10 14:47:46 +0800 | [diff] [blame^] | 540 | s_CallId = call_list[i].call_id;
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 541 | if(s_call_lists[n].call_id==0)
|
q.huang | 70b7649 | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 542 | {
|
ll | b392107 | 2023-01-10 14:47:46 +0800 | [diff] [blame^] | 543 | LYINFLOG("add a call id");
|
| 544 | update=1;//for send sigal
|
q.huang | 70b7649 | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 545 | }
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 546 | LYINFLOG("local idx %d updated, original call id is %d origial addr is %s original state is %d",n,s_call_lists[n].call_id,s_call_lists[n].addr,s_call_lists[n].call_state);
|
| 547 | updateCallList(&s_call_lists[n],call_list[i].call_id,call_list[i].call_state,call_list[i].toa,call_list[i].direction);
|
q.huang | 70b7649 | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 548 | call_end = 1;
|
ll | b392107 | 2023-01-10 14:47:46 +0800 | [diff] [blame^] | 549 | send_call_state_change();//means mo call is success
|
q.huang | 70b7649 | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 550 | break;
|
| 551 | }
|
| 552 | }
|
ll | b392107 | 2023-01-10 14:47:46 +0800 | [diff] [blame^] | 553 | if(call_end == 0)//1.there is no space to use 2.can't find addr in buffer 3.call_id not equal eg:when call is error return 8004/handle <= 0 will into this
|
q.huang | 70b7649 | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 554 | {
|
| 555 | LYINFLOG("need to hangup id %d", call_list[i].call_id);
|
| 556 | #ifdef ECALL_SUPPORT
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 557 | if(IsECallDialing())
|
q.huang | 70b7649 | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 558 | {
|
| 559 | LYINFLOG("ecall is dialing, for the timebeing, don't huangup");
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 560 | continue;
|
| 561 | }
|
q.huang | 70b7649 | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 562 | #endif
|
| 563 | LYINFLOG("hang up service call id %d",call_list[i].call_id);
|
| 564 | lynq_call_hungup(&(call_list[i].call_id));
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 565 | }
|
ll | b392107 | 2023-01-10 14:47:46 +0800 | [diff] [blame^] | 566 |
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 567 | }
|
q.huang | 70b7649 | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 568 | LYDBGLOG("servie idx %d end",i);
|
ll | 04ae414 | 2022-01-27 05:54:38 +0000 | [diff] [blame] | 569 | }
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 570 | LYINFLOG("add or update local index end ");
|
| 571 | if(s_module_isDial==1)
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 572 | {
|
q.huang | 70b7649 | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 573 | LYINFLOG("now is dialing");
|
| 574 | if(update==1)
|
| 575 | {
|
| 576 | LYINFLOG("find added call");
|
| 577 | sendSignalToWaitCallStateChange();
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 578 | s_module_isDial = 0;
|
q.huang | 70b7649 | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 579 | }
|
| 580 | else
|
| 581 | {
|
| 582 | LYINFLOG("not find added call");
|
| 583 | }
|
| 584 | }
|
| 585 | else
|
| 586 | {
|
| 587 | LYINFLOG("now is not dialing");
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 588 | }
|
ll | 04ae414 | 2022-01-27 05:54:38 +0000 | [diff] [blame] | 589 | }
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 590 | pthread_cleanup_pop(0);
|
| 591 | pthread_mutex_unlock(&s_notice_get_call_list_mutex);
|
ll | 04ae414 | 2022-01-27 05:54:38 +0000 | [diff] [blame] | 592 | return NULL;
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 593 | }
|
| 594 |
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 595 | void lynqNoticeGetModuleCallList()
|
ll | 04ae414 | 2022-01-27 05:54:38 +0000 | [diff] [blame] | 596 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 597 | pthread_mutex_lock(&s_notice_get_call_list_mutex);
|
| 598 | pthread_cond_signal(&s_notice_get_call_list_cond);
|
| 599 | pthread_mutex_unlock(&s_notice_get_call_list_mutex);
|
| 600 |
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 601 | }
|
| 602 |
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 603 | #if 0
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 604 | /*Warren add for T800 platform 2021/11/19 start*/
|
| 605 | int lynq_socket_client_start()
|
rjw | 5d2a50e | 2022-02-28 15:01:49 +0800 | [diff] [blame] | 606 | {
|
| 607 | #if 0
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 608 | struct sockaddr_in lynq_socket_server_addr;
|
| 609 | /* init lynq_socket_server_addr */
|
| 610 | bzero(&lynq_socket_server_addr, sizeof(lynq_socket_server_addr));
|
| 611 | lynq_socket_server_addr.sin_family = AF_INET;
|
| 612 | lynq_socket_server_addr.sin_port = htons(LYNQ_SERVICE_PORT);
|
| 613 | lynq_socket_server_addr.sin_addr.s_addr = htons(INADDR_ANY);
|
rjw | 5d2a50e | 2022-02-28 15:01:49 +0800 | [diff] [blame] | 614 |
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 615 | /*
|
| 616 | if(inet_pton(AF_INET,"127.0.0.1", &lynq_socket_server_addr.sin_addr) <= 0)
|
| 617 | {
|
q.huang | 70b7649 | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 618 | LYDBGLOG("[%s] is not a valid IPaddress", argv[1]);
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 619 | exit(1);
|
| 620 | }
|
| 621 | */
|
lh | 42c1e57 | 2022-01-25 18:47:39 -0800 | [diff] [blame] | 622 | lynq_call_client_sockfd = socket(AF_INET, SOCK_DGRAM, 0);
|
| 623 | if(connect(lynq_call_client_sockfd, (struct sockaddr *)&lynq_socket_server_addr, sizeof(lynq_socket_server_addr)) == -1)
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 624 | {
|
q.huang | 70b7649 | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 625 | LYERRLOG("connect error");
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 626 | return -1;
|
| 627 | }
|
rjw | 5d2a50e | 2022-02-28 15:01:49 +0800 | [diff] [blame] | 628 | #endif
|
| 629 | lynq_call_client_sockfd = socket(AF_INET, SOCK_DGRAM, 0);
|
| 630 | if (-1 == lynq_call_client_sockfd)
|
| 631 | {
|
| 632 | return lynq_call_client_sockfd;
|
| 633 | }
|
ll | 630be41 | 2022-07-25 05:52:14 +0000 | [diff] [blame] | 634 | struct timeval timeOut;
|
| 635 | timeOut.tv_sec = 60;
|
| 636 | timeOut.tv_usec = 0;
|
| 637 | if (setsockopt(lynq_call_client_sockfd, SOL_SOCKET, SO_RCVTIMEO, &timeOut, sizeof(timeOut)) < 0)
|
| 638 | {
|
| 639 | RLOGD("time out setting failed\n");
|
| 640 | return -1;
|
| 641 | }
|
rjw | 5d2a50e | 2022-02-28 15:01:49 +0800 | [diff] [blame] | 642 | /* 设置address */
|
| 643 | memset(&addr_serv, 0, sizeof(addr_serv));
|
| 644 | addr_serv.sin_family = AF_INET;
|
| 645 | addr_serv.sin_addr.s_addr = inet_addr(DSET_IP_ADDRESS);
|
| 646 | addr_serv.sin_port = htons(LYNQ_SERVICE_PORT);
|
| 647 | len_addr_serv = sizeof(addr_serv);
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 648 | return 0;
|
| 649 | }
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 650 |
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 651 | int lynq_socket_urc_start()
|
| 652 | {
|
| 653 | int socket_fd=0;
|
| 654 | int rt=0;
|
| 655 | int len=0;
|
| 656 | int on=1;
|
| 657 | struct sockaddr_in urc_local_addr;
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 658 | pthread_attr_t attr;
|
ll | 04ae414 | 2022-01-27 05:54:38 +0000 | [diff] [blame] | 659 | socket_fd = socket(AF_INET,SOCK_DGRAM,0);
|
ll | 04ae414 | 2022-01-27 05:54:38 +0000 | [diff] [blame] | 660 | if(socket_fd < 0)
|
| 661 | {
|
q.huang | 70b7649 | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 662 | LYERRLOG("creaet socket for udp fail");
|
ll | 04ae414 | 2022-01-27 05:54:38 +0000 | [diff] [blame] | 663 | return -1;
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 664 | }
|
| 665 | urc_local_addr.sin_family = AF_INET;
|
| 666 | urc_local_addr.sin_port = htons(LYNQ_URC_SERVICE_PORT);
|
| 667 | urc_local_addr.sin_addr.s_addr = htons(INADDR_ANY);
|
| 668 | /* Set socket to allow reuse of address and port, SO_REUSEADDR value is 2*/
|
ll | 04ae414 | 2022-01-27 05:54:38 +0000 | [diff] [blame] | 669 | rt = setsockopt(socket_fd,SOL_SOCKET,SO_REUSEADDR,&on,sizeof on);
|
| 670 | if(rt<0)
|
| 671 | {
|
q.huang | 70b7649 | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 672 | LYERRLOG("SO_REUSEADDR fail");
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 673 | return -1;
|
| 674 | }
|
| 675 | rt = bind(socket_fd ,(struct sockaddr*)&urc_local_addr, sizeof(urc_local_addr));
|
ll | 04ae414 | 2022-01-27 05:54:38 +0000 | [diff] [blame] | 676 | if (rt == -1)
|
| 677 | {
|
lh | 21502f5 | 2022-01-27 00:27:12 -0800 | [diff] [blame] | 678 | LYERRLOG("bind failed");
|
ll | 04ae414 | 2022-01-27 05:54:38 +0000 | [diff] [blame] | 679 | return -1;
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 680 | }
|
| 681 | pthread_attr_init(&attr);
|
| 682 | pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
|
lh | ec17b0a | 2022-02-13 23:56:05 -0800 | [diff] [blame] | 683 | rt = pthread_create(&lynq_call_urc_tid,&attr,thread_urc_recv,(void *)socket_fd);
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 684 | if(rt < 0)
|
| 685 | {
|
q.huang | 70b7649 | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 686 | LYERRLOG("urc loop failure!!!");
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 687 | return -1;
|
| 688 | }
|
q.huang | 70b7649 | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 689 | LYDBGLOG("urc loop success!!!");
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 690 | return 0;
|
| 691 | }
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 692 | #endif
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 693 |
|
| 694 | void lynq_call_state_change_test(int soc_id)
|
| 695 | {
|
q.huang | 70b7649 | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 696 | LYDBGLOG("call state change,sim:%d",soc_id);
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 697 | }
|
q.huang | cb7b729 | 2022-06-28 20:12:01 +0800 | [diff] [blame] | 698 |
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 699 | int lynq_start_call_list_loop()
|
| 700 | {
|
| 701 | #if 0
|
| 702 | int ret = 0;
|
| 703 | pthread_attr_t attr;
|
| 704 | pthread_attr_init(&attr);
|
| 705 | pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
|
q.huang | cb7b729 | 2022-06-28 20:12:01 +0800 | [diff] [blame] | 706 |
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 707 | s_notice_get_call_list_mutex = new pthread_mutex_t;
|
| 708 | pthread_mutex_init(s_notice_get_call_list_mutex, NULL);
|
| 709 | s_notice_get_call_list_cond = new pthread_cond_t;
|
| 710 | LYINFLOG("liulei s_notice_get_call_list_mutex\n");
|
| 711 | pthread_cond_init(s_notice_get_call_list_cond, NULL);
|
| 712 | LYINFLOG("liulei s_notice_get_call_list_cond\n");
|
| 713 | #endif
|
q.huang | cb7b729 | 2022-06-28 20:12:01 +0800 | [diff] [blame] | 714 |
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 715 | s_call_list_loop = 1;
|
| 716 | int ret = pthread_create(&s_call_list_loop_tid,/*&attr*/NULL,triggerGetCallList,NULL);
|
| 717 | if(ret < 0)
|
q.huang | cb7b729 | 2022-06-28 20:12:01 +0800 | [diff] [blame] | 718 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 719 | LYERRLOG("lynq_update_call_list_loop fail!!!");
|
ll | a8c25a8 | 2022-03-17 05:31:33 +0000 | [diff] [blame] | 720 | return -1;
|
| 721 | }
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 722 | LYINFLOG("lynq_update_call_list_loop success!!!");
|
q.huang | cb7b729 | 2022-06-28 20:12:01 +0800 | [diff] [blame] | 723 |
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 724 | memset(s_call_lists,0,sizeof(s_call_lists));
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 725 | return 0;
|
| 726 | }
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 727 |
|
| 728 | int lynq_stop_call_list_loop()
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 729 | {
|
q.huang | 70b7649 | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 730 | int ret;
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 731 | pthread_mutex_lock(&s_notice_get_call_list_mutex);
|
| 732 | s_call_list_loop = 0;
|
| 733 | ret = pthread_cancel(s_call_list_loop_tid);
|
| 734 | LYINFLOG("pthread cancel w_c_list ret = %d",ret);
|
| 735 | pthread_mutex_unlock(&s_notice_get_call_list_mutex);
|
| 736 | ret = pthread_join(s_call_list_loop_tid,NULL);
|
| 737 | LYINFLOG("pthread join w_c_list ret = %d",ret);
|
| 738 | s_call_list_loop_tid=-1;
|
| 739 | #if 0
|
| 740 | pthread_mutex_destroy(s_notice_get_call_list_mutex);
|
| 741 | pthread_cond_destroy(s_notice_get_call_list_cond);
|
| 742 | delete s_notice_get_call_list_mutex;
|
| 743 | //s_notice_get_call_list_mutex = NULL;
|
| 744 | delete s_notice_get_call_list_cond;
|
| 745 | //s_notice_get_call_list_cond = NULL;
|
| 746 | #endif
|
| 747 |
|
| 748 | return 0;
|
rita | 98e2e9c | 2022-04-07 06:08:13 -0400 | [diff] [blame] | 749 | }
|
q.huang | 714145d | 2022-04-18 00:09:50 -0400 | [diff] [blame] | 750 |
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 751 | int lynq_init_call(int utoken){
|
| 752 | if(g_module_init_flag != MODULE_CLOSED)
|
| 753 | {
|
| 754 | LYERRLOG("module state is %d",g_module_init_flag);
|
| 755 | return LYNQ_E_CONFLICT;
|
| 756 | }
|
| 757 | if(utoken <0){
|
| 758 | LYERRLOG("utoken is less than 0",utoken);
|
| 759 | return LYNQ_E_PARAMETER_ANONALY;
|
| 760 | }
|
| 761 | g_module_init_flag = MODULE_SWITCHING;
|
| 762 |
|
| 763 | LYLOGSET(LOG_INFO);
|
| 764 | LYLOGEINIT(USER_LOG_TAG);
|
| 765 |
|
| 766 | g_module_Global_uToken = utoken;
|
| 767 |
|
q.huang | 036b6cf | 2023-01-10 14:29:20 +0800 | [diff] [blame] | 768 | int ret = lynq_start_all_urc_socket_thread();
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 769 | if(ret != RESULT_OK)
|
| 770 | {
|
| 771 | LYERRLOG("init socket urc fail!!!");
|
| 772 | g_module_init_flag = MODULE_CLOSED;
|
| 773 | return LYNQ_E_INNER_ERROR;
|
| 774 | }
|
| 775 |
|
q.huang | 036b6cf | 2023-01-10 14:29:20 +0800 | [diff] [blame] | 776 | ret = lynq_start_all_rc_socket_thread();
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 777 | if(ret !=RESULT_OK)
|
| 778 | {
|
| 779 | LYERRLOG("init socket client fail!!!");
|
q.huang | 036b6cf | 2023-01-10 14:29:20 +0800 | [diff] [blame] | 780 | lynq_close_all_urc_socket_thread();
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 781 | g_module_init_flag = MODULE_CLOSED;
|
| 782 | return LYNQ_E_INNER_ERROR;
|
| 783 | }
|
| 784 |
|
| 785 |
|
| 786 | int result = lynq_start_call_list_loop();
|
| 787 | if(ret != RESULT_OK)
|
| 788 | {
|
| 789 | LYERRLOG("lynq_start_call_list_loop fail!!!");
|
q.huang | 036b6cf | 2023-01-10 14:29:20 +0800 | [diff] [blame] | 790 | lynq_close_all_urc_socket_thread();
|
| 791 | lynq_close_all_rc_socket_thread();
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 792 | g_module_init_flag = MODULE_CLOSED;
|
| 793 | return LYNQ_E_INNER_ERROR;
|
| 794 | }
|
| 795 |
|
| 796 | lynq_init_rtp();
|
| 797 |
|
| 798 | g_module_init_flag = MODULE_RUNNING;
|
| 799 | return 0;
|
| 800 | }
|
| 801 |
|
| 802 | int lynq_deinit_call(void){
|
| 803 |
|
| 804 | if (g_module_init_flag != MODULE_RUNNING)
|
| 805 | {
|
| 806 | LYERRLOG("module state is %d",g_module_init_flag);
|
| 807 | return LYNQ_E_CONFLICT;
|
| 808 | }
|
| 809 | lynq_call_hungup_all();
|
| 810 | lynq_set_voice_audio_mode(AUDIO_MODE_CODEC);
|
| 811 | g_module_init_flag = MODULE_SWITCHING;
|
q.huang | 036b6cf | 2023-01-10 14:29:20 +0800 | [diff] [blame] | 812 | lynq_close_all_urc_socket_thread();
|
| 813 | lynq_close_all_rc_socket_thread();
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 814 | lynq_stop_call_list_loop();
|
| 815 | g_module_init_flag = MODULE_CLOSED;
|
| 816 | return 0;
|
| 817 | }
|
| 818 |
|
| 819 | #if 0
|
q.huang | 714145d | 2022-04-18 00:09:50 -0400 | [diff] [blame] | 820 | int lynq_set_common_request(int request_id, int argc, const char* format,...)
|
rita | 089527e | 2022-04-07 01:55:39 -0400 | [diff] [blame] | 821 | {
|
| 822 | Parcel p;
|
| 823 | lynq_client_t client;
|
| 824 | int resp_type = -1;
|
q.huang | 7de1d66 | 2022-09-13 14:19:24 +0800 | [diff] [blame] | 825 | int token;
|
rita | 089527e | 2022-04-07 01:55:39 -0400 | [diff] [blame] | 826 | int request = -1;
|
| 827 | int slot_id = -1;
|
| 828 | int error = -1;
|
rita | 089527e | 2022-04-07 01:55:39 -0400 | [diff] [blame] | 829 |
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 830 | Parcel* p=NULL;
|
| 831 | int ret=lynq_send_common_request(request_id,5,p,argc,format,...);
|
| 832 | if(ret==RESULT_OK)
|
| 833 | {
|
| 834 | delete p;
|
| 835 | }
|
| 836 | return ret;
|
| 837 |
|
rita | 089527e | 2022-04-07 01:55:39 -0400 | [diff] [blame] | 838 | client.uToken = Global_uToken_call;
|
q.huang | 714145d | 2022-04-18 00:09:50 -0400 | [diff] [blame] | 839 | client.request = request_id;
|
| 840 | client.paramLen = argc;
|
rita | 089527e | 2022-04-07 01:55:39 -0400 | [diff] [blame] | 841 | bzero(client.param,LYNQ_REQUEST_PARAM_BUF);
|
q.huang | 714145d | 2022-04-18 00:09:50 -0400 | [diff] [blame] | 842 | if(argc!=0)
|
| 843 | {
|
| 844 | va_list args;
|
| 845 | va_start(args, format);
|
| 846 | vsnprintf(client.param, LYNQ_REQUEST_PARAM_BUF, format, args);
|
| 847 | va_end(args);
|
| 848 | }
|
q.huang | 70b7649 | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 849 | LYINFLOG("uToken=%d,request=%d,paralen=%d,param=%s",client.uToken,client.request,client.paramLen,client.param);
|
rita | 089527e | 2022-04-07 01:55:39 -0400 | [diff] [blame] | 850 | if(send_request(lynq_call_client_sockfd,&client)==-1)
|
| 851 | {
|
| 852 | LYERRLOG("send request fail");
|
| 853 | return -1;
|
| 854 | }
|
q.huang | 714145d | 2022-04-18 00:09:50 -0400 | [diff] [blame] | 855 | if(get_response(lynq_call_client_sockfd,p)==0)
|
| 856 | {
|
q.huang | 7de1d66 | 2022-09-13 14:19:24 +0800 | [diff] [blame] | 857 | JumpHeader(p,&resp_type,&token,&request,&slot_id,&error);
|
q.huang | 714145d | 2022-04-18 00:09:50 -0400 | [diff] [blame] | 858 | LYINFLOG("resp_type=%d,request=%d,slot_id=%d,error_code=%d",resp_type,request,slot_id,error);
|
| 859 | }
|
rita | 089527e | 2022-04-07 01:55:39 -0400 | [diff] [blame] | 860 | return error;
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 861 |
|
| 862 |
|
rita | 089527e | 2022-04-07 01:55:39 -0400 | [diff] [blame] | 863 | }
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 864 | #endif
|
rita | 089527e | 2022-04-07 01:55:39 -0400 | [diff] [blame] | 865 |
|
q.huang | 714145d | 2022-04-18 00:09:50 -0400 | [diff] [blame] | 866 | int lynq_get_common_request(int request_id, int* status)
|
rita | 089527e | 2022-04-07 01:55:39 -0400 | [diff] [blame] | 867 | {
|
q.huang | 714145d | 2022-04-18 00:09:50 -0400 | [diff] [blame] | 868 | if(status==NULL)
|
| 869 | {
|
| 870 | LYERRLOG("status is null");
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 871 | return LYNQ_E_PARAMETER_ANONALY;
|
q.huang | 714145d | 2022-04-18 00:09:50 -0400 | [diff] [blame] | 872 | }
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 873 |
|
| 874 | Parcel* p=NULL;
|
| 875 | int ret=lynq_send_common_request(p,g_wait_time,request_id,0,"");
|
| 876 | if(ret==RESULT_OK)
|
rita | 089527e | 2022-04-07 01:55:39 -0400 | [diff] [blame] | 877 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 878 | p->readInt32(status);
|
| 879 | delete p;
|
rita | 089527e | 2022-04-07 01:55:39 -0400 | [diff] [blame] | 880 | }
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 881 | return ret;
|
| 882 | }
|
| 883 |
|
| 884 | int waitCallstateChange(int mtime)
|
| 885 | {
|
| 886 | LYINFLOG("wait Call state Change");
|
| 887 | int ret = 0;
|
| 888 | int sec = 0;
|
| 889 | int usec = 0;
|
| 890 | struct timeval now;
|
| 891 | struct timespec timeout;
|
| 892 | gettimeofday(&now,NULL);
|
| 893 | sec = mtime/1000;
|
| 894 | usec = mtime%1000;
|
| 895 | timeout.tv_sec = now.tv_sec+sec;
|
| 896 | timeout.tv_nsec = now.tv_usec*1000+usec*1000000;
|
| 897 | pthread_mutex_lock(&call_state_change_mutex);
|
| 898 | ret = pthread_cond_timedwait(&call_state_change_cond,&call_state_change_mutex,&timeout);
|
| 899 | pthread_mutex_unlock(&call_state_change_mutex);
|
| 900 | return ret;
|
| 901 | }
|
| 902 |
|
| 903 | int IsNormalCallDailing()
|
| 904 | {
|
| 905 | return s_module_isDial;
|
rita | 089527e | 2022-04-07 01:55:39 -0400 | [diff] [blame] | 906 | }
|
| 907 |
|
ll | b392107 | 2023-01-10 14:47:46 +0800 | [diff] [blame^] | 908 |
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 909 | int lynq_call(int* handle,char addr[])
|
| 910 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 911 | if(g_module_init_flag != MODULE_RUNNING)
|
ll | 27dbe75 | 2022-08-10 00:33:52 -0700 | [diff] [blame] | 912 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 913 | LYERRLOG("%s module state %d error",__func__,g_module_init_flag);
|
| 914 | return LYNQ_E_CONFLICT;
|
ll | 27dbe75 | 2022-08-10 00:33:52 -0700 | [diff] [blame] | 915 | }
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 916 |
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 917 | int lynq_call_id = -1;
|
q.huang | 70b7649 | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 918 |
|
| 919 | LYINFLOG("lynq_call begin addr %s",addr);
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 920 | if(addr==NULL)
|
| 921 | {
|
| 922 | LYERRLOG("Phone num is null!!!");
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 923 | return LYNQ_E_PARAMETER_ANONALY;
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 924 | }
|
q.huang | 70b7649 | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 925 |
|
| 926 | if(find_call_id_with_addr(addr)!=INVALID_ID)
|
| 927 | {
|
| 928 | LYERRLOG("addr %s exists",addr);
|
| 929 | return LYNQ_E_CONFLICT;
|
| 930 | }
|
| 931 |
|
| 932 | #ifdef ECALL_SUPPORT
|
| 933 | if(lynq_ecall_is_running())
|
| 934 | {
|
| 935 | LYERRLOG("lynq_fast_ecall ecall is running");
|
| 936 | return LYNQ_E_ECALL_BEING_RUNNING;
|
| 937 | }
|
| 938 | #endif
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 939 | Parcel* p=NULL;
|
| 940 | lynq_call_id = addAddr(addr,0);
|
| 941 | int ret=lynq_send_common_request(p,g_wait_time,RIL_REQUEST_DIAL,2,"%s %d",addr, 0);
|
| 942 | if(ret!=0)
|
| 943 | {
|
ll | b392107 | 2023-01-10 14:47:46 +0800 | [diff] [blame^] | 944 | cleanCallList(lynq_call_id);
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 945 | return ret;
|
ll | b392107 | 2023-01-10 14:47:46 +0800 | [diff] [blame^] | 946 | }
|
| 947 | delete p;
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 948 | s_module_isDial = 1;
|
| 949 | if(waitCallstateChange(6000)==ETIMEDOUT)//6000ms
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 950 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 951 | //if timeout,this call need destroy.
|
| 952 | s_module_isDial = 0;
|
| 953 | LYERRLOG("lynq_call timeout:wait Call state fail!!! clear local idx %d",lynq_call_id);
|
ll | b392107 | 2023-01-10 14:47:46 +0800 | [diff] [blame^] | 954 | cleanCallList(lynq_call_id);
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 955 | return LYNQ_E_TIME_OUT;
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 956 | }
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 957 | s_module_isDial = 0;
|
| 958 | *handle = s_call_lists[lynq_call_id].call_id;
|
| 959 | if(*handle > 0)
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 960 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 961 | LYINFLOG("lynq_call dial addr %s suc, id is %d",addr,*handle);
|
| 962 | return RESULT_OK;
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 963 | }
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 964 | else
|
| 965 | {
|
| 966 | LYERRLOG("lynq_call dial addr %s fail, invalid id",addr);
|
| 967 | cleanCallList(lynq_call_id);
|
| 968 | return LYNQ_E_INVALID_ID_ANONALY;
|
ll | b392107 | 2023-01-10 14:47:46 +0800 | [diff] [blame^] | 969 | }
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 970 | }
|
ll | b392107 | 2023-01-10 14:47:46 +0800 | [diff] [blame^] | 971 |
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 972 | int lynq_call_answer()
|
| 973 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 974 | if(g_module_init_flag != MODULE_RUNNING)
|
ll | 27dbe75 | 2022-08-10 00:33:52 -0700 | [diff] [blame] | 975 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 976 | LYERRLOG("%s module state %d error",__func__,g_module_init_flag);
|
| 977 | return LYNQ_E_CONFLICT;
|
| 978 | }
|
| 979 |
|
| 980 | Parcel* p=NULL;
|
| 981 | int ret=lynq_send_common_request(p,g_wait_time,RIL_REQUEST_ANSWER,0,"");
|
| 982 | if(ret==RESULT_OK)
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 983 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 984 | delete p;
|
| 985 | }
|
| 986 | return ret;
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 987 | }
|
ll | b392107 | 2023-01-10 14:47:46 +0800 | [diff] [blame^] | 988 |
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 989 | int lynq_call_hungup(int* handle)
|
| 990 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 991 | if(g_module_init_flag != MODULE_RUNNING)
|
ll | 27dbe75 | 2022-08-10 00:33:52 -0700 | [diff] [blame] | 992 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 993 | return LYNQ_E_CONFLICT;
|
| 994 | }
|
| 995 |
|
lh | 42c1e57 | 2022-01-25 18:47:39 -0800 | [diff] [blame] | 996 | if(handle==NULL||!((*handle>=0)&&(*handle<10)))
|
| 997 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 998 | LYERRLOG("%s illegal input!!!!",__func__);
|
| 999 | return LYNQ_E_PARAMETER_ANONALY;
|
lh | 42c1e57 | 2022-01-25 18:47:39 -0800 | [diff] [blame] | 1000 | }
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 1001 |
|
| 1002 | int call_id = *handle;
|
| 1003 | Parcel* p=NULL;
|
| 1004 | int ret=lynq_send_common_request(p,g_wait_time,RIL_REQUEST_HANGUP,1,"%d",call_id);
|
| 1005 | if(ret!=0)
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 1006 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 1007 | return ret;
|
| 1008 | }
|
| 1009 | delete p;
|
| 1010 |
|
| 1011 | int lynq_call_id=find_call_id_with_call_id(call_id);
|
| 1012 | if(lynq_call_id!=INVALID_ID)
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 1013 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 1014 | cleanCallList(lynq_call_id);
|
| 1015 | }
|
| 1016 |
|
| 1017 | return RESULT_OK;
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 1018 | }
|
| 1019 | int lynq_call_hungup_all()
|
| 1020 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 1021 | if(g_module_init_flag != MODULE_RUNNING)
|
ll | 27dbe75 | 2022-08-10 00:33:52 -0700 | [diff] [blame] | 1022 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 1023 | LYERRLOG("%s module state %d error",__func__,g_module_init_flag);
|
| 1024 | return LYNQ_E_CONFLICT;
|
ll | 27dbe75 | 2022-08-10 00:33:52 -0700 | [diff] [blame] | 1025 | }
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 1026 |
|
| 1027 | Parcel* p=NULL;
|
| 1028 | int ret=lynq_send_common_request(p,g_wait_time,RIL_REQUEST_UDUB,0,"");
|
| 1029 | if(ret==RESULT_OK)
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 1030 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 1031 | delete p;
|
| 1032 | }
|
| 1033 | return ret;
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 1034 | }
|
ll | b392107 | 2023-01-10 14:47:46 +0800 | [diff] [blame^] | 1035 |
|
| 1036 | int lynq_wait_call_state_change(int *handle)
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 1037 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 1038 | if(g_module_init_flag != MODULE_RUNNING)
|
ll | 27dbe75 | 2022-08-10 00:33:52 -0700 | [diff] [blame] | 1039 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 1040 | LYERRLOG("%s module state %d error",__func__,g_module_init_flag);
|
| 1041 | return LYNQ_E_CONFLICT;
|
ll | 27dbe75 | 2022-08-10 00:33:52 -0700 | [diff] [blame] | 1042 | }
|
ll | b392107 | 2023-01-10 14:47:46 +0800 | [diff] [blame^] | 1043 | wait_call_state();
|
| 1044 | *handle = s_CallId;
|
| 1045 | LYINFLOG("lynq mo/mt call id:%d",s_CallId);
|
| 1046 | return RESULT_OK;
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 1047 | }
|
| 1048 |
|
| 1049 | int lynq_set_auto_answercall(const int mode)
|
| 1050 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 1051 | if(g_module_init_flag != MODULE_RUNNING)
|
ll | 27dbe75 | 2022-08-10 00:33:52 -0700 | [diff] [blame] | 1052 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 1053 | LYERRLOG("%s module state %d error",__func__,g_module_init_flag);
|
| 1054 | return LYNQ_E_CONFLICT;
|
ll | 27dbe75 | 2022-08-10 00:33:52 -0700 | [diff] [blame] | 1055 | }
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 1056 | s_call_auto_answer = mode;
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 1057 | LYINFLOG("auto answer call mode =%d",mode);
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 1058 | return RESULT_OK;
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 1059 | }
|
ll | b392107 | 2023-01-10 14:47:46 +0800 | [diff] [blame^] | 1060 |
|
| 1061 | int lynq_find_already_end()
|
| 1062 | {
|
| 1063 | for(int i=0;i < LYNQ_CALL_MAX; i++)
|
| 1064 | {
|
| 1065 | if(s_call_lists[i].call_state == 6)
|
| 1066 | {
|
| 1067 | return 0;
|
| 1068 | }
|
| 1069 | }
|
| 1070 | return INVALID_ID;
|
| 1071 | }
|
| 1072 |
|
q.huang | ec88da9 | 2022-03-29 04:17:32 -0400 | [diff] [blame] | 1073 | int lynq_get_current_call_state(int *handle, int *call_state,int *toa,int *direction,char addr[])
|
| 1074 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 1075 | if(g_module_init_flag != MODULE_RUNNING)
|
ll | 27dbe75 | 2022-08-10 00:33:52 -0700 | [diff] [blame] | 1076 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 1077 | LYERRLOG("%s module state %d error",__func__,g_module_init_flag);
|
| 1078 | return LYNQ_E_CONFLICT;
|
ll | 27dbe75 | 2022-08-10 00:33:52 -0700 | [diff] [blame] | 1079 | }
|
q.huang | ec88da9 | 2022-03-29 04:17:32 -0400 | [diff] [blame] | 1080 | int lynq_call_id = 0;
|
q.huang | 70b7649 | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 1081 | LYINFLOG("lynq_get_current_call_state begin ");
|
q.huang | ec88da9 | 2022-03-29 04:17:32 -0400 | [diff] [blame] | 1082 | if(handle==NULL)
|
| 1083 | {
|
q.huang | 70b7649 | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 1084 | LYERRLOG("handle is NULL");
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 1085 | return LYNQ_E_PARAMETER_ANONALY;
|
q.huang | ec88da9 | 2022-03-29 04:17:32 -0400 | [diff] [blame] | 1086 | }
|
ll | b392107 | 2023-01-10 14:47:46 +0800 | [diff] [blame^] | 1087 | LYINFLOG("lynq_get_current_call_state %d\n ", *handle);
|
q.huang | 70b7649 | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 1088 | lynq_call_id = find_call_id_with_call_id(*handle);
|
| 1089 | if(lynq_call_id==INVALID_ID)
|
| 1090 | {
|
ll | b392107 | 2023-01-10 14:47:46 +0800 | [diff] [blame^] | 1091 | if(lynq_find_already_end)
|
| 1092 | {
|
| 1093 | LYINFLOG("not end update\n ");
|
| 1094 | return LYNQ_E_INVALID_ID_ANONALY;
|
| 1095 | }
|
| 1096 | //find end state
|
| 1097 | if((*handle) >= 0)
|
| 1098 | {
|
| 1099 | *call_state = (int)LYNQ_CALL_END;
|
| 1100 | return RESULT_OK;
|
| 1101 | }
|
| 1102 | else
|
| 1103 | {
|
| 1104 | return LYNQ_E_INVALID_ID_ANONALY;
|
| 1105 | }
|
q.huang | 70b7649 | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 1106 | }
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 1107 | *call_state = s_call_lists[lynq_call_id].call_state;
|
| 1108 | *toa = s_call_lists[lynq_call_id].toa;
|
| 1109 | *direction = s_call_lists[lynq_call_id].direction;
|
| 1110 | memcpy(addr,s_call_lists[lynq_call_id].addr,strlen(s_call_lists[lynq_call_id].addr)+1);
|
ll | b392107 | 2023-01-10 14:47:46 +0800 | [diff] [blame^] | 1111 | return RESULT_OK;
|
q.huang | ec88da9 | 2022-03-29 04:17:32 -0400 | [diff] [blame] | 1112 | }
|
| 1113 |
|
q.huang | e97cfcf | 2022-08-29 20:04:31 +0800 | [diff] [blame] | 1114 | int lynq_get_current_call_number()
|
| 1115 | {
|
| 1116 | int cnt=0;
|
| 1117 | int i;
|
| 1118 | for(i = 0;i < LYNQ_CALL_MAX;i++)
|
| 1119 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 1120 | if(s_call_lists[i].used !=0)
|
q.huang | e97cfcf | 2022-08-29 20:04:31 +0800 | [diff] [blame] | 1121 | {
|
| 1122 | cnt++;
|
| 1123 | }
|
| 1124 | }
|
| 1125 |
|
| 1126 | return cnt;
|
| 1127 | }
|
| 1128 |
|
q.huang | ec88da9 | 2022-03-29 04:17:32 -0400 | [diff] [blame] | 1129 | /*audio begin*/
|
ll | dc99c9b | 2022-01-24 12:16:22 +0000 | [diff] [blame] | 1130 | static int judge_mic(const int enable){
|
ll | f512fa3 | 2022-02-14 08:58:16 +0000 | [diff] [blame] | 1131 | switch(enable){
|
| 1132 | case 0:
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 1133 | return true;
|
ll | f512fa3 | 2022-02-14 08:58:16 +0000 | [diff] [blame] | 1134 | case 1:
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 1135 | return true;
|
ll | f512fa3 | 2022-02-14 08:58:16 +0000 | [diff] [blame] | 1136 | default:
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 1137 | return false;
|
ll | dc99c9b | 2022-01-24 12:16:22 +0000 | [diff] [blame] | 1138 | }
|
| 1139 | }
|
| 1140 |
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 1141 | int lynq_set_mute_mic(const int enable)
|
ll | dc99c9b | 2022-01-24 12:16:22 +0000 | [diff] [blame] | 1142 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 1143 | if(g_module_init_flag != MODULE_RUNNING)
|
ll | 27dbe75 | 2022-08-10 00:33:52 -0700 | [diff] [blame] | 1144 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 1145 | LYERRLOG("%s module state %d error",__func__,g_module_init_flag);
|
ll | dc99c9b | 2022-01-24 12:16:22 +0000 | [diff] [blame] | 1146 | return LYNQ_E_CONFLICT;
|
| 1147 | }
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 1148 | if(!judge_mic(enable)){
|
| 1149 | return LYNQ_E_PARAMETER_ANONALY;
|
| 1150 | }
|
| 1151 | // return lynq_set_common_request(53,1,"%d",enable); //RIL_REQUEST_SET_MUTE
|
| 1152 |
|
| 1153 | Parcel* p=NULL;
|
| 1154 | int ret=lynq_send_common_request(p,g_wait_time,RIL_REQUEST_SET_MUTE,1,"%d",enable);
|
| 1155 | if(ret==RESULT_OK)
|
| 1156 | {
|
| 1157 | delete p;
|
| 1158 | }
|
| 1159 | return ret;
|
q.huang | ec88da9 | 2022-03-29 04:17:32 -0400 | [diff] [blame] | 1160 | }
|
| 1161 | int lynq_get_mute_mic(int *status)
|
| 1162 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 1163 | if(g_module_init_flag != MODULE_RUNNING)
|
ll | 27dbe75 | 2022-08-10 00:33:52 -0700 | [diff] [blame] | 1164 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 1165 | LYERRLOG("%s module state %d error",__func__,g_module_init_flag);
|
| 1166 | return LYNQ_E_CONFLICT;
|
ll | 27dbe75 | 2022-08-10 00:33:52 -0700 | [diff] [blame] | 1167 | }
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 1168 | return lynq_get_common_request(RIL_REQUEST_GET_MUTE,status);//54
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 1169 | }
|
ll | 72bf6c1 | 2022-03-24 10:22:25 +0800 | [diff] [blame] | 1170 |
|
| 1171 | /**
|
| 1172 | * @brief Check whether DTMF is valid
|
| 1173 | *
|
| 1174 | * @param callnum dtmf eg:0-9 * #
|
| 1175 | * @return int
|
| 1176 | */
|
| 1177 | static int judge_dtmf(const char callnum)
|
| 1178 | {
|
| 1179 | if(callnum == '#')
|
| 1180 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 1181 | return true;
|
ll | 72bf6c1 | 2022-03-24 10:22:25 +0800 | [diff] [blame] | 1182 | }
|
| 1183 | if(callnum == '*')
|
| 1184 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 1185 | return true;
|
ll | 72bf6c1 | 2022-03-24 10:22:25 +0800 | [diff] [blame] | 1186 | }
|
| 1187 | if(callnum >= '0'&& callnum <= '9')
|
| 1188 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 1189 | return true;
|
ll | 72bf6c1 | 2022-03-24 10:22:25 +0800 | [diff] [blame] | 1190 | }
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 1191 | return false;
|
ll | 72bf6c1 | 2022-03-24 10:22:25 +0800 | [diff] [blame] | 1192 | }
|
| 1193 |
|
ll | 209e611 | 2022-07-20 09:30:19 +0000 | [diff] [blame] | 1194 | int lynq_switch_waiting_or_holding_and_active(void)
|
| 1195 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 1196 | if(g_module_init_flag != MODULE_RUNNING)
|
ll | 27dbe75 | 2022-08-10 00:33:52 -0700 | [diff] [blame] | 1197 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 1198 | LYERRLOG("%s module state %d error",__func__,g_module_init_flag);
|
| 1199 | return LYNQ_E_CONFLICT;
|
ll | 27dbe75 | 2022-08-10 00:33:52 -0700 | [diff] [blame] | 1200 | }
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 1201 |
|
| 1202 | Parcel* p=NULL;
|
| 1203 | int ret=lynq_send_common_request(p,g_wait_time,RIL_REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE,0,"");
|
| 1204 | if(ret==RESULT_OK)
|
| 1205 | {
|
| 1206 | delete p;
|
| 1207 | }
|
| 1208 | return ret;
|
| 1209 |
|
| 1210 | #if 0
|
ll | 209e611 | 2022-07-20 09:30:19 +0000 | [diff] [blame] | 1211 | Parcel p;
|
| 1212 | lynq_client_t client;
|
| 1213 | int resp_type = -1;
|
q.huang | 7de1d66 | 2022-09-13 14:19:24 +0800 | [diff] [blame] | 1214 | int token;
|
ll | 209e611 | 2022-07-20 09:30:19 +0000 | [diff] [blame] | 1215 | int request = -1;
|
| 1216 | int slot_id = -1;
|
| 1217 | int error = -1;
|
| 1218 | client.uToken = Global_uToken_call;
|
| 1219 | client.request = RIL_REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE;
|
| 1220 | client.paramLen = 0;
|
| 1221 | bzero(client.param,LYNQ_REQUEST_PARAM_BUF);
|
| 1222 | LYDBGLOG("uToken=%d,request=%d,paralen=%d,param=%s",client.uToken,client.request,client.paramLen,client.param);
|
ll | 630be41 | 2022-07-25 05:52:14 +0000 | [diff] [blame] | 1223 | pthread_mutex_lock(&g_lynq_call_sendto_mutex);
|
ll | 209e611 | 2022-07-20 09:30:19 +0000 | [diff] [blame] | 1224 | if(send_request(lynq_call_client_sockfd,&client)==-1)
|
| 1225 | {
|
| 1226 | LYERRLOG("send request fail");
|
| 1227 | return -1;
|
| 1228 | }
|
| 1229 | get_response(lynq_call_client_sockfd,p);
|
ll | 630be41 | 2022-07-25 05:52:14 +0000 | [diff] [blame] | 1230 | pthread_mutex_unlock(&g_lynq_call_sendto_mutex);
|
q.huang | 7de1d66 | 2022-09-13 14:19:24 +0800 | [diff] [blame] | 1231 | JumpHeader(p,&resp_type,&token,&request,&slot_id,&error);
|
ll | 209e611 | 2022-07-20 09:30:19 +0000 | [diff] [blame] | 1232 | LYINFLOG("resp_type=%d,request=%d,slot_id=%d,error_code=%d",resp_type,request,slot_id,error);
|
| 1233 | return error;
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 1234 | #endif
|
ll | 209e611 | 2022-07-20 09:30:19 +0000 | [diff] [blame] | 1235 | }
|
| 1236 |
|
| 1237 | int lynq_hangup_waiting_or_background(void)
|
| 1238 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 1239 | if(g_module_init_flag != MODULE_RUNNING)
|
ll | 27dbe75 | 2022-08-10 00:33:52 -0700 | [diff] [blame] | 1240 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 1241 | LYERRLOG("%s module state %d error",__func__,g_module_init_flag);
|
| 1242 | return LYNQ_E_CONFLICT;
|
ll | 27dbe75 | 2022-08-10 00:33:52 -0700 | [diff] [blame] | 1243 | }
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 1244 |
|
| 1245 | Parcel* p=NULL;
|
| 1246 | int ret=lynq_send_common_request(p,g_wait_time,RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND,0,"");
|
| 1247 | if(ret==RESULT_OK)
|
| 1248 | {
|
| 1249 | delete p;
|
| 1250 | }
|
| 1251 | return ret;
|
| 1252 | #if 0
|
ll | 209e611 | 2022-07-20 09:30:19 +0000 | [diff] [blame] | 1253 | Parcel p;
|
| 1254 | lynq_client_t client;
|
| 1255 | int resp_type = -1;
|
q.huang | 7de1d66 | 2022-09-13 14:19:24 +0800 | [diff] [blame] | 1256 | int token;
|
ll | 209e611 | 2022-07-20 09:30:19 +0000 | [diff] [blame] | 1257 | int request = -1;
|
| 1258 | int slot_id = -1;
|
| 1259 | int error = -1;
|
| 1260 | client.uToken = Global_uToken_call;
|
| 1261 | client.request = RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND;
|
| 1262 | client.paramLen = 0;
|
| 1263 | bzero(client.param,LYNQ_REQUEST_PARAM_BUF);
|
| 1264 | LYDBGLOG("uToken=%d,request=%d,paralen=%d,param=%s",client.uToken,client.request,client.paramLen,client.param);
|
ll | 630be41 | 2022-07-25 05:52:14 +0000 | [diff] [blame] | 1265 | pthread_mutex_lock(&g_lynq_call_sendto_mutex);
|
ll | 209e611 | 2022-07-20 09:30:19 +0000 | [diff] [blame] | 1266 | if(send_request(lynq_call_client_sockfd,&client)==-1)
|
| 1267 | {
|
| 1268 | LYERRLOG("send request fail");
|
| 1269 | return -1;
|
| 1270 | }
|
| 1271 | get_response(lynq_call_client_sockfd,p);
|
ll | 630be41 | 2022-07-25 05:52:14 +0000 | [diff] [blame] | 1272 | pthread_mutex_unlock(&g_lynq_call_sendto_mutex);
|
q.huang | 7de1d66 | 2022-09-13 14:19:24 +0800 | [diff] [blame] | 1273 | JumpHeader(p,&resp_type,&token,&request,&slot_id,&error);
|
ll | 209e611 | 2022-07-20 09:30:19 +0000 | [diff] [blame] | 1274 | LYINFLOG("resp_type=%d,request=%d,slot_id=%d,error_code=%d",resp_type,request,slot_id,error);
|
| 1275 | return error;
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 1276 | #endif
|
ll | 209e611 | 2022-07-20 09:30:19 +0000 | [diff] [blame] | 1277 | }
|
| 1278 |
|
| 1279 | int lynq_hangup_foreground_resume_background(void)
|
| 1280 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 1281 | if(g_module_init_flag != MODULE_RUNNING)
|
ll | 27dbe75 | 2022-08-10 00:33:52 -0700 | [diff] [blame] | 1282 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 1283 | LYERRLOG("%s module state %d error",__func__,g_module_init_flag);
|
| 1284 | return LYNQ_E_CONFLICT;
|
ll | 27dbe75 | 2022-08-10 00:33:52 -0700 | [diff] [blame] | 1285 | }
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 1286 |
|
| 1287 | Parcel* p=NULL;
|
| 1288 | int ret=lynq_send_common_request(p,g_wait_time,RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND,0,"");
|
| 1289 | if(ret==RESULT_OK)
|
| 1290 | {
|
| 1291 | delete p;
|
| 1292 | }
|
| 1293 | return ret;
|
| 1294 | #if 0
|
ll | 209e611 | 2022-07-20 09:30:19 +0000 | [diff] [blame] | 1295 | Parcel p;
|
| 1296 | lynq_client_t client;
|
| 1297 | int resp_type = -1;
|
q.huang | 7de1d66 | 2022-09-13 14:19:24 +0800 | [diff] [blame] | 1298 | int token;
|
ll | 209e611 | 2022-07-20 09:30:19 +0000 | [diff] [blame] | 1299 | int request = -1;
|
| 1300 | int slot_id = -1;
|
| 1301 | int error = -1;
|
| 1302 | client.uToken = Global_uToken_call;
|
| 1303 | client.request = RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND;
|
| 1304 | client.paramLen = 0;
|
| 1305 | bzero(client.param,LYNQ_REQUEST_PARAM_BUF);
|
| 1306 | LYDBGLOG("uToken=%d,request=%d,paralen=%d,param=%s",client.uToken,client.request,client.paramLen,client.param);
|
ll | 630be41 | 2022-07-25 05:52:14 +0000 | [diff] [blame] | 1307 | pthread_mutex_lock(&g_lynq_call_sendto_mutex);
|
ll | 209e611 | 2022-07-20 09:30:19 +0000 | [diff] [blame] | 1308 | if(send_request(lynq_call_client_sockfd,&client)==-1)
|
| 1309 | {
|
| 1310 | LYERRLOG("send request fail");
|
| 1311 | return -1;
|
| 1312 | }
|
| 1313 | get_response(lynq_call_client_sockfd,p);
|
ll | 630be41 | 2022-07-25 05:52:14 +0000 | [diff] [blame] | 1314 | pthread_mutex_unlock(&g_lynq_call_sendto_mutex);
|
q.huang | 7de1d66 | 2022-09-13 14:19:24 +0800 | [diff] [blame] | 1315 | JumpHeader(p,&resp_type,&token,&request,&slot_id,&error);
|
ll | 209e611 | 2022-07-20 09:30:19 +0000 | [diff] [blame] | 1316 | LYINFLOG("resp_type=%d,request=%d,slot_id=%d,error_code=%d",resp_type,request,slot_id,error);
|
| 1317 | return error;
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 1318 | #endif
|
ll | 209e611 | 2022-07-20 09:30:19 +0000 | [diff] [blame] | 1319 | }
|
| 1320 |
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 1321 | int lynq_set_DTMF(const char callnum)
|
| 1322 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 1323 | if(g_module_init_flag != MODULE_RUNNING)
|
ll | 27dbe75 | 2022-08-10 00:33:52 -0700 | [diff] [blame] | 1324 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 1325 | LYERRLOG("%s module state %d error",__func__,g_module_init_flag);
|
| 1326 | return LYNQ_E_CONFLICT;
|
ll | 27dbe75 | 2022-08-10 00:33:52 -0700 | [diff] [blame] | 1327 | }
|
ll | 72bf6c1 | 2022-03-24 10:22:25 +0800 | [diff] [blame] | 1328 | if(!judge_dtmf(callnum))
|
| 1329 | {
|
| 1330 | return LYNQ_E_CONFLICT;
|
| 1331 | }
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 1332 | if(s_module_call_state!=CALL_ON)
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 1333 | {
|
| 1334 | LYERRLOG("LYNQ_E_CONFLICT");
|
| 1335 | return LYNQ_E_CONFLICT;
|
| 1336 | }
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 1337 |
|
| 1338 | // return lynq_set_common_request(24,1,"%c",callnum); //RIL_REQUEST_DTMF
|
| 1339 |
|
| 1340 | Parcel* p=NULL;
|
| 1341 | int ret=lynq_send_common_request(p,g_wait_time,RIL_REQUEST_DTMF,1,"%c",callnum);
|
| 1342 | if(ret==RESULT_OK)
|
| 1343 | {
|
| 1344 | delete p;
|
| 1345 | }
|
| 1346 | return ret;
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 1347 | }
|
q.huang | ec88da9 | 2022-03-29 04:17:32 -0400 | [diff] [blame] | 1348 | static int judge_volume(LYNQ_E_VOLUMN_SET set,const int volume){
|
| 1349 | if(set==LYNQ_E_VOLUMN_SET_DTMF){
|
| 1350 | if(volume < 0 ||volume >36){
|
| 1351 | return 0;
|
| 1352 | }
|
| 1353 | }
|
| 1354 | else if (set==LYNQ_E_VOLUMN_SET_SPEECH)
|
| 1355 | {
|
| 1356 | if(volume < 1 ||volume >7){
|
| 1357 | return 0;
|
| 1358 | }
|
ll | dc99c9b | 2022-01-24 12:16:22 +0000 | [diff] [blame] | 1359 | }
|
ll | 04ae414 | 2022-01-27 05:54:38 +0000 | [diff] [blame] | 1360 | return 1;
|
ll | dc99c9b | 2022-01-24 12:16:22 +0000 | [diff] [blame] | 1361 | }
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 1362 | int lynq_set_DTMF_volume(const int volume)
|
ll | dc99c9b | 2022-01-24 12:16:22 +0000 | [diff] [blame] | 1363 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 1364 | if(g_module_init_flag != MODULE_RUNNING)
|
| 1365 | {
|
| 1366 | LYERRLOG("%s module state %d error",__func__,g_module_init_flag);
|
ll | dc99c9b | 2022-01-24 12:16:22 +0000 | [diff] [blame] | 1367 | return LYNQ_E_CONFLICT;
|
| 1368 | }
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 1369 | if(!judge_volume(LYNQ_E_VOLUMN_SET_DTMF,volume)){
|
| 1370 | return LYNQ_E_PARAMETER_ANONALY;
|
| 1371 | }
|
| 1372 | // return lynq_set_common_request(8003,1,"%d",volume);//LYNQ_REQUEST_SET_DTMF_VOLUME
|
| 1373 | Parcel* p=NULL;
|
| 1374 | int ret=lynq_send_common_request(p,g_wait_time,LYNQ_REQUEST_SET_DTMF_VOLUME,1,"%d",volume);
|
| 1375 | if(ret==RESULT_OK)
|
| 1376 | {
|
| 1377 | delete p;
|
| 1378 | }
|
| 1379 | return ret;
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 1380 | }
|
q.huang | b212fde | 2022-04-05 23:11:02 -0400 | [diff] [blame] | 1381 | int lynq_set_speech_volume(const int volume)//mixer_set_volume
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 1382 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 1383 | if(g_module_init_flag != MODULE_RUNNING)
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 1384 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 1385 | LYERRLOG("%s module state %d error",__func__,g_module_init_flag);
|
q.huang | ec88da9 | 2022-03-29 04:17:32 -0400 | [diff] [blame] | 1386 | return LYNQ_E_CONFLICT;
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 1387 | }
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 1388 | if(!judge_volume(LYNQ_E_VOLUMN_SET_SPEECH,volume))
|
| 1389 | {
|
| 1390 | return LYNQ_E_PARAMETER_ANONALY;
|
| 1391 | }
|
| 1392 | // return lynq_set_common_request(8009,1,"%d",volume); //LYNQ_REQUEST_SET_SPEECH_VOLUME
|
| 1393 | Parcel* p=NULL;
|
| 1394 | int ret=lynq_send_common_request(p,g_wait_time,LYNQ_REQUEST_SET_SPEECH_VOLUME,1,"%d",volume);
|
| 1395 | if(ret==RESULT_OK)
|
| 1396 | {
|
| 1397 | delete p;
|
| 1398 | }
|
| 1399 | return ret;
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 1400 | }
|
q.huang | ec88da9 | 2022-03-29 04:17:32 -0400 | [diff] [blame] | 1401 | int lynq_get_speech_volume(int* volumn)//mixer_get_volume
|
| 1402 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 1403 | return lynq_get_common_request(LYNQ_REQUEST_GET_SPEECH_VOLUME,volumn);//8010
|
q.huang | ec88da9 | 2022-03-29 04:17:32 -0400 | [diff] [blame] | 1404 | }
|
q.huang | b212fde | 2022-04-05 23:11:02 -0400 | [diff] [blame] | 1405 | int lynq_incall_record_start(const char* file_path)
|
q.huang | ec88da9 | 2022-03-29 04:17:32 -0400 | [diff] [blame] | 1406 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 1407 | // return lynq_set_common_request(8011,2,"%s %s","1",file_path); //LYNQ_REQUEST_RECORD
|
| 1408 | Parcel* p=NULL;
|
| 1409 | int ret=lynq_send_common_request(p,g_wait_time,LYNQ_REQUEST_RECORD,2,"%s %s","1",file_path);
|
| 1410 | if(ret==RESULT_OK)
|
| 1411 | {
|
| 1412 | delete p;
|
| 1413 | }
|
| 1414 | return ret;
|
q.huang | ec88da9 | 2022-03-29 04:17:32 -0400 | [diff] [blame] | 1415 | }
|
| 1416 | int lynq_incall_record_stop()
|
| 1417 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 1418 | if(g_module_init_flag != MODULE_RUNNING)
|
| 1419 | {
|
| 1420 | LYERRLOG("%s module state %d error",__func__,g_module_init_flag);
|
| 1421 | return LYNQ_E_CONFLICT;
|
| 1422 | }
|
q.huang | b212fde | 2022-04-05 23:11:02 -0400 | [diff] [blame] | 1423 | const char* unused_file="just_ocuupy_paramter_postion";
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 1424 | // return lynq_set_common_request(8011,2,"%s %s","0",unused_file); //LYNQ_REQUEST_RECORD
|
| 1425 | Parcel* p=NULL;
|
| 1426 | int ret=lynq_send_common_request(p,g_wait_time,LYNQ_REQUEST_RECORD,2,"%s %s","0",unused_file);
|
| 1427 | if(ret==RESULT_OK)
|
| 1428 | {
|
| 1429 | delete p;
|
| 1430 | }
|
| 1431 | return ret;
|
q.huang | ec88da9 | 2022-03-29 04:17:32 -0400 | [diff] [blame] | 1432 | }
|
| 1433 | /*audio end*/
|
q.huang | 714145d | 2022-04-18 00:09:50 -0400 | [diff] [blame] | 1434 |
|
q.huang | 036b6cf | 2023-01-10 14:29:20 +0800 | [diff] [blame] | 1435 |
|
| 1436 |
|
| 1437 | bool is_support_urc(int urc_id)
|
| 1438 | {
|
| 1439 | switch(urc_id)
|
| 1440 | {
|
| 1441 | case RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED:
|
| 1442 | case RIL_UNSOL_CALL_RING:
|
| 1443 | case RIL_UNSOL_RINGBACK_TONE:
|
| 1444 | case RIL_UNSOL_CALL_INFO_INDICATION:
|
| 1445 | #ifdef ECALL_SUPPORT
|
| 1446 | case RIL_UNSOL_ECALL_INDICATIONS://9502
|
| 1447 | #endif
|
| 1448 | return true;
|
| 1449 | default:
|
| 1450 | return false;
|
| 1451 | }
|
| 1452 | }
|
| 1453 |
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 1454 | void urc_msg_process(Parcel *p)
|
| 1455 | {
|
| 1456 | int resp_type;
|
| 1457 | int urcid;
|
| 1458 | int slot_id;
|
q.huang | 036b6cf | 2023-01-10 14:29:20 +0800 | [diff] [blame] | 1459 |
|
| 1460 | int size=p->dataSize();
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 1461 | p->readInt32(&resp_type);
|
| 1462 | p->readInt32(&urcid);
|
| 1463 | p->readInt32(&slot_id);
|
q.huang | 036b6cf | 2023-01-10 14:29:20 +0800 | [diff] [blame] | 1464 | LYINFLOG("%s urc id = %d, slot_id = %d, size is %d, msg is %s",__func__, urcid,slot_id,size,requestToString(urcid));
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 1465 | switch (urcid)
|
| 1466 | {
|
| 1467 | case RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED://1001
|
| 1468 | {
|
| 1469 | LYINFLOG("**************:resp_type=%d,urcid=%d,slot_id=%d",resp_type,urcid,slot_id);
|
| 1470 | lynqNoticeGetModuleCallList();
|
| 1471 | break;
|
| 1472 | }
|
| 1473 | case RIL_UNSOL_CALL_RING: //1018
|
| 1474 | {
|
| 1475 | if(s_call_auto_answer==1)
|
| 1476 | {
|
| 1477 | lynq_call_answer();
|
| 1478 | }
|
| 1479 | break;
|
| 1480 | }
|
| 1481 | case RIL_UNSOL_RINGBACK_TONE: //1029
|
| 1482 | case RIL_UNSOL_CALL_INFO_INDICATION://3049
|
| 1483 | {
|
| 1484 | LYINFLOG("**************:resp_type=%d,urcid=%d,slot_id=%d",resp_type,urcid,slot_id);
|
| 1485 | break;
|
| 1486 | }
|
q.huang | 714145d | 2022-04-18 00:09:50 -0400 | [diff] [blame] | 1487 | #ifdef ECALL_SUPPORT
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 1488 | case RIL_UNSOL_ECALL_INDICATIONS://9502
|
q.huang | e97cfcf | 2022-08-29 20:04:31 +0800 | [diff] [blame] | 1489 | {
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 1490 | urc_ecall_msg_process(p);
|
q.huang | e97cfcf | 2022-08-29 20:04:31 +0800 | [diff] [blame] | 1491 | }
|
q.huang | e97cfcf | 2022-08-29 20:04:31 +0800 | [diff] [blame] | 1492 | #endif
|
q.huang | 5292166 | 2022-10-20 15:25:45 +0800 | [diff] [blame] | 1493 | default:
|
| 1494 | break;
|
q.huang | cb7b729 | 2022-06-28 20:12:01 +0800 | [diff] [blame] | 1495 | }
|
q.huang | 5ca6c07 | 2022-06-06 16:15:31 +0800 | [diff] [blame] | 1496 | }
|
q.huang | 5ca6c07 | 2022-06-06 16:15:31 +0800 | [diff] [blame] | 1497 |
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 1498 | #if 0
|
| 1499 | int main(int argc,char **argv)
|
| 1500 | {
|
| 1501 | int n = 0;
|
| 1502 | n = lynq_init_call(lynq_call_state_change_test,2222);
|
| 1503 | if(n<0)
|
| 1504 | {
|
q.huang | 70b7649 | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 1505 | LYDBGLOG("lynq init call fail!!!");
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 1506 | return -1;
|
| 1507 | }
|
q.huang | 70b7649 | 2022-06-02 14:49:02 +0800 | [diff] [blame] | 1508 | LYDBGLOG("lynq call init success!!!");
|
lh | 7b0674a | 2022-01-10 00:34:35 -0800 | [diff] [blame] | 1509 | char phoneNum[LYNQ_PHONE_NUMBER_MAX];
|
| 1510 | sprintf(phoneNum,"18180053406 0",strlen("18180053406 0")+1);
|
| 1511 | lynq_call(phoneNum);
|
| 1512 | while(1)
|
| 1513 | {
|
| 1514 | sleep(1);
|
| 1515 | }
|
| 1516 | return 0;
|
| 1517 | }
|
| 1518 | #endif
|
| 1519 | /*Warren add for T800 platform 2021/11/19 end*/
|