[Feature]add MT2731_MP2_MR2_SVN388 baseline version
Change-Id: Ief04314834b31e27effab435d3ca8ba33b499059
diff --git a/src/lynq/lib/liblynq-tele-ril/lynq-riltel/atci/ATCI.cpp b/src/lynq/lib/liblynq-tele-ril/lynq-riltel/atci/ATCI.cpp
new file mode 100644
index 0000000..97376a7
--- /dev/null
+++ b/src/lynq/lib/liblynq-tele-ril/lynq-riltel/atci/ATCI.cpp
@@ -0,0 +1,805 @@
+/* Copyright Statement:
+ *
+ * This software/firmware and related documentation ("MediaTek Software") are
+ * protected under relevant copyright laws. The information contained herein
+ * is confidential and proprietary to MediaTek Inc. and/or its licensors.
+ * Without the prior written permission of MediaTek inc. and/or its licensors,
+ * any reproduction, modification, use or disclosure of MediaTek Software,
+ * and information contained herein, in whole or in part, shall be strictly prohibited.
+ */
+/* MediaTek Inc. (C) 2010. All rights reserved.
+ *
+ * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
+ * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
+ * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER ON
+ * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
+ * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
+ * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
+ * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH
+ * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES
+ * THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES
+ * CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK
+ * SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
+ * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND
+ * CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
+ * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
+ * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO
+ * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
+ *
+ * The following software/firmware and/or related documentation ("MediaTek Software")
+ * have been modified by MediaTek Inc. All revisions are subject to any receiver's
+ * applicable license agreements with MediaTek Inc.
+ */
+#include <string.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <signal.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <vendor-ril/telephony/ril.h>
+
+#include "common.h"
+#include "util/utils.h"
+#include "atci/ATCI.h"
+#include "atci_util.h"
+#include "atci_at_util.h"
+#include "Radio_capability_switch_util.h"
+
+#ifdef ATCI_PARSE
+#include "atci_sys_cmd.h"
+#include "atci_ss_cmd.h"
+#include "atci_cc_cmd.h"
+#endif
+
+struct sockaddr_un atci_server_addr;
+//struct sockaddr_in atci_server_addr;
+//struct sockaddr_un atci_client_addr;
+#undef LOG_TAG
+#define LOG_TAG "DEMO_ATCI"
+
+#if ATCI_ENABLE_RESPONSE
+char Respose_buf[RESPONSE_BUF_SIZE];
+#endif
+
+#ifdef ATCI_PARSE
+int atci_dispatch_cmd(char *line);
+#endif
+
+int atci_server_socket_fd, atci_client_connect;
+namespace android {
+ extern int s_registerCalled;
+}
+
+#define SOCKET_ZERO 0
+#define SOCKET_SUCC 1
+#define SOCKET_FAIL -1
+static int ATCI_Token = 0;
+
+int ATCISupport(int request) {
+ switch (request) {
+ case TELEPHONY_REQUEST_SET_CALL_FORWARD:
+ return 1;
+ case TELEPHONY_REQUEST_SET_CALL_WAITING:
+ return 1;
+ case TELEPHONY_REQUEST_SET_CALL_BARRING:
+ return 1;
+ case TELEPHONY_REQUEST_DIAL:
+ return 1;
+ case TELEPHONY_REQUEST_DROP_CONF_CALL_MEMBER:
+ return 1;
+ case TELEPHONY_REQUEST_FLIGHT:
+ return 1;
+ case TELEPHONY_REQUEST_SET_MUTE:
+ return 1;
+ case TELEPHONY_REQUEST_MERGE_CONF_CALLS:
+ return 1;
+ case TELEPHONY_REQUEST_CREATE_IMS_CONF_CALL:
+ return 1;
+ case TELEPHONY_REQUEST_DIAL_WITH_SIP_URI:
+ return 1;
+ default:
+ return 0;
+ }
+}
+const char * ATCIReqRspToString(int request) {
+ switch (request) {
+ case TELEPHONY_REQUEST_SET_CALL_FORWARD:
+ return "SET_CALL_FORWARD";
+ case TELEPHONY_REQUEST_SET_CALL_WAITING:
+ return "SET_CALL_WAITING";
+ case TELEPHONY_REQUEST_SET_CALL_BARRING:
+ return "SET_CALL_BARRING";
+ case TELEPHONY_REQUEST_DIAL:
+ return "DIAL";
+ case TELEPHONY_REQUEST_DROP_CONF_CALL_MEMBER:
+ return "DROP_CONF_CALL_MEMBER";
+ case TELEPHONY_REQUEST_FLIGHT:
+ return "FLIGHT";
+ case TELEPHONY_RESPONSE_FLIGHT:
+ return "RSP_FLIGHT";
+ case TELEPHONY_REQUEST_SET_MUTE:
+ return "SET_MUTE";
+ case TELEPHONY_REQUEST_MERGE_CONF_CALLS:
+ return "MERGE_CONF_CALLS";
+ case TELEPHONY_REQUEST_CREATE_IMS_CONF_CALL:
+ return "CREATE_IMS_CONF_CALL";
+ case TELEPHONY_REQUEST_DIAL_WITH_SIP_URI:
+ return "DIAL_WITH_SIP_URI";
+ default:
+ return "<unknown request>";
+ }
+}
+//return requestNumber
+int ATCIParserRequest(int request) {
+ //char* cPoint = buf;
+ //int reqNum = 0;
+
+ RLOGD("ATCI Parser request number start!");
+
+ //memcpy(&reqNum,cPoint,sizeof(int));
+ RLOGD("Request is %d,%s", request, ATCIReqRspToString(request));
+
+ if (ATCISupport(request) != 1)
+ return -1;
+
+ return request;
+}
+
+int MappingATCI2RIL(int reqNum) {
+ int request = 0;
+ switch (reqNum) {
+ case TELEPHONY_REQUEST_SET_CALL_FORWARD:
+ request = RIL_REQUEST_SET_CALL_FORWARD;
+ break;
+ case TELEPHONY_REQUEST_SET_CALL_WAITING:
+ request = RIL_REQUEST_SET_CALL_WAITING;
+ break;
+ case TELEPHONY_REQUEST_SET_CALL_BARRING:
+ request = RIL_REQUEST_SET_FACILITY_LOCK;
+ break;
+ case TELEPHONY_REQUEST_DIAL:
+ request = RIL_REQUEST_DIAL;
+ break;
+ case TELEPHONY_REQUEST_DROP_CONF_CALL_MEMBER:
+ request = RIL_REQUEST_REMOVE_IMS_CONFERENCE_CALL_MEMBER;
+ break;
+ case TELEPHONY_REQUEST_FLIGHT:
+ request = RIL_REQUEST_RADIO_POWER;
+ break;
+ case TELEPHONY_REQUEST_SET_MUTE:
+ request = RIL_REQUEST_SET_MUTE;
+ break;
+ case TELEPHONY_REQUEST_MERGE_CONF_CALLS:
+ request = RIL_REQUEST_CONFERENCE;
+ break;
+ case TELEPHONY_REQUEST_CREATE_IMS_CONF_CALL:
+ request = RIL_REQUEST_CONFERENCE_DIAL;
+ break;
+ case TELEPHONY_REQUEST_DIAL_WITH_SIP_URI:
+ request = RIL_REQUEST_DIAL_WITH_SIP_URI;
+ break;
+ default:
+ request = -1;
+ }
+
+ return request;
+}
+
+int MappingParameter(int reqNum, int length, char* data, char* buf,
+ char** argv) {
+ int argc = 1;
+ char* cPoint;
+
+ cPoint = buf;
+ switch (reqNum) {
+ case TELEPHONY_REQUEST_SET_CALL_FORWARD: {
+ if (length != sizeof(telephonyRequestSetCallForward)) {
+ RLOGD("Set_Call_Forward data error!");
+ return -1;
+ }
+ telephonyRequestSetCallForward tempSCF;
+ memset(&tempSCF, 0, sizeof(tempSCF));
+ memcpy(&tempSCF, data, length);
+
+ //cmd parameter sequence: status, reason, number, time_seconds, service_class; other not need.
+ argv[1] = cPoint; //status
+ cPoint += sizeof(tempSCF.status);
+ sprintf(argv[1], "%d", tempSCF.status);
+
+ argv[2] = cPoint; //reason
+ cPoint += sizeof(tempSCF.reason);
+ sprintf(argv[2], "%d", tempSCF.reason);
+
+ argv[5] = cPoint; //service_class
+ cPoint += sizeof(tempSCF.service_class);
+ sprintf(argv[5], "%d", tempSCF.service_class);
+
+ argv[6] = cPoint; //toa
+ cPoint += sizeof(tempSCF.toa);
+ sprintf(argv[6], "%d", tempSCF.toa);
+
+ argv[3] = cPoint; //number
+ cPoint += sizeof(tempSCF.number);
+ sprintf(argv[3], "%s", tempSCF.number);
+
+ argv[4] = cPoint; //time_seconds
+ sprintf(argv[4], "%d", tempSCF.time_seconds);
+
+ argc += 5;
+ RLOGD(
+ "TELEPHONY_REQUEST_SET_CALL_FORWARD status(%s) reason(%s) number(%s) time_seconds(%s) service_class(%s) --toa(%s)",
+ argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]);
+ }
+ break;
+ case TELEPHONY_REQUEST_SET_CALL_WAITING: {
+ if (length != sizeof(telephonyRequestSetCallWaiting)) {
+ RLOGD("Set_Call_Waiting data error!");
+ return -1;
+ }
+ telephonyRequestSetCallWaiting tempSCW;
+ memset(&tempSCW, 0, sizeof(tempSCW));
+ memcpy(&tempSCW, data, length);
+
+ //cmd parameter sequence: statue, service_code
+ argv[1] = cPoint; //status
+ cPoint += sizeof(tempSCW.status);
+ sprintf(argv[1], "%d", tempSCW.status);
+
+ argv[2] = cPoint; //service_class
+ sprintf(argv[2], "%d", tempSCW.service_class);
+
+ argc += 2;
+ RLOGD("TELEPHONY_REQUEST_SET_CALL_WAITING status(%s) service_class(%s)",
+ argv[1], argv[2]);
+ }
+ break;
+ case TELEPHONY_REQUEST_SET_CALL_BARRING: {
+ if (length != sizeof(telephonyRequestSetCallBarring)) {
+ RLOGD("Set_Call_Barring data error!");
+ return -1;
+ }
+ telephonyRequestSetCallBarring tempSCB;
+ memset(&tempSCB, 0, sizeof(tempSCB));
+ memcpy(&tempSCB, data, length);
+
+ //cmd parameter sequence: facility, password, serviceclass,enable; other not need.
+ argv[4] = cPoint; //status
+ cPoint += sizeof(tempSCB.status);
+ sprintf(argv[4], "%d", tempSCB.status);
+
+ argv[1] = cPoint; //facility
+ cPoint += sizeof(tempSCB.facility);
+ sprintf(argv[1], "%s", tempSCB.facility);
+
+ argv[2] = cPoint; //password
+ cPoint += sizeof(tempSCB.password);
+ sprintf(argv[2], "%s", tempSCB.password);
+
+ argv[3] = cPoint; //serviceclass
+ cPoint += sizeof(tempSCB.serviceClass);
+ sprintf(argv[3], "%d", tempSCB.serviceClass);
+
+ argc += 4;
+ RLOGD(
+ "TELEPHONY_REQUEST_SET_CALL_Barring facility(%s) password(%s) service_class(%s) status(enable)(%s)",
+ argv[1], argv[2], argv[3], argv[4]);
+ }
+ break;
+ case TELEPHONY_REQUEST_DIAL: {
+ if (length != sizeof(telephonyRequestDial)) {
+ RLOGD("Request dail data error!");
+ return -1;
+ }
+ telephonyRequestDial tempDIAL;
+ memset(&tempDIAL, 0, sizeof(tempDIAL));
+ memcpy(&tempDIAL, data, length);
+
+ //cmd parameter sequence: callnumber, clir;
+ argv[2] = cPoint; //clir
+ cPoint += sizeof(tempDIAL.clir);
+ sprintf(argv[2], "%d", tempDIAL.clir);
+
+ argv[1] = cPoint; //phonyNumber
+ sprintf(argv[1], "%s", tempDIAL.phonyNumber);
+
+ argc += 2;
+ RLOGD("TELEPHONY_REQUEST_DIAL CLIR(%s) PhoneNumber(%s)", argv[2], argv[1]);
+ }
+ break;
+ case TELEPHONY_REQUEST_DROP_CONF_CALL_MEMBER: {
+ if (length != sizeof(telephonyRequestDropConfCallMember)) {
+ RLOGD("DropConfCallMember data error!");
+ return -1;
+ }
+ telephonyRequestDropConfCallMember tempDCCM;
+ memset(&tempDCCM, 0, sizeof(tempDCCM));
+ memcpy(&tempDCCM, data, length);
+
+ //cmd parameter sequence: callId, addr, ToAdd; other not need.
+ argv[1] = cPoint; //ConfCallID
+ cPoint += sizeof(tempDCCM.confCallID);
+ sprintf(argv[1], "%d", tempDCCM.confCallID);
+
+ argv[2] = cPoint; //phonyNumber
+ cPoint += sizeof(tempDCCM.phonyNumber);
+ sprintf(argv[2], "%d", tempDCCM.phonyNumber);
+
+ argv[3] = cPoint; //callIDToAdd
+ sprintf(argv[3], "%d", tempDCCM.callIDToAdd);
+
+ argc += 3;
+ RLOGD(
+ "TELEPHONY_REQUEST_DROP_CONF_CALL_MEMBER ConfCallID(%s) phonyNumber(%s) callIDToAdd(%s)",
+ argv[1], argv[2], argv[3]);
+ }
+ break;
+ case TELEPHONY_REQUEST_FLIGHT: {
+ if (length != sizeof(telephonyRequestFlight)) {
+ RLOGD("Request flight data error!");
+ return -1;
+ }
+ telephonyRequestFlight tempFT;
+ memset(&tempFT, 0, sizeof(tempFT));
+ memcpy(&tempFT, data, length);
+
+ //cmd parameter sequence: mode.
+ argv[1] = cPoint; //flightModeOn
+ sprintf(argv[1], "%d", (tempFT.flightModeOn == 1 ? 0 : 1));
+
+ argc += 1;
+ RLOGD("TELEPHONY_REQUEST_FLIGHT flight Mode is %s-->(%s)",
+ (tempFT.flightModeOn == 1 ? "On" : "Off"), argv[1]);
+ }
+ break;
+ case TELEPHONY_REQUEST_SET_MUTE: {
+ if (length != sizeof(telephonyRequestSetMute)) {
+ RLOGD("Request flight data error!");
+ return -1;
+ }
+ telephonyRequestSetMute tempSM;
+ memset(&tempSM, 0, sizeof(tempSM));
+ memcpy(&tempSM, data, length);
+
+ //cmd parameter sequence: mode.
+ argv[1] = cPoint; //isMute
+ sprintf(argv[1], "%d", tempSM.isMute);
+
+ argc += 1;
+ RLOGD("TELEPHONY_REQUERT_SET_MUTE isMute(%s)", argv[1]);
+ }
+ break;
+ case TELEPHONY_REQUEST_MERGE_CONF_CALLS: {
+ RLOGD("TELEPHONY_REQUERT_MERGE_CONF_CALLS (No Parm.)");
+ }
+ break;
+ case TELEPHONY_REQUEST_CREATE_IMS_CONF_CALL: {
+ //cmd parameter sequence: DialMethod, ParticipantsNumber, addresses, clir;
+ argv[1] = cPoint; //DialMethod
+ sprintf(argv[1], "%d", 0);
+ cPoint += sizeof(int);
+
+ argv[2] = cPoint; //ParticipantsNumber
+ sprintf(argv[2], "%d", 0);
+ cPoint += sizeof(int);
+ //no address
+ argv[3] = cPoint; //CLIR
+ sprintf(argv[2], "%s", "0");
+
+ argc += 3;
+ RLOGD(
+ "TELEPHONY_REQUEST_CREATE_IMS_CONF_CALL dialMethod(%d) PhoneNumber(%d),clir(%s)",
+ argv[1], argv[2], argv[3]);
+ }
+ break;
+ case TELEPHONY_REQUEST_DIAL_WITH_SIP_URI: {
+ if (length != sizeof(telephonyRequestDial)) //struct with the same as DIAL
+ {
+ RLOGD("Request DialWithSipUri data error!");
+ return -1;
+ }
+ telephonyRequestDial tempDWSU;
+ memset(&tempDWSU, 0, sizeof(tempDWSU));
+ memcpy(&tempDWSU, data, length);
+
+ //cmd parameter sequence: address, clir;
+ argv[2] = cPoint; //clir
+ cPoint += sizeof(tempDWSU.clir);
+ sprintf(argv[2], "%d", tempDWSU.clir);
+
+ argv[1] = cPoint; //address
+ sprintf(argv[1], "%s", tempDWSU.phonyNumber);
+
+ argc += 2;
+ RLOGD("TELEPHONY_REQUEST_DIAL_WITH_SIP_URI CLIR(%d) PhoneNumber(%s)",
+ argv[2], argv[1]);
+ }
+ break;
+ default:
+ break;
+ }
+
+ return argc;
+}
+
+void ATCIResponse(int token, int error, char* data, int reqNum)
+{
+ //int reqNum;
+ char buf[64];
+ if(token&ATCI_TOKEN_MARK != ATCI_TOKEN_MARK) {
+ if(token == 0 && data == NULL && reqNum == 0) {
+ RLOGD("AT%RESTART: %d", error);
+ } else {
+ RLOGE("ATCIRespnse Error, Token not ATCI\n");
+ }
+
+ } else {
+ RLOGD("token is %d,%s",reqNum,android::requestToString(reqNum));
+ }
+
+ memset(buf, 0, sizeof(buf));
+ if(error == 1){
+ sprintf(buf,"%s","ERROR");
+ } else {
+ sprintf(buf,"%s","OK");
+ }
+
+ int len_s = send(atci_client_connect, buf, strlen(buf), 0);
+ RLOGD("Response Buf is %s, send length is %d",buf,len_s);
+}
+
+#ifdef ATCI_PARSE
+int acti_cmd_recv(int fd, char *buf, int len) {
+ int ret = 0;
+ fd_set rfds;
+ //FD_CLR(fd, &rfds);
+ FD_SET(fd, &rfds);
+ ret = select(fd + 1, &rfds, NULL, NULL, NULL);
+ if (ret <= 0) {
+ RLOGE("acti_cmd_recv select error, ret=%d, error=%s(%d),fd=%d", ret,
+ strerror(errno), errno, fd);
+ return SOCKET_FAIL;
+ }
+ if (FD_ISSET(fd, &rfds)) {
+ ret = recv(fd, buf, len, 0);
+ if (ret < 0) {
+ RLOGE("acti_cmd_recv select error, ret=%d, error=%s(%d),fd=%d", ret,
+ strerror(errno), errno, fd);
+ return SOCKET_FAIL;
+ } else if (ret == 0) {
+ RLOGE("acti_cmd_recv recv error, ret=%d, error=%s(%d),fd=%d", ret,
+ strerror(errno), errno, fd);
+ return SOCKET_ZERO;
+ } else {
+ //buf[ret] = '\0';
+ }
+
+ }
+ return SOCKET_SUCC;
+}
+#endif
+
+int atci_sock_recv(int fd, char *buf, int len) {
+ int ret = 0;
+ int offset = 0;
+
+ while (offset < len) {
+ fd_set rfds;
+ FD_SET(fd, &rfds);
+ ret = select(fd + 1, &rfds, NULL, NULL, NULL);
+ if (ret < 0) {
+ if (errno == EINTR || errno == EAGAIN) {
+ continue;
+ }
+ RLOGE("atci_sock_recv select error, ret=%d, error=%s(%d),fd=%d", ret,
+ strerror(errno), errno, fd);
+ return SOCKET_FAIL;
+ } else if (ret == 0) {
+ continue;
+ }
+ if (FD_ISSET(fd, &rfds)) {
+ ret = recv(fd, buf + offset, len - offset, 0);
+ if (ret < 0) {
+ RLOGE("atci_sock_recv recv error, ret=%d, error=%s(%d),fd=%d", ret,
+ strerror(errno), errno, fd);
+ return SOCKET_FAIL;
+ } else if (ret == 0) {
+ RLOGE("atci_sock_recv recv error, ret=%d, error=%s(%d),fd=%d", ret,
+ strerror(errno), errno, fd);
+ return SOCKET_ZERO;
+ }
+ offset += ret;
+ }
+ }
+ return SOCKET_SUCC;
+}
+
+void sendAtciRequest(int request, char* reqStr, int argc, char** argv) {
+ //for dsds, should close two slot radio.
+ if(utils::is_support_dsds() && (request == RIL_REQUEST_RADIO_POWER)){
+ int enable = atoi(argv[1])? 1 : 0;
+ for(int i = 0; i < 2; i++) {
+ //For GCF, enhance AT%Flight=0. only SIM is inserted, radio can open.
+ if(enable){
+ if (Radio_capability_switch_util::is_sim_inserted(i)) {
+ RequestInfo* pRI = (RequestInfo*) (calloc(1, sizeof(RequestInfo)));
+ pRI->socket_id = (RIL_SOCKET_ID)i;
+ android::ATCIRequest(request, reqStr, (void*) (pRI), argc, argv);
+ } {
+ RLOGD("ignore radio power on command because of absent SIM Card");
+ }
+ } else {
+ RequestInfo* pRI = (RequestInfo*) (calloc(1, sizeof(RequestInfo)));
+ pRI->socket_id = (RIL_SOCKET_ID)i;
+ android::ATCIRequest(request, reqStr, (void*) (pRI), argc, argv);
+ }
+ }
+ } else {
+ RequestInfo* pRI = (RequestInfo*) (calloc(1, sizeof(RequestInfo)));
+ android::ATCIRequest(request, reqStr, (void*) (pRI), argc, argv);
+ }
+ return;
+}
+
+void * StartATCISocket(void *param) {
+ RLOGD("StartATCISocket start\n");
+ socklen_t server_len, client_len;
+ struct sockaddr_un atci_client_addr;
+ //struct sockaddr_in atci_client_addr;
+ char parser_buf[SOCKET_BUF_SIZE];
+ char *argv[ATCI_MAX_ARGS];
+ int argc = 0;
+
+ prctl(PR_SET_NAME, (unsigned long) "ATCI_Thr");
+
+ /* create socket */
+ unlink(ATCI_SERVER_SOCKET);
+ atci_server_socket_fd = socket(AF_UNIX, SOCK_STREAM, 0);
+ //atci_server_socket_fd = socket(AF_INET, SOCK_STREAM, 0);
+ if (atci_server_socket_fd == -1) {
+ RLOGE("Create ATCI Socket Failed:");
+ exit(1);
+ }
+ memset(&atci_server_addr, 0, sizeof(atci_server_addr));
+ atci_server_addr.sun_family = AF_UNIX;
+ //atci_server_addr.sin_family = AF_INET;
+ //atci_server_addr.sin_addr.s_addr = htonl(INADDR_ANY);
+ //atci_server_addr.sin_port = htons(10004);
+ strcpy(atci_server_addr.sun_path, ATCI_SERVER_SOCKET);
+ server_len = sizeof(atci_server_addr);
+ /* bind socket port*/
+ if (-1
+ == bind(atci_server_socket_fd, (struct sockaddr *) &atci_server_addr,
+ server_len)) {
+ RLOGE("Server Bind Failed:");
+ exit(1);
+ }
+
+ if (listen(atci_server_socket_fd, 1) == -1) {
+ RLOGE("listen fail!");
+ close(atci_server_socket_fd);
+ exit(1);
+ }
+#ifdef ATCI_PARSE
+ DbgMsg("init cmd handle");
+ if(/*atci_generic_init(NULL)||*/atci_cc_init(NULL)||atci_ss_init(NULL)||atci_sys_init(NULL)) {
+ ErrMsg("module init function error,exit");
+ exit(-1);
+ }
+#endif
+ TryNewLink:
+ client_len = sizeof(atci_client_addr);
+ int conn = accept(atci_server_socket_fd,
+ (struct sockaddr *) &atci_client_addr, &client_len);
+ if (conn <= 0) {
+ RLOGE("accept error!");
+ close(conn);
+ exit(1);
+ }
+ RLOGD("Accept a client , fd is %d", conn);
+ atci_client_connect = conn;
+ socketData recv_data;
+ int ret;
+ /* tranlate data */
+ while (true) {
+ if (!android::s_registerCalled) {
+ sleep(1);
+ continue;
+ }
+#ifdef ATCI_PARSE
+ memset(parser_buf, 0, sizeof(parser_buf));
+ ret = acti_cmd_recv(conn, parser_buf, SOCKET_BUF_SIZE);
+ if (ret < 0) {
+ RLOGE("receive CMD error");
+ continue;
+ } else if (ret == SOCKET_ZERO) {
+ RLOGE("maybe client socket closed 1. retry new link!");
+ goto TryNewLink;
+ }
+ atci_dispatch_cmd(parser_buf);
+#else
+ memset(parser_buf, 0, sizeof(parser_buf));
+ memset(&recv_data, 0, sizeof(socketData));
+
+ //receive_ID
+ ret = atci_sock_recv(conn, (char*) &recv_data.requestId,
+ sizeof(recv_data.requestId));
+ if (ret < 0) {
+ RLOGE("reveive request id is error");
+ continue;
+ } else if (ret == SOCKET_ZERO) {
+ RLOGE("maybe client socket closed 1. retry new link!");
+ goto TryNewLink;
+ }
+ RLOGE("reveive request id is %d", recv_data.requestId);
+
+ //receive_length
+ ret = atci_sock_recv(conn, (char*) &recv_data.datalen,
+ sizeof(recv_data.datalen));
+ if (ret < 0) {
+ RLOGE("reveive request lenth is error");
+ continue;
+ } else if (ret == SOCKET_ZERO) {
+ RLOGE("maybe client socket closed 2. retry new link!");
+ goto TryNewLink;
+ }
+ RLOGE("reveive request lenth is %d", recv_data.datalen);
+
+ //receive_data
+ recv_data.data = (char*) calloc(recv_data.datalen, 1);
+ if (NULL == recv_data.data) {
+ RLOGE("alloc mem error");
+ continue;
+ }
+ ret = atci_sock_recv(conn, recv_data.data, recv_data.datalen);
+ if (ret < 0) {
+ RLOGE("reveive request data is error");
+ free(recv_data.data);
+ recv_data.data = NULL;
+ continue;
+ } else if (ret == SOCKET_ZERO) {
+ RLOGE("maybe client socket closed 3. retry new link!");
+ free(recv_data.data);
+ recv_data.data = NULL;
+ goto TryNewLink;
+ }
+
+ int reqNum = ATCIParserRequest(recv_data.requestId);
+ if (reqNum <= 0) {
+ RLOGE("ATCI command is error!");
+ continue;
+ }
+
+ int request = MappingATCI2RIL(reqNum);
+ char reqStr[RIL_REQUEST_STRING_LENGTH];
+
+ memcpy(reqStr, request2RILStr(request),
+ strlen(request2RILStr(request)) + 1);
+ RLOGD("request is %s", reqStr);
+ argc = MappingParameter(reqNum, recv_data.datalen, recv_data.data,
+ parser_buf, argv);
+ if (argc <= 0) {
+ RLOGE("ATCI command is error!");
+ continue;
+ }
+ free(recv_data.data);
+ recv_data.data = NULL;
+ sendAtciRequest(request, reqStr, argc, argv);
+#endif
+ };
+
+ RLOGD("close socket fd!");
+ close(atci_server_socket_fd);
+
+ RLOGD("exist start ATCI socket thread, errno:%d", errno);
+ // kill self to restart on error
+ kill(0, SIGKILL);
+ return NULL;
+}
+
+#ifdef ATCI_PARSE
+char* atci_get_cmd_prefix(char *line) {
+ int buf_len;
+ char *prefix;
+ char *end_ptr;
+ if (NULL == line) {
+ RLOGD("input is null");
+ return NULL;
+ }
+ end_ptr = line;
+ while (!ATCI_IS_CAHR(*end_ptr, ATCI_EQUAL)
+ && !ATCI_IS_CAHR(*end_ptr, ATCI_QUESTION_MARK)
+ && !ATCI_IS_CAHR(*end_ptr, ATCI_END_CHAR)
+ && !ATCI_IS_CAHR(*end_ptr, ATCI_CR) && !ATCI_IS_CAHR(*end_ptr, ATCI_LF)) {
+ end_ptr++;
+ }
+ buf_len = end_ptr - line + 1;
+ prefix = (char *) calloc(buf_len, 1);
+ if (prefix) {
+ int i;
+ char *in_ptr = line;
+ char *out_ptr = prefix;
+ for (i = 0; i < buf_len - 1; i++) {
+ if (!ATCI_IS_CAHR(*in_ptr, ATCI_SPACE)) {
+ *out_ptr = ATCI_UPPER_TO_LOWER(*in_ptr);
+ out_ptr++;
+ }
+ in_ptr++;
+ }
+ *out_ptr = ATCI_END_CHAR;
+ }
+ RLOGD("get cmd prefix [%d][%s]", buf_len, prefix);
+ return prefix;
+}
+
+int atci_get_cmd_mode(char *line) {
+ int reasult = AT_WRONG_MODE;
+ char *p_cur = NULL;
+ if (NULL == line) {
+ reasult = AT_WRONG_MODE;
+ RLOGD("atci_get_cmd_mode error, input is NULL");
+ return reasult;
+ }
+ p_cur = strchr(line, ATCI_EQUAL);
+ if (NULL == p_cur) {
+ p_cur = strchr(line, ATCI_QUESTION_MARK);
+ if (NULL == p_cur) {
+ reasult = AT_ACTIVE_MODE;
+ } else {
+ reasult = AT_READ_MODE;
+ }
+ } else {
+ p_cur++;
+ atci_at_skip_space(&p_cur);
+ if (ATCI_QUESTION_MARK == *p_cur) {
+ reasult = AT_TEST_MODE;
+ } else {
+ reasult = AT_SET_MODE;
+ }
+ }
+ RLOGD("atci_get_cmd_mode success[%d]", reasult);
+ return reasult;
+}
+
+int atci_dispatch_cmd(char *line) {
+ int ret = SYS_FAIL;
+ char *prefix = NULL;
+ //atci_Info_t* atci_ptr = atci_info_get();
+ atci_cmd_type_t* cmd_handle = NULL;
+ if (NULL == line) {
+ RLOGD("CMD is null");
+ return SYS_FAIL;
+ }
+ RLOGD("enter: %s", line);
+
+ prefix = atci_get_cmd_prefix(line);
+ if (NULL == prefix) {
+ RLOGD("atci_cut_cmd_prefix error");
+ return SYS_FAIL;
+ }
+ RLOGD("find prefix [%s]", prefix);
+ cmd_handle = atci_find_cmd_handler(prefix);
+ free(prefix);
+ if (NULL == cmd_handle) {
+ RLOGD("not find handler");
+ } else {
+ RLOGD("find handler");
+ int cmd_mode = atci_get_cmd_mode(line);
+ char response[MAX_RESP_BUF_LENGTH];
+ memset(response, 0, sizeof(response));
+ RLOGD("write to handler");
+ ret = cmd_handle->cmd_handle_func(line, cmd_mode, cmd_handle->target,
+ response);
+ if (SYS_FAIL == ret) {
+ RLOGD("cmd_handle_func error");
+ } else {
+ RLOGD("cmd_handle_func success");
+ }
+ }
+ return ret;
+}
+#endif
diff --git a/src/lynq/lib/liblynq-tele-ril/lynq-riltel/atci/ATCI.h b/src/lynq/lib/liblynq-tele-ril/lynq-riltel/atci/ATCI.h
new file mode 100644
index 0000000..45f9d4f
--- /dev/null
+++ b/src/lynq/lib/liblynq-tele-ril/lynq-riltel/atci/ATCI.h
@@ -0,0 +1,151 @@
+/* Copyright Statement:
+ *
+ * This software/firmware and related documentation ("MediaTek Software") are
+ * protected under relevant copyright laws. The information contained herein
+ * is confidential and proprietary to MediaTek Inc. and/or its licensors.
+ * Without the prior written permission of MediaTek inc. and/or its licensors,
+ * any reproduction, modification, use or disclosure of MediaTek Software,
+ * and information contained herein, in whole or in part, shall be strictly prohibited.
+ */
+/* MediaTek Inc. (C) 2010. All rights reserved.
+ *
+ * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
+ * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
+ * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER ON
+ * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
+ * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
+ * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
+ * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH
+ * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES
+ * THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES
+ * CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK
+ * SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
+ * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND
+ * CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
+ * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
+ * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO
+ * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
+ *
+ * The following software/firmware and/or related documentation ("MediaTek Software")
+ * have been modified by MediaTek Inc. All revisions are subject to any receiver's
+ * applicable license agreements with MediaTek Inc.
+ */
+#ifndef __ATCI__
+#define __ATCI__
+
+#include "atci_common.h"
+
+#define PHONE_NUMBER_LENGTH 256
+//#define SPI_URI_LENGTH 256
+#define ATCI_SERVER_SOCKET "/dev/socket/atci_server_socket"
+#define SOCKET_BUF_SIZE 1024
+#if ATCI_ENABLE_RESPONSE
+#define RESPONSE_BUF_SIZE 512
+#endif
+#define COMMAND_LENGTH 1024
+#define ATCI_MAX_ARGS 10
+#define RIL_REQUEST_STRING_LENGTH 128
+#define TELEPHONY_REQUEST_BASE 0
+#define TELEPHONY_RESPONSE_BASE 1000
+
+#define TELEPHONY_REQUEST_SET_CALL_FORWARD (TELEPHONY_REQUEST_BASE + 1)
+#define TELEPHONY_REQUEST_SET_CALL_WAITING (TELEPHONY_REQUEST_BASE + 2)
+#define TELEPHONY_REQUEST_SET_CALL_BARRING (TELEPHONY_REQUEST_BASE + 3)
+#define TELEPHONY_REQUEST_DIAL (TELEPHONY_REQUEST_BASE + 4)
+#define TELEPHONY_REQUEST_DROP_CONF_CALL_MEMBER (TELEPHONY_REQUEST_BASE + 5)
+#define TELEPHONY_REQUEST_FLIGHT (TELEPHONY_REQUEST_BASE + 6)
+#define TELEPHONY_REQUEST_SET_MUTE (TELEPHONY_REQUEST_BASE + 7)
+#define TELEPHONY_REQUEST_MERGE_CONF_CALLS (TELEPHONY_REQUEST_BASE + 8)
+#define TELEPHONY_REQUEST_CREATE_IMS_CONF_CALL (TELEPHONY_REQUEST_BASE +9)
+#define TELEPHONY_REQUEST_DIAL_WITH_SIP_URI (TELEPHONY_REQUEST_BASE +10)
+
+#define TELEPHONY_RESPONSE_FLIGHT (TELEPHONY_RESPONSE_BASE + 1)
+
+#if ATCI_ENABLE_RESPONSE
+extern char Respose_buf[RESPONSE_BUF_SIZE];
+#endif
+//request struct
+typedef struct {
+ int status;
+ int reason;
+ int service_class;
+ int toa;
+ char number[PHONE_NUMBER_LENGTH];
+ int time_seconds;
+} telephonyRequestSetCallForward;
+
+typedef struct {
+ int status;
+ int service_class;
+} telephonyRequestSetCallWaiting;
+
+typedef struct {
+ int status;
+ char facility[32];
+ char password[32];
+ int serviceClass;
+ char aid[32];
+} telephonyRequestSetCallBarring;
+
+typedef struct {
+ int clir;
+ char phonyNumber[PHONE_NUMBER_LENGTH];
+} telephonyRequestDial;
+
+typedef struct {
+ int confCallID;
+ char phonyNumber[PHONE_NUMBER_LENGTH];
+ int callIDToAdd;
+} telephonyRequestDropConfCallMember;
+
+typedef struct {
+ unsigned int flightModeOn;
+} telephonyRequestFlight;
+
+typedef struct {
+ int isMute;
+} telephonyRequestSetMute;
+
+typedef struct {
+ int reserve;
+} telephonyRequestCreateIMSConfCall;
+
+//response struct
+typedef struct {
+ int ret;
+} telephonyResponseFlight;
+
+#if 1 //socket data protocol.
+typedef struct {
+ int requestId;
+ int datalen;
+ char * data;
+} socketData;
+#endif
+
+#ifdef ATCI_PARSE
+
+#define MAX(a,b) ((a)>(b)?(a):(b))
+
+typedef enum {
+ INCH_TYPE_MIN = 0,
+ INCH_TYPE_UART,
+ INCH_TYPE_CHAR,
+ INCH_TYPE_UTCP,
+ INCH_TYPE_MAX
+} atci_inch_type_e;
+
+typedef struct atci_num_resp_s {
+ char resp[20];
+ int num;
+} atci_num_resp_t;
+
+void sendAtciRequest(int request, char* reqStr, int argc, char** argv);
+#endif
+
+void ATCIResponse(int token, int error, char* data, int reqNum);
+
+void * StartATCISocket(void *param);
+#endif
diff --git a/src/lynq/lib/liblynq-tele-ril/lynq-riltel/atci/atci_at_util.cpp b/src/lynq/lib/liblynq-tele-ril/lynq-riltel/atci/atci_at_util.cpp
new file mode 100644
index 0000000..027d924
--- /dev/null
+++ b/src/lynq/lib/liblynq-tele-ril/lynq-riltel/atci/atci_at_util.cpp
@@ -0,0 +1,104 @@
+#include "atci_common.h"
+#include "atci_at_util.h"
+
+int atci_at_skip_space(char **p_cur) {
+ if (*p_cur == NULL) {
+ return SYS_FAIL;
+ }
+ while (**p_cur == ATCI_SPACE) {
+ (*p_cur)++;
+ }
+ return SYS_SUCC;
+}
+int atci_at_hasmore(char **p_cur) {
+ if (*p_cur == NULL || **p_cur == ATCI_END_CHAR) {
+ return SYS_FAIL;
+ }
+ return SYS_SUCC;
+}
+
+int atci_at_to_equal(char **p_cur) {
+ if (*p_cur == NULL) {
+ return SYS_FAIL;
+ }
+ *p_cur = strchr(*p_cur, ATCI_EQUAL);
+ if (*p_cur == NULL) {
+ return SYS_FAIL;
+ }
+ (*p_cur)++;
+ return SYS_SUCC;
+}
+int atci_at_to_colon(char **p_cur) {
+ if (*p_cur == NULL) {
+ return SYS_FAIL;
+ }
+ *p_cur = strchr(*p_cur, ATCI_COLON);
+ if (*p_cur == NULL) {
+ return SYS_FAIL;
+ }
+ (*p_cur)++;
+ return SYS_SUCC;
+}
+int atci_at_skip_next_comma(char **p_cur) {
+ if (*p_cur == NULL) {
+ return SYS_FAIL;
+ }
+ *p_cur = strchr(*p_cur, ATCI_COMMA);
+ if (*p_cur == NULL) {
+ return SYS_FAIL;
+ }
+ (*p_cur)++;
+ return SYS_SUCC;
+}
+int atci_at_get_next_key(char **p_cur, char **p_out) {
+ if (*p_cur == NULL) {
+ return SYS_FAIL;
+ }
+ atci_at_skip_space(p_cur);
+ if (**p_cur == ATCI_DOUBLE_QUOTE) {
+ (*p_cur)++;
+ *p_out = strsep(p_cur, "\"");
+ atci_at_skip_next_comma(p_cur);
+ } else {
+ *p_out = strsep(p_cur, ",");
+ }
+ return SYS_SUCC;
+}
+
+/**
+ * Parses the next integer in the line and places it in *p_out
+ * "uns" is indicate in unsigned or not
+ * returns SYS_SUCC on success
+ * returns SYS_FAIL on fail
+ * updates *p_cur
+ * "base" is the same as the base param in strtol
+ */
+int atci_at_get_nextint_base(char **p_cur, int *p_out, int base, int uns) {
+ char *ret;
+ if (*p_cur == NULL) {
+ return SYS_FAIL;
+ }
+ if (SYS_FAIL == atci_at_get_next_key(p_cur, &ret)) {
+ return SYS_FAIL;
+ } else {
+ long l;
+ char *end;
+ if (uns) {
+ l = strtoul(ret, &end, base);
+ } else {
+ l = strtol(ret, &end, base);
+ }
+ *p_out = (int) l;
+ if (end == ret) {
+ return SYS_FAIL;
+ }
+ }
+ return SYS_SUCC;
+}
+int atci_at_get_nextint(char **p_cur, int *p_out) {
+ return atci_at_get_nextint_base(p_cur, p_out, 10, 0);
+}
+int atci_at_get_nexthexint(char **p_cur, int *p_out) {
+ return atci_at_get_nextint_base(p_cur, p_out, 16, 1);
+}
+
diff --git a/src/lynq/lib/liblynq-tele-ril/lynq-riltel/atci/atci_at_util.h b/src/lynq/lib/liblynq-tele-ril/lynq-riltel/atci/atci_at_util.h
new file mode 100644
index 0000000..dfcc324
--- /dev/null
+++ b/src/lynq/lib/liblynq-tele-ril/lynq-riltel/atci/atci_at_util.h
@@ -0,0 +1,13 @@
+#ifndef _ATCI_AT_UTIL_H_
+#define _ATCI_AT_UTIL_H_
+
+int atci_at_skip_space(char **p_cur);
+int atci_at_hasmore(char **p_cur);
+int atci_at_to_equal(char **p_cur);
+int atci_at_to_colon(char **p_cur);
+int atci_at_skip_next_comma(char **p_cur);
+int atci_at_get_nextint_base(char **p_cur, int *p_out, int base, int uns);
+int atci_at_get_nextint(char **p_cur, int *p_out);
+int atci_at_get_nexthexint(char **p_cur, int *p_out);
+int atci_at_get_next_key(char **p_cur, char **p_out);
+#endif
diff --git a/src/lynq/lib/liblynq-tele-ril/lynq-riltel/atci/atci_cc_cmd.cpp b/src/lynq/lib/liblynq-tele-ril/lynq-riltel/atci/atci_cc_cmd.cpp
new file mode 100644
index 0000000..8a41e90
--- /dev/null
+++ b/src/lynq/lib/liblynq-tele-ril/lynq-riltel/atci/atci_cc_cmd.cpp
@@ -0,0 +1,293 @@
+#include <vendor-ril/telephony/ril.h>
+#include <string.h>
+#include <log/log.h>
+
+#include "ATCI.h"
+#include "atci_util.h"
+#include "atci_at_util.h"
+#include "atci_cc_cmd.h"
+#include "atci_common.h"
+
+#undef LOG_TAG
+#define LOG_TAG "DEMO_ATCI_CC"
+
+atci_cmd_type_t atci_cc_cmd_table[] = {
+//cmd_name target_type handler
+ { "at%dial", TARGET_TELEPHONY, atci_cc_dial_hdlr },
+ { "at%mute", TARGET_TELEPHONY, atci_cc_mute_hdlr },
+ { "at%conference", TARGET_TELEPHONY, atci_cc_conference_hdlr },
+ { NULL, TARGET_UNKNOWN, NULL }
+};
+
+int atci_cc_init(void *arg) {
+ int ret;
+ ret = atci_cmd_register(atci_cc_cmd_table);
+ return ret;
+}
+
+int atci_cc_mute_hdlr(char *cmd, int op_mode, int target, char *response) {
+ int ret;
+ switch (op_mode) {
+ case AT_SET_MODE:
+ case AT_READ_MODE:
+ case AT_ACTIVE_MODE:
+ case AT_TEST_MODE: {
+ //paser parameter
+ //send to target handle
+ //ex: at%dial=int,string
+ RLOGD("input cmd[%s]", cmd);
+
+ if (SYS_FAIL == atci_at_to_equal(&cmd)) {
+ //input error
+ return SYS_FAIL;
+ break;
+ }
+
+ RLOGD("reamin data is[%s]", cmd);
+ // get isMute(int)
+
+ int isMute;
+
+ if (SYS_FAIL == atci_at_get_nexthexint(&cmd, &isMute)) {
+ return SYS_FAIL;
+ break;
+ }
+
+ RLOGD("isMute value is %d", isMute);
+
+ //wrire data to target
+ atci_data_req_t req;
+ req.request_id = RIL_REQUEST_SET_MUTE;
+ req.data_len = sizeof(int);
+ req.data = &isMute;
+ RLOGD("input req data");
+
+ char parser_buf[SOCKET_BUF_SIZE] = { 0 };
+ char reqStr[RIL_REQUEST_STRING_LENGTH] = {0};
+ memcpy(reqStr, request2RILStr(req.request_id),
+ strlen(request2RILStr(req.request_id)) + 1);
+ RLOGD("request is %s", reqStr);
+ char* argv[2] = { 0 };
+ argv[0] = reqStr;
+ argv[1] = parser_buf;
+ sprintf(argv[1], "%d", isMute);
+ int argc = 2;
+ RLOGD("RIL_REQUEST_SET_MUTE (%d) ",argv[1]);
+ sendAtciRequest(req.request_id, reqStr, argc, argv);
+ break;
+ }
+ default: {
+ RLOGD("set mute error");
+ break;
+ }
+ }
+ return SYS_SUCC;
+}
+
+int atci_cc_conference_hdlr(char *cmd, int op_mode, int target,
+ char *response) {
+ int ret;
+ int op = -1;
+
+ switch (op_mode) {
+ case AT_SET_MODE:
+ case AT_READ_MODE:
+ case AT_ACTIVE_MODE:
+ case AT_TEST_MODE: {
+ //paser parameter
+ //send to target handle
+ //ex: at%dial=int,string
+ RLOGD("input cmd[%s]", cmd);
+
+ if (SYS_FAIL == atci_at_to_equal(&cmd)) {
+ //input error
+ return SYS_FAIL;
+ break;
+ }
+
+ RLOGD("remain data is[%s]", cmd);
+
+ if (SYS_FAIL == atci_at_get_nexthexint(&cmd, &op)) {
+ return SYS_FAIL;
+ break;
+ }
+
+ if (op > 2 || op < 0) {
+ RLOGD("data op code %d is wrong!", op);
+ return SYS_FAIL;
+ break;
+ }
+
+ //wrire data to target
+ atci_data_req_t req;
+ if (op == 0) {
+ req.request_id = RIL_REQUEST_CONFERENCE;
+ RLOGD("request id is RIL_REQUEST_CONFERENCE!\n");
+
+ char reqStr[RIL_REQUEST_STRING_LENGTH] = {0};
+ memcpy(reqStr, request2RILStr(req.request_id),
+ strlen(request2RILStr(req.request_id)) + 1);
+ RLOGD("request is %s", reqStr);
+ char* argv[1] = { 0 };
+ argv[0] = reqStr;
+ int argc = 1;
+ sendAtciRequest(req.request_id, reqStr, argc, argv);
+ }
+//TBD
+ else {
+ req.request_id = RIL_REQUEST_CONFERENCE_DIAL;
+ RLOGD("request id is RIL_REQUEST_CONFERENCE_DIAL");
+ int argc = 1;
+ char* cPoint;
+ char parser_buf[SOCKET_BUF_SIZE] = { 0 };
+ char reqStr[RIL_REQUEST_STRING_LENGTH] = {0};
+ cPoint = parser_buf;
+ memcpy(reqStr, request2RILStr(req.request_id),
+ strlen(request2RILStr(req.request_id)) + 1);
+ char* argv[4] = { 0 };
+ argv[0] = reqStr;
+
+ //cmd parameter sequence: DialMethod, ParticipantsNumber, addresses, clir;
+ argv[1] = cPoint; //DialMethod
+ sprintf(argv[1], "%d", 0);
+ cPoint += sizeof(int);
+
+ argv[2] = cPoint; //ParticipantsNumber
+ sprintf(argv[2], "%d", 0);
+ cPoint += sizeof(int);
+ //no address
+ argv[3] = cPoint; //CLIR
+ sprintf(argv[2], "%s", "0");
+
+ argc += 3;
+ RLOGD("RIL_REQUEST_CONFERENCE_DIAL dialMethod(%d) PhoneNumber(%d),clir(%s)",
+ argv[1], argv[2], argv[3]);
+ sendAtciRequest(req.request_id, reqStr, argc, argv);
+ }
+ }
+ default: {
+ RLOGD("conference error");
+ break;
+ }
+ }
+ return SYS_SUCC;
+}
+
+int atci_cc_dial_hdlr(char *cmd, int op_mode, int target, char *response) {
+ int ret;
+ int op = -1;
+ int uriflag = 0;
+ char *tmp = NULL;
+ char *p_out = NULL;
+ char ch_tmp;
+ int i = 0;
+
+ switch (op_mode) {
+ case AT_SET_MODE:
+ case AT_READ_MODE:
+ case AT_ACTIVE_MODE:
+ case AT_TEST_MODE: {
+ //paser parameter
+ //send to target handle
+ //ex: at%dial=int,string
+ RLOGD("input cmd[%s]", cmd);
+
+ telephonyRequestDial dial_info;
+ dial_info.clir = 0;
+
+ if (SYS_FAIL == atci_at_to_equal(&cmd)) {
+ //input error
+ return SYS_FAIL;
+ break;
+ }
+
+ RLOGD("remain data is[%s]", cmd);
+
+ tmp = cmd;
+
+ if (SYS_FAIL == atci_at_get_nexthexint(&cmd, &op)) {
+ //return SYS_FAIL;
+ //break ;
+ op = -1;
+ }
+
+ RLOGD("operation info is %d", op);
+
+ if (op >= 0 && op < 5) {
+ // get number (string)
+ if (SYS_FAIL == atci_at_hasmore(&cmd)) {
+ return SYS_FAIL;
+ break;
+ }
+
+ if (SYS_FAIL == atci_at_get_next_key(&cmd, &p_out)) {
+ return SYS_FAIL;
+ break;
+ }
+
+ strcpy(dial_info.phonyNumber, p_out);
+
+ RLOGD("read string is %s", dial_info.phonyNumber);
+ } else {
+ if (SYS_FAIL == atci_at_get_next_key(&tmp, &p_out)) {
+ return SYS_FAIL;
+ break;
+ }
+
+ strcpy(dial_info.phonyNumber, p_out);
+
+ RLOGD("read string is %s", dial_info.phonyNumber);
+ }
+
+ //wrire data to target
+ atci_data_req_t req;
+
+ for (i = 0; i < strlen(dial_info.phonyNumber); i++) {
+ ch_tmp = dial_info.phonyNumber[i];
+ if ((ch_tmp < '0' || ch_tmp > '9') && ch_tmp != '+') {
+ uriflag = 1;
+ break;
+ }
+ }
+
+ if (uriflag == 0) {
+ req.request_id = RIL_REQUEST_DIAL;
+ RLOGD("request id is RIL_REQUEST_DIAL!\n");
+ } else {
+ req.request_id = RIL_REQUEST_DIAL_WITH_SIP_URI;
+ RLOGD("request id is TELEPHONY_REQUEST_DIAL_WITH_SIP_URI!\n");
+ }
+
+ req.data_len = sizeof(dial_info);
+ req.data = &dial_info;
+
+ int argc = 1;
+ char* cPoint;
+ char parser_buf[SOCKET_BUF_SIZE] = { 0 };
+ char reqStr[RIL_REQUEST_STRING_LENGTH] = {0};
+ cPoint = parser_buf;
+ memcpy(reqStr, request2RILStr(req.request_id),
+ strlen(request2RILStr(req.request_id)) + 1);
+ char* argv[3] = { 0 };
+ argv[0] = reqStr;
+
+ argv[2] = cPoint; //clir
+ cPoint += sizeof(dial_info.clir);
+ sprintf(argv[2], "%d", dial_info.clir);
+
+ argv[1] = cPoint; //phonyNumber
+ sprintf(argv[1], "%s", dial_info.phonyNumber);
+
+ argc += 2;
+ RLOGD("%s(%s) PhoneNumber(%s)", reqStr, argv[2], argv[1]);
+ sendAtciRequest(req.request_id, reqStr, argc, argv);
+ break;
+ }
+ default: {
+ RLOGD("dial error");
+ break;
+ }
+ }
+ return SYS_SUCC;
+}
+
diff --git a/src/lynq/lib/liblynq-tele-ril/lynq-riltel/atci/atci_cc_cmd.h b/src/lynq/lib/liblynq-tele-ril/lynq-riltel/atci/atci_cc_cmd.h
new file mode 100644
index 0000000..a532180
--- /dev/null
+++ b/src/lynq/lib/liblynq-tele-ril/lynq-riltel/atci/atci_cc_cmd.h
@@ -0,0 +1,13 @@
+/*
+ This is an internal header file.
+ */
+#ifndef __ATCI_CC_CMD_H__
+#define __ATCI_CC_CMD_H__
+
+int atci_cc_init(void *arg);
+int atci_cc_dial_hdlr(char *cmd, int op_type, int target, char *response);
+int atci_cc_conference_hdlr(char *cmd, int op_mode, int target, char *response);
+int atci_cc_mute_hdlr(char *cmd, int op_mode, int target, char *response);
+
+#endif
+
diff --git a/src/lynq/lib/liblynq-tele-ril/lynq-riltel/atci/atci_common.h b/src/lynq/lib/liblynq-tele-ril/lynq-riltel/atci/atci_common.h
new file mode 100644
index 0000000..01e738a
--- /dev/null
+++ b/src/lynq/lib/liblynq-tele-ril/lynq-riltel/atci/atci_common.h
@@ -0,0 +1,162 @@
+//ATCI Service atcmd
+#ifndef _ATCI_COMMON_H_
+#define _ATCI_COMMON_H_
+
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <netinet/in.h>
+#include <sys/un.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <pthread.h>
+#include <fcntl.h>
+#include <termios.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <signal.h>
+#ifndef ATCI_UT
+#include "log/log.h"
+//#include <sncfg/sncfg.h>
+#include <cutils/properties.h>
+#endif
+#define SYS_SUCC 0
+#define SYS_FAIL -1
+#define INVALIDE_FD -1
+#define MAX_CMD_BUF_LENGTH 4096
+#define MAX_RESP_BUF_LENGTH 4096
+#define MUX_APP_NUM 5
+#define MAX_CMD_HANDLER_MODULE_NUM 20
+#define MAX_CMD_PREFIX_LENGTH 64
+#undef LOG_TAG
+#define LOG_TAG "ATCI"
+
+typedef enum {
+ ATCI_SPACE = ' ',
+ ATCI_EQUAL = '=',
+ ATCI_COMMA = ',',
+ ATCI_SEMICOLON = ';',
+ ATCI_COLON = ':',
+ ATCI_AT = '@',
+ ATCI_HAT = '^',
+ ATCI_MONEY = '$',
+ ATCI_DOUBLE_QUOTE = '"',
+ ATCI_QUESTION_MARK = '?',
+ ATCI_EXCLAMATION_MARK = '!',
+ ATCI_FORWARD_SLASH = '/',
+ ATCI_L_ANGLE_BRACKET = '<',
+ ATCI_R_ANGLE_BRACKET = '>',
+ ATCI_R_BRACKET = ')',
+ ATCI_L_BRACKET = '(',
+ ATCI_L_SQ_BRACKET = '[',
+ ATCI_R_SQ_BRACKET = ']',
+ ATCI_L_CURLY_BRACKET = '{',
+ ATCI_R_CURLY_BRACKET = '}',
+ ATCI_CHAR_STAR = '*',
+ ATCI_CHAR_POUND = '#',
+ ATCI_CHAR_AMPSAND = '&',
+ ATCI_CHAR_PERCENT = '%',
+ ATCI_CHAR_PLUS = '+',
+ ATCI_CHAR_MINUS = '-',
+ ATCI_CHAR_DOT = '.',
+ ATCI_CHAR_ULINE = '_',
+ ATCI_CHAR_TILDE = '~',
+ ATCI_CHAR_REVERSE_SOLIDUS = '\\',
+ ATCI_CHAR_VERTICAL_LINE = '|',
+ ATCI_END_CHAR = '\0',
+ ATCI_CR = '\r',
+ ATCI_LF = '\n',
+ ATCI_CHAR_0 = '0',
+ ATCI_CHAR_1 = '1',
+ ATCI_CHAR_2 = '2',
+ ATCI_CHAR_3 = '3',
+ ATCI_CHAR_4 = '4',
+ ATCI_CHAR_5 = '5',
+ ATCI_CHAR_6 = '6',
+ ATCI_CHAR_7 = '7',
+ ATCI_CHAR_8 = '8',
+ ATCI_CHAR_9 = '9',
+ ATCI_CHAR_A = 'A',
+ ATCI_CHAR_B = 'B',
+ ATCI_CHAR_C = 'C',
+ ATCI_CHAR_D = 'D',
+ ATCI_CHAR_E = 'E',
+ ATCI_CHAR_F = 'F',
+ ATCI_CHAR_G = 'G',
+ ATCI_CHAR_H = 'H',
+ ATCI_CHAR_I = 'I',
+ ATCI_CHAR_J = 'J',
+ ATCI_CHAR_K = 'K',
+ ATCI_CHAR_L = 'L',
+ ATCI_CHAR_M = 'M',
+ ATCI_CHAR_N = 'N',
+ ATCI_CHAR_O = 'O',
+ ATCI_CHAR_P = 'P',
+ ATCI_CHAR_Q = 'Q',
+ ATCI_CHAR_R = 'R',
+ ATCI_CHAR_S = 'S',
+ ATCI_CHAR_T = 'T',
+ ATCI_CHAR_U = 'U',
+ ATCI_CHAR_V = 'V',
+ ATCI_CHAR_W = 'W',
+ ATCI_CHAR_X = 'X',
+ ATCI_CHAR_Y = 'Y',
+ ATCI_CHAR_Z = 'Z',
+ ATCI_CHAR_a = 'a',
+ ATCI_CHAR_b = 'b',
+ ATCI_CHAR_c = 'c',
+ ATCI_CHAR_d = 'd',
+ ATCI_CHAR_e = 'e',
+ ATCI_CHAR_f = 'f',
+ ATCI_CHAR_g = 'g',
+ ATCI_CHAR_h = 'h',
+ ATCI_CHAR_i = 'i',
+ ATCI_CHAR_j = 'j',
+ ATCI_CHAR_k = 'k',
+ ATCI_CHAR_l = 'l',
+ ATCI_CHAR_m = 'm',
+ ATCI_CHAR_n = 'n',
+ ATCI_CHAR_o = 'o',
+ ATCI_CHAR_p = 'p',
+ ATCI_CHAR_q = 'q',
+ ATCI_CHAR_r = 'r',
+ ATCI_CHAR_s = 's',
+ ATCI_CHAR_t = 't',
+ ATCI_CHAR_u = 'u',
+ ATCI_CHAR_v = 'v',
+ ATCI_CHAR_w = 'w',
+ ATCI_CHAR_x = 'x',
+ ATCI_CHAR_y = 'y',
+ ATCI_CHAR_z = 'z',
+} atci_char_enum;
+
+typedef enum {
+ AT_WRONG_MODE, AT_SET_MODE, //Ex: at+eample=xxx
+ AT_READ_MODE, //Ex: at+eample?
+ AT_TEST_MODE, //Ex: at+eample=?
+ AT_ACTIVE_MODE //Ex: at+eample
+} atci_cmd_mode_e;
+
+typedef enum {
+ TARGET_TELEPHONY = 0,
+ /*if need send to new app, add target_type */
+ TARGET_UNKNOWN = MUX_APP_NUM,
+ TARGET_RIL,
+ TARGET_GENERIC,
+ TARGET_PLATFORM,
+ TARGET_BATTERY,
+ TARGET_AUDIO,
+ TARGET_EXTERNAL
+} atci_target_e;
+
+#define ATCI_LOWER_TO_UPPER(alpha_char) (((alpha_char >= ATCI_CHAR_a)&&(alpha_char <= ATCI_CHAR_z)) ? (alpha_char-32): (alpha_char))
+#define ATCI_UPPER_TO_LOWER(alpha_char) (((alpha_char >= ATCI_CHAR_A)&&(alpha_char <= ATCI_CHAR_Z)) ? (alpha_char+32): (alpha_char))
+#define ATCI_IS_CAHR(input ,alpha_char) ((alpha_char == input)? 1 : 0)
+
+#define SysMsg(f,a...) RLOGI("( %s, %d: )" f "\n",__FUNCTION__, __LINE__,## a)
+#define DbgMsg(f,a...) RLOGD("( %s, %d: )" f "\n",__FUNCTION__, __LINE__,## a)
+#define ErrMsg(f,a...) RLOGE("( %s, %d: )" f "\n",__FUNCTION__, __LINE__,## a)
+
+#endif
diff --git a/src/lynq/lib/liblynq-tele-ril/lynq-riltel/atci/atci_ss_cmd.cpp b/src/lynq/lib/liblynq-tele-ril/lynq-riltel/atci/atci_ss_cmd.cpp
new file mode 100644
index 0000000..ffcafea
--- /dev/null
+++ b/src/lynq/lib/liblynq-tele-ril/lynq-riltel/atci/atci_ss_cmd.cpp
@@ -0,0 +1,371 @@
+#include <vendor-ril/telephony/ril.h>
+#include <string.h>
+#include <log/log.h>
+
+#include "ATCI.h"
+#include "atci_util.h"
+#include "atci_at_util.h"
+#include "atci_ss_cmd.h"
+
+#undef LOG_TAG
+#define LOG_TAG "DEMO_ATCI_SS"
+atci_cmd_type_t atci_ss_cmd_table[] = {
+ //cmd_name target_type handler
+ { "at%supplementaryservice", TARGET_TELEPHONY, atci_ss_hdlr },
+ { NULL, TARGET_UNKNOWN, NULL }
+};
+
+int atci_ss_init(void *arg) {
+ int ret;
+ ret = atci_cmd_register(atci_ss_cmd_table);
+ return ret;
+}
+
+char *InfoClassToMmiBSCodeString(AtInfoClassE infoClass) {
+ /**
+ * Basic Service
+ * group number (note) Telecommunication Service MMI Service Code
+ *
+ * 1 to 12 All tele and bearer services no code required
+ *
+ * Teleservices
+ * 1 to 6, 12 All teleservices 10
+ * 1 Telephony 11
+ * 2 to 6 All data teleservices 12
+ * 6 Facsimile services 13
+ * 2 Short Message Services 16
+ * 1, 3 to 6, 12 All teleservices except SMS 19
+ * 12 Voice group services
+ * Voice Group Call Service (VGCS) 17
+ * Voice Broadcast Service (VBS) 18
+ *
+ * Bearer Service
+ * 7 to 11 All bearer services 20
+ * 7 All async services 21
+ * 8 All sync services 22
+ * 8 All data circuit sync 24
+ * 7 All data circuit async 25
+ * 13 All GPRS bearer services 99
+ */
+
+ switch (infoClass) {
+ case CLASS_NONE:
+ return BS_ALL;
+ break;
+ case CLASS_VOICE:
+ return BS_TELEPHONY;
+ break;
+ case (CLASS_DATASYNC_OR_DATAASYNC):
+ return BS_DATA_ALL;
+ break;
+ case CLASS_FAX:
+ return BS_TELE_FAX;
+ break;
+ case CLASS_SMS:
+ return BS_TELE_SMS;
+ break;
+ case (CLASS_VOICE_OR_SMS_OR_FAX):
+ return BS_TELE_ALL;
+ break;
+ case (CLASS_SMS_OR_FAX):
+ return BS_TELE_DATA_ALL;
+ break;
+ case (CLASS_VOICE_OR_FAX):
+ return BS_TELE_ALL_EXCEPT_SMS;
+ break;
+ case CLASS_DATA_SYNC:
+ return BS_DATA_CIRCUIT_SYNC;
+ break;
+ case CLASS_DATA_ASYNC:
+ return BS_DATA_CIRCUIT_ASYNC;
+ break;
+ case (CLASS_DATASYNC_OR_DEDICATEDPACKETACCESS):
+ return BS_DATA_SYNC_ALL;
+ break;
+ case (CLASS_DATASYNC_OR_DEDICATEDPADACCESS):
+ return BS_DATA_ASYNC_ALL;
+ break;
+ case (CLASS_DATASYNC_OR_VOICE):
+ return BS_DATA_SYNC_TELE;
+ break;
+ case CLASS_DEDICATED_PACKET_ACCESS:
+ return BS_GPRS_ALL;
+ break;
+ case (CLASS_MTKVIDEO_OR_DATASYNC):
+ return BS_DATA_CIRCUIT_SYNC;
+ break;
+ case CLASS_MTK_VIDEO:
+ return BS_DATA_CIRCUIT_SYNC;
+ break;
+ default:
+ RLOGE("ATCI unknown infoClass: %d", infoClass);
+ break;
+ }
+ return "";
+}
+
+int atci_ss_hdlr(char *cmd, int op_mode, int target, char *response) {
+ int ret = 0;
+ atci_data_req_t req = { 0 };
+ int status = 0;
+ int service_code = 0;
+
+ //check parameter
+ switch (op_mode) {
+ case AT_SET_MODE:
+ case AT_READ_MODE:
+ case AT_ACTIVE_MODE:
+ case AT_TEST_MODE: {
+ //paser parameter
+ //char *input = "MSG_XXXXXX";
+ //char output[1024];
+ //int len = strlen(input);
+
+ RLOGD("input cmd[%s]", cmd);
+ //
+ if (SYS_FAIL == atci_at_to_equal(&cmd)) {
+ //input error
+ break;
+ }
+ RLOGD("ss reamin data is[%s]", cmd);
+
+ atci_at_skip_space(&cmd);
+ RLOGD("after remove space, ss reamin data is[%s]", cmd);
+
+ // get status=int1
+ if (SYS_FAIL == atci_at_get_nextint(&cmd, &status)) {
+ RLOGE("For ss, the first param must be int");
+ break;
+ }
+ RLOGD("status is [%d]", status);
+
+ // get service code, such as CFB(67), CFU(21), CF-No Reply(61), CF-Not Reachable(62), CF-Not logged in(68)
+ //call waiting(43)
+ //incoming call barring while roaming(351)
+ if (SYS_FAIL == atci_at_get_nextint(&cmd, &service_code)) {
+ RLOGE("For ss, the second param must be string(service_code)");
+ break;
+ }
+ RLOGD("read service_code is [%d]", service_code);
+
+ if ((service_code == 67) || (service_code == 21) || (service_code == 61)
+ || (service_code == 62) || (service_code == 68)) {
+ telephonyRequestSetCallForward set_CF_data;
+ char *num = NULL;
+ int service_class = 0;
+ char *MMI_BS_Code = NULL;
+ int int_MMI_BS_Code = 0;
+
+ memset(&set_CF_data, 0, sizeof(telephonyRequestSetCallForward));
+
+ if (SYS_FAIL == atci_at_get_next_key(&cmd, &num)) {
+ RLOGE("For ss CF, the third param must be string(number)");
+ break;
+ }
+ RLOGD("num is [%s]", num);
+
+ if (SYS_FAIL == atci_at_get_nextint(&cmd, &service_class)) {
+ RLOGE("For ss CF, the forth param must be string(service_class)");
+ break;
+ }
+ MMI_BS_Code = InfoClassToMmiBSCodeString((AtInfoClassE)service_class);
+ RLOGD("CF service_class is [%d], MMI_BS_Code is %s", service_class,
+ MMI_BS_Code);
+ int_MMI_BS_Code = atoi(MMI_BS_Code);
+ RLOGD("int_MMI_BS_Code=%d", int_MMI_BS_Code);
+
+ if ((service_code == 61) && (status == 1)) {
+ int timeout_second = 0;
+ if (SYS_FAIL == atci_at_get_nextint(&cmd, &timeout_second)) {
+ RLOGE("For ss enable CF-No Reply, the fifth param must be int");
+ break;
+ }
+ RLOGD("timeout_second is [%d]", timeout_second);
+ set_CF_data.time_seconds = timeout_second;
+ }
+
+ //enable SS means register SS
+ if (status == 1) {
+ set_CF_data.status = status + 2;
+ } else {
+ set_CF_data.status = status;
+ }
+ set_CF_data.reason = service_code;
+ strcpy(set_CF_data.number, num);
+ set_CF_data.service_class = int_MMI_BS_Code;
+
+ //write data to DEMO APP
+ req.request_id = RIL_REQUEST_SET_CALL_FORWARD;
+ req.data_len = sizeof(telephonyRequestSetCallForward);
+ req.data = &set_CF_data;
+ RLOGD("input CF_req data");
+ int argc = 1;
+ char* cPoint;
+ char parser_buf[SOCKET_BUF_SIZE] = { 0 };
+ char reqStr[RIL_REQUEST_STRING_LENGTH] = {0};
+ cPoint = parser_buf;
+ memcpy(reqStr, request2RILStr(req.request_id),
+ strlen(request2RILStr(req.request_id)) + 1);
+ char* argv[7] = { 0 };
+ argv[0] = reqStr;
+
+ //cmd parameter sequence: status, reason, number, time_seconds, service_class; other not need.
+ argv[1] = cPoint; //status
+ cPoint += sizeof(set_CF_data.status);
+ sprintf(argv[1], "%d", set_CF_data.status);
+
+ argv[2] = cPoint; //reason
+ cPoint += sizeof(set_CF_data.reason);
+ sprintf(argv[2], "%d", set_CF_data.reason);
+
+ argv[5] = cPoint; //service_class
+ cPoint += sizeof(set_CF_data.service_class);
+ sprintf(argv[5], "%d", set_CF_data.service_class);
+
+ argv[6] = cPoint; //toa
+ cPoint += sizeof(set_CF_data.toa);
+ sprintf(argv[6], "%d", set_CF_data.toa);
+
+ argv[3] = cPoint; //number
+ cPoint += sizeof(set_CF_data.number);
+ sprintf(argv[3], "%s", set_CF_data.number);
+
+ argv[4] = cPoint; //time_seconds
+ sprintf(argv[4], "%d", set_CF_data.time_seconds);
+
+ argc += 5; //remove toa
+ RLOGD(
+ "RIL_REQUEST_SET_CALL_FORWARD status(%s) reason(%s) number(%s) time_seconds(%s) service_class(%s) --toa(%s)",
+ argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]);
+ sendAtciRequest(req.request_id, reqStr, argc, argv);
+ RLOGD("input CF_req data success");
+ } else if (service_code == 43) {
+ telephonyRequestSetCallWaiting set_CW_data;
+ int service_class = 0;
+ char *MMI_BS_Code = NULL;
+ int int_MMI_BS_Code = 0;
+
+ memset(&set_CW_data, 0, sizeof(telephonyRequestSetCallWaiting));
+
+ if (SYS_FAIL == atci_at_get_nextint(&cmd, &service_class)) {
+ RLOGE("For ss CW, the third param must be string(service_class)");
+ break;
+ }
+ MMI_BS_Code = InfoClassToMmiBSCodeString((AtInfoClassE)service_class);
+ RLOGD("CW service_class is [%d], MMI_BS_Code is %s", service_class,
+ MMI_BS_Code);
+ int_MMI_BS_Code = atoi(MMI_BS_Code);
+ RLOGD("int_MMI_BS_Code=%d", int_MMI_BS_Code);
+
+ set_CW_data.status = status;
+ set_CW_data.service_class = int_MMI_BS_Code;
+
+ //write data to DEMO APP
+ req.request_id = RIL_REQUEST_SET_CALL_WAITING;
+ req.data_len = sizeof(telephonyRequestSetCallWaiting);
+ req.data = &set_CW_data;
+ RLOGD("input CW_req data");
+ int argc = 1;
+ char* cPoint;
+ char parser_buf[SOCKET_BUF_SIZE] = { 0 };
+ char reqStr[RIL_REQUEST_STRING_LENGTH] = {0};
+ cPoint = parser_buf;
+ memcpy(reqStr, request2RILStr(req.request_id),
+ strlen(request2RILStr(req.request_id)) + 1);
+ char* argv[3] = { 0 };
+ argv[0] = reqStr;
+
+ //cmd parameter sequence: statue, service_code
+ argv[1] = cPoint; //status
+ cPoint += sizeof(set_CW_data.status);
+ sprintf(argv[1], "%d", set_CW_data.status);
+
+ argv[2] = cPoint; //service_class
+ sprintf(argv[2], "%d", set_CW_data.service_class);
+
+ argc += 2;
+ RLOGD("RIL_REQUEST_SET_CALL_WAITING status(%s) service_class(%s)",argv[1], argv[2]);
+ sendAtciRequest(req.request_id, reqStr, argc, argv);
+ RLOGD("input CW_req data success");
+ } else if (service_code == 351) {
+ telephonyRequestSetCallBarring set_CB_data;
+ char *password = NULL;
+ int service_class = 0;
+ char *MMI_BS_Code = NULL;
+ int int_MMI_BS_Code = 0;
+
+ memset(&set_CB_data, 0, sizeof(telephonyRequestSetCallBarring));
+
+ if (SYS_FAIL == atci_at_get_next_key(&cmd, &password)) {
+ RLOGE("For ss CB, the third param must be string(password)");
+ break;
+ }
+ RLOGD("password is [%s]", password);
+
+ if (SYS_FAIL == atci_at_get_nextint(&cmd, &service_class)) {
+ RLOGE("For ss CB, the forth param must be string(service_class)");
+ break;
+ }
+ MMI_BS_Code = InfoClassToMmiBSCodeString((AtInfoClassE)service_class);
+ RLOGD("CB service_class is [%d], MMI_BS_Code is %s", service_class,
+ MMI_BS_Code);
+ int_MMI_BS_Code = atoi(MMI_BS_Code);
+ RLOGD("int_MMI_BS_Code=%d", int_MMI_BS_Code);
+
+ set_CB_data.serviceClass = int_MMI_BS_Code;
+ set_CB_data.status = status;
+ strcpy(set_CB_data.password, password);
+ sprintf(set_CB_data.facility, "%d", service_code);
+
+ //write data to DEMO APP
+ req.request_id = RIL_REQUEST_SET_FACILITY_LOCK;
+ req.data_len = sizeof(telephonyRequestSetCallBarring);
+ req.data = &set_CB_data;
+ RLOGD("input CB_req data");
+ int argc = 1;
+ char* cPoint;
+ char parser_buf[SOCKET_BUF_SIZE] = { 0 };
+ char reqStr[RIL_REQUEST_STRING_LENGTH] = {0};
+ cPoint = parser_buf;
+ memcpy(reqStr, request2RILStr(req.request_id),
+ strlen(request2RILStr(req.request_id)) + 1);
+ char* argv[5] = { 0 };
+ argv[0] = reqStr;
+
+ //cmd parameter sequence: facility, password, serviceclass,enable; other not need.
+ argv[4] = cPoint; //status
+ cPoint += sizeof(set_CB_data.status);
+ sprintf(argv[4], "%d", set_CB_data.status);
+
+ argv[1] = cPoint; //facility
+ cPoint += sizeof(set_CB_data.facility);
+ sprintf(argv[1], "%s", set_CB_data.facility);
+
+ argv[2] = cPoint; //password
+ cPoint += sizeof(set_CB_data.password);
+ sprintf(argv[2], "%s", set_CB_data.password);
+
+ argv[3] = cPoint; //serviceclass
+ cPoint += sizeof(set_CB_data.serviceClass);
+ sprintf(argv[3], "%d", set_CB_data.serviceClass);
+
+ argc += 4;
+ RLOGD("RIL_REQUEST_SET_FACILITY_LOCK facility(%s) password(%s) service_class(%s) status(enable)(%s)",
+ argv[1], argv[2], argv[3], argv[4]);
+ sendAtciRequest(req.request_id, reqStr, argc, argv);
+ RLOGD("input CB_req data success");
+ } else {
+ RLOGE("the service code [%d] is not supported by ATCI_SS now",
+ service_code);
+ return SYS_SUCC;
+ }
+ return SYS_SUCC;
+ }
+ default: {
+ break;
+ }
+ }
+ RLOGD("SS error");
+ return SYS_SUCC;
+}
+
diff --git a/src/lynq/lib/liblynq-tele-ril/lynq-riltel/atci/atci_ss_cmd.h b/src/lynq/lib/liblynq-tele-ril/lynq-riltel/atci/atci_ss_cmd.h
new file mode 100644
index 0000000..a59c92d
--- /dev/null
+++ b/src/lynq/lib/liblynq-tele-ril/lynq-riltel/atci/atci_ss_cmd.h
@@ -0,0 +1,64 @@
+/*
+ This is an internal header file.
+ Here are common definitions for the vendor-ril.
+ */
+
+#ifndef __ATCI_SS_CMD_H__
+#define __ATCI_SS_CMD_H__
+
+/*
+ * <classx> is a sum of integers each representing a class of information (default 7):
+ * 1 voice (telephony)
+ * 2 data (refers to all bearer services; with <mode>=2 this may refer only to some bearer service if TA does not support values 16, 32, 64 and 128)
+ * 4 fax (facsimile services)
+ * 8 short message service
+ * 16 data circuit sync
+ * 32 data circuit async
+ * 64 dedicated packet access
+ * 128 dedicated PAD access
+ */
+typedef enum {
+ CLASS_NONE = 0,
+ CLASS_VOICE = 1,
+ CLASS_DATA = 2,
+ CLASS_FAX = 4,
+ CLASS_DEFAULT = 7,
+ CLASS_SMS = 8,
+ CLASS_DATA_SYNC = 16,
+ CLASS_DATA_ASYNC = 32,
+ CLASS_DEDICATED_PACKET_ACCESS = 64,
+ CLASS_DEDICATED_PAD_ACCESS = 128,
+ CLASS_MTK_LINE2 = 256,
+ CLASS_MTK_VIDEO = 512,
+ CLASS_DATASYNC_OR_DATAASYNC = 48,
+ CLASS_VOICE_OR_SMS_OR_FAX = 13,
+ CLASS_SMS_OR_FAX = 12,
+ CLASS_VOICE_OR_FAX = 5,
+ CLASS_DATASYNC_OR_DEDICATEDPACKETACCESS = 80,
+ CLASS_DATASYNC_OR_DEDICATEDPADACCESS = 160,
+ CLASS_DATASYNC_OR_VOICE = 17,
+ CLASS_MTKVIDEO_OR_DATASYNC = 528
+} AtInfoClassE;
+
+#define BS_ALL ""
+#define BS_TELE_ALL "10"
+#define BS_TELEPHONY "11"
+#define BS_TELE_DATA_ALL "12"
+#define BS_TELE_FAX "13"
+#define BS_TELE_SMS "16"
+#define BS_TELE_VGCS "17" /* Not supported by framework */
+#define BS_TELE_VBS "18" /* Not supported by framework */
+#define BS_TELE_ALL_EXCEPT_SMS "19"
+#define BS_DATA_ALL "20"
+#define BS_DATA_ASYNC_ALL "21"
+#define BS_DATA_SYNC_ALL "22"
+#define BS_DATA_CIRCUIT_SYNC "24" /* This is also for VT call */
+#define BS_DATA_CIRCUIT_ASYNC "25"
+#define BS_DATA_SYNC_TELE "26" /* Supported by framework */
+#define BS_GPRS_ALL "99"
+
+int atci_ss_init(void *arg);
+int atci_ss_hdlr(char *cmd, int op_type, int target, char *response);
+
+#endif
+
diff --git a/src/lynq/lib/liblynq-tele-ril/lynq-riltel/atci/atci_sys_cmd.cpp b/src/lynq/lib/liblynq-tele-ril/lynq-riltel/atci/atci_sys_cmd.cpp
new file mode 100644
index 0000000..ce58981
--- /dev/null
+++ b/src/lynq/lib/liblynq-tele-ril/lynq-riltel/atci/atci_sys_cmd.cpp
@@ -0,0 +1,265 @@
+#include <vendor-ril/telephony/ril.h>
+#include <string.h>
+#include <log/log.h>
+
+#include "ATCI.h"
+#include "atci_util.h"
+#include "atci_at_util.h"
+#include <unistd.h>
+#include <linux/reboot.h>
+#include <sys/syscall.h>
+
+#undef LOG_TAG
+#define LOG_TAG "DEMO_ATCI_SYS"
+#define RESTART_WAITING_TIME 5*1000*1000
+#define RESTART_REASON "AT%RESTART"
+
+int atci_sys_ims_enable_hdlr(char *cmd, int op_mode, int target, char *response) {
+ int ret = SYS_FAIL;
+ int ims_enable;
+ char *p_out = NULL;
+ atci_data_req_t req;
+ //check parameter
+ switch (op_mode) {
+ case AT_SET_MODE:
+ case AT_READ_MODE:
+ case AT_ACTIVE_MODE:
+ case AT_TEST_MODE: {
+ //paser parameter
+ //send to target handle
+ //ex: at@example=string1,2,3,4
+ RLOGD("input cmd[%s]", cmd);
+ if (SYS_FAIL == atci_at_to_equal(&cmd)) {
+ //input error
+ RLOGD("input cmd[%s]", cmd);
+ ret = SYS_FAIL;
+ break;
+ }
+ RLOGD("reamin data is[%s]", cmd);
+
+ // get int
+ if (SYS_FAIL == atci_at_hasmore(&cmd)) {
+ ret = SYS_FAIL;
+ break;
+ }
+ if (SYS_FAIL == atci_at_get_nexthexint(&cmd, &ims_enable)) {
+ ret = SYS_FAIL;
+ break;
+ }
+ if (!((ims_enable == 1) || (ims_enable == 0))) {
+ ret = SYS_FAIL;
+ RLOGD("ims enable mode value set fail by user ims_enable = %d",
+ ims_enable);
+ break;
+ }
+ if (SYS_SUCC == atci_at_get_next_key(&cmd, &p_out)) {
+ ret = SYS_FAIL;
+ RLOGD("Fail because reamin data is[%s]", cmd);
+ break;
+ }
+ //wrire data to target if need
+
+ //input data
+ req.request_id = RIL_REQUEST_SET_IMS_ENABLE;
+ req.data_len = sizeof(ims_enable);
+ req.data = &ims_enable;
+ RLOGD("input req data %d", ims_enable);
+ int argc = 1;
+ char* cPoint;
+ char parser_buf[SOCKET_BUF_SIZE] = { 0 };
+ char reqStr[RIL_REQUEST_STRING_LENGTH];
+ cPoint = parser_buf;
+ memcpy(reqStr, request2RILStr(req.request_id),
+ strlen(request2RILStr(req.request_id)) + 1);
+ char* argv[2] = { 0 };
+ argv[0] = reqStr;
+
+ //cmd parameter sequence: mode.
+ argv[1] = cPoint; //flightModeOn
+ sprintf(argv[1], "%d", (ims_enable == 1 ? 1 : 0));
+
+ argc += 1;
+ RLOGD("RIL_REQUEST_SET_IMS_ENABLE IMS Mode is %s-->(%s)",
+ (ims_enable == 1 ? "on" : "off"), argv[1]);
+ sendAtciRequest(req.request_id, reqStr, argc, argv);
+ RLOGD("call atci_write_data complete %d", ims_enable);
+ ret = SYS_SUCC;
+ //generate response string
+ break;
+ }
+ default: {
+ ret = SYS_FAIL;
+ break;
+ }
+ }
+ if (SYS_SUCC == ret) {
+ return SYS_SUCC;
+ } else {
+ return SYS_FAIL;
+ }
+}
+
+int
+atci_sys_flight_hdlr(char *cmd, int op_mode, int target, char *response) {
+ int ret = SYS_FAIL;
+ int flight_mode;
+ char *p_out = NULL;
+ atci_data_req_t req;
+ //check parameter
+ switch (op_mode) {
+ case AT_SET_MODE:
+ case AT_READ_MODE:
+ case AT_ACTIVE_MODE:
+ case AT_TEST_MODE: {
+ //paser parameter
+ //send to target handle
+ //ex: at@example=string1,2,3,4
+ RLOGD("input cmd[%s]", cmd);
+ if (SYS_FAIL == atci_at_to_equal(&cmd)) {
+ //input error
+ RLOGD("input cmd[%s]", cmd);
+ ret = SYS_FAIL;
+ break;
+ }
+ RLOGD("reamin data is[%s]", cmd);
+
+ // get int
+ if (SYS_FAIL == atci_at_hasmore(&cmd)) {
+ ret = SYS_FAIL;
+ break;
+ }
+ if (SYS_FAIL == atci_at_get_nexthexint(&cmd, &flight_mode)) {
+ ret = SYS_FAIL;
+ break;
+ }
+ if (!((flight_mode == 1) || (flight_mode == 0))) {
+ ret = SYS_FAIL;
+ RLOGD("flight mode value set fail by user flight_mode = %d",
+ flight_mode);
+ break;
+ }
+ if (SYS_SUCC == atci_at_get_next_key(&cmd, &p_out)) {
+ ret = SYS_FAIL;
+ RLOGD("Fail because reamin data is[%s]", cmd);
+ break;
+ }
+ //wrire data to target if need
+
+ //input data
+ req.request_id = RIL_REQUEST_RADIO_POWER;
+ req.data_len = sizeof(flight_mode);
+ req.data = &flight_mode;
+ RLOGD("input req data %d", flight_mode);
+ int argc = 1;
+ char* cPoint;
+ char parser_buf[SOCKET_BUF_SIZE] = { 0 };
+ char reqStr[RIL_REQUEST_STRING_LENGTH];
+ cPoint = parser_buf;
+ memcpy(reqStr, request2RILStr(req.request_id),
+ strlen(request2RILStr(req.request_id)) + 1);
+ char* argv[2] = { 0 };
+ argv[0] = reqStr;
+
+ //cmd parameter sequence: mode.
+ argv[1] = cPoint; //flightModeOn
+ sprintf(argv[1], "%d", (flight_mode == 1 ? 0 : 1));
+
+ argc += 1;
+ RLOGD("RIL_REQUEST_RADIO_POWER flight Mode is %s-->(%s)",
+ (flight_mode == 1 ? "On" : "Off"), argv[1]);
+ sendAtciRequest(req.request_id, reqStr, argc, argv);
+ RLOGD("call atci_write_data complete %d", flight_mode);
+ ret = SYS_SUCC;
+ //generate response string
+ break;
+ }
+ default: {
+ ret = SYS_FAIL;
+ break;
+ }
+ }
+ if (SYS_SUCC == ret) {
+ return SYS_SUCC;
+ } else {
+ return SYS_FAIL;
+ }
+}
+
+static void* atci_sys_restart_routine(void *arg){
+
+ usleep(RESTART_WAITING_TIME);
+ sync(); /*Force the changes to disk.*/
+
+ RLOGD("RESTART require restart, ByeBye!!!");
+
+ syscall(SYS_reboot,LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_RESTART2, RESTART_REASON);
+
+ return 0;
+}
+
+int atci_sys_invoke_restart(){
+ int ret;
+ pthread_attr_t attr;
+ pthread_t restart_thread;
+
+ pthread_attr_init(&attr);
+
+ RLOGD("create the restart thread");
+ ret = pthread_create(&restart_thread, &attr, atci_sys_restart_routine, NULL);
+ if(0 != ret){
+ RLOGD("failed to create the restart thread");
+ }
+
+ return ret;
+}
+
+int atci_sys_restart_hdlr (char *cmd,int op_mode,int target,char *response){
+ int ret;
+ //check parameter
+
+ RLOGD("atci_sys_restart_hdlr input cmd[%s]",cmd);
+ switch(op_mode){
+ case AT_SET_MODE:
+ case AT_READ_MODE:
+ case AT_ACTIVE_MODE:
+ case AT_TEST_MODE:{
+ //paser parameter
+ //send to target handle
+ //ex: at@example=string1,2,3,4
+
+ ret = atci_sys_invoke_restart();
+ break;
+ }
+ default:{
+ ret = SYS_FAIL;
+ RLOGD("Op mode error");
+ break;
+ }
+ }
+
+ ATCIResponse(0, ret, NULL, 0);
+
+ if(0 == ret){
+ RLOGD("Restart SUCC");
+ return SYS_SUCC;
+ } else{
+ RLOGD("Restart Fail");
+ return SYS_FAIL;
+ }
+}
+
+atci_cmd_type_t atci_sys_cmd_table[] = {
+ //cmd_name target_type handler
+ { "AT%FLIGHT", TARGET_TELEPHONY, atci_sys_flight_hdlr },
+// { "AT%RESTART",TARGET_PLATFORM, atci_sys_restart_hdlr },
+ { "AT%IMSENABLE", TARGET_TELEPHONY, atci_sys_ims_enable_hdlr },
+ { NULL, TARGET_UNKNOWN, NULL }
+};
+
+int atci_sys_init(void *arg) {
+ int ret;
+ ret = atci_cmd_register(atci_sys_cmd_table);
+ RLOGD("Init the atci sys");
+ return ret;
+}
+
diff --git a/src/lynq/lib/liblynq-tele-ril/lynq-riltel/atci/atci_sys_cmd.h b/src/lynq/lib/liblynq-tele-ril/lynq-riltel/atci/atci_sys_cmd.h
new file mode 100644
index 0000000..3c33095
--- /dev/null
+++ b/src/lynq/lib/liblynq-tele-ril/lynq-riltel/atci/atci_sys_cmd.h
@@ -0,0 +1,10 @@
+/*
+ This is an internal header file.
+ Here is a example cmd handle function define.
+ */
+#ifndef __ATCI_SYS_CMD_H__
+#define __ATCI_SYS_CMD_H__
+
+int atci_sys_init(void *arg);
+#endif
+
diff --git a/src/lynq/lib/liblynq-tele-ril/lynq-riltel/atci/atci_util.cpp b/src/lynq/lib/liblynq-tele-ril/lynq-riltel/atci/atci_util.cpp
new file mode 100644
index 0000000..656a251
--- /dev/null
+++ b/src/lynq/lib/liblynq-tele-ril/lynq-riltel/atci/atci_util.cpp
@@ -0,0 +1,82 @@
+#include <vendor-ril/telephony/ril.h>
+#include <log/log.h>
+
+#include "atci_at_util.h"
+#include "atci_util.h"
+
+#undef LOG_TAG
+#define LOG_TAG "DEMO_ATCI_UTIL"
+
+static atci_cmd_type_t *atci_cmd_table[MAX_CMD_HANDLER_MODULE_NUM];
+int atci_cmd_register(atci_cmd_type_t *ptr) {
+ int i = 0;
+ for (i = 0; i < MAX_CMD_HANDLER_MODULE_NUM; i++) {
+ if (NULL == atci_cmd_table[i]) {
+ atci_cmd_table[i] = ptr;
+ return SYS_SUCC;
+ }
+ }
+ RLOGE("atci_cmd_table,is full,cmd_register fail!!!");
+ return SYS_FAIL;
+}
+
+atci_cmd_type_t* atci_find_cmd_handler(char *prefix) {
+
+ atci_cmd_type_t *reasult = NULL;
+ atci_cmd_type_t **reasult_ptr;
+
+ reasult_ptr = atci_cmd_table;
+ int i, j;
+ for (i = 0; i < MAX_CMD_HANDLER_MODULE_NUM; i++) {
+ atci_cmd_type_t *tmp_ptr;
+ if (NULL == reasult_ptr[i]) {
+ continue;
+ }
+ tmp_ptr = reasult_ptr[i];
+ for (j = 0;; j++) {
+ if (NULL == tmp_ptr[j].cmd_prefix) {
+ break;
+ }
+ //RLOGD("scan [%s]",tmp_ptr[j].cmd_prefix);
+ if (0 == strcasecmp(prefix, tmp_ptr[j].cmd_prefix)) {
+ RLOGD("find cmd[%s] handle", prefix);
+ reasult = &tmp_ptr[j];
+ return reasult;
+ }
+ }
+ if (NULL != reasult) {
+ break;
+ }
+ }
+ RLOGD("can't find cmd[%s],need handle by default", prefix);
+ return reasult;
+}
+
+char* request2RILStr(int request) {
+ switch (request) {
+ case RIL_REQUEST_SET_CALL_FORWARD:
+ return "RIL_REQUEST_SET_CALL_FORWARD";
+ case RIL_REQUEST_SET_CALL_WAITING:
+ return "RIL_REQUEST_SET_CALL_WAITING";
+ case RIL_REQUEST_SET_FACILITY_LOCK:
+ return "RIL_REQUEST_SET_FACILITY_LOCK";
+ case RIL_REQUEST_DIAL:
+ return "RIL_REQUEST_DIAL";
+ case RIL_REQUEST_REMOVE_IMS_CONFERENCE_CALL_MEMBER:
+ return "RIL_REQUEST_REMOVE_IMS_CONFERENCE_CALL_MEMBER";
+ case RIL_REQUEST_RADIO_POWER:
+ return "RIL_REQUEST_RADIO_POWER";
+ case RIL_REQUEST_SET_MUTE:
+ return "RIL_REQUEST_SET_MUTE";
+ case RIL_REQUEST_CONFERENCE:
+ return "RIL_REQUEST_CONFERENCE";
+ case RIL_REQUEST_CONFERENCE_DIAL:
+ return "RIL_REQUEST_CONFERENCE_DIAL";
+ case RIL_REQUEST_DIAL_WITH_SIP_URI:
+ return "RIL_REQUEST_DIAL_WITH_SIP_URI";
+ case RIL_REQUEST_SET_IMS_ENABLE:
+ return "RIL_REQUEST_SET_IMS_ENABLE";
+ default:
+ return "unknown define";
+ }
+}
diff --git a/src/lynq/lib/liblynq-tele-ril/lynq-riltel/atci/atci_util.h b/src/lynq/lib/liblynq-tele-ril/lynq-riltel/atci/atci_util.h
new file mode 100644
index 0000000..991ab8d
--- /dev/null
+++ b/src/lynq/lib/liblynq-tele-ril/lynq-riltel/atci/atci_util.h
@@ -0,0 +1,23 @@
+//ATCP Service atcmd
+#ifndef _ATCI_UTIL_H_
+#define _ATCI_UTIL_H_
+#include "atci_common.h"
+
+typedef int (*atci_cmd_handle_func)(char *cmd, int op_mode, int target,
+ char *response);
+typedef struct atci_cmd_type_s {
+ char *cmd_prefix;
+ atci_target_e target;
+ atci_cmd_handle_func cmd_handle_func;
+} atci_cmd_type_t;
+//socket data protocol.
+typedef struct atci_data_req_s {
+ int request_id;
+ int data_len;
+ void *data;
+} atci_data_req_t;
+
+int atci_cmd_register(atci_cmd_type_t *ptr);
+atci_cmd_type_t* atci_find_cmd_handler(char *prefix);
+char* request2RILStr(int request);
+#endif