blob: 7f5e8d49ca2d8a89dac909f5bfee30e29e0d5e23 [file] [log] [blame]
#include<libtel/lynq_sms.h>
#include"sms.h"
#include <stdio.h>
#include <stdlib.h>
#include <log/log.h>
#include <string.h>
#undef LOG_TAG
#define LOG_TAG "LYNQ_SMS"
eventSMSController::eventSMSController()
{}
eventSMSController::~eventSMSController()
{}
int eventSMSController::eventSendSms(int argc,char *argv[])
{
int32_t token;
smsResponse msg;
msg.smsResp.ackPDU=NULL;
if(argc <5)
{
RLOGD("send sms paramter is inavailable!");
printf("send sms paramter is inavailable!\n");
return -1;
}
if(argc==5)
{
token = lynq_send_sms(argv[2], atoi(argv[3]),argv[4], NULL,&msg);
}
else if(argc==6)
{
token = lynq_send_sms(argv[2], atoi(argv[3]),argv[4], argv[5],&msg);
}
else
{
RLOGD("should not be here!");
return -1;
}
printf("request is %d,token is %x,error is %d,\nmessageRef is %d,ackPDU is %s,errorCode is %d\n",msg.base.request,msg.base.token,msg.base.e,
msg.smsResp.messageRef,msg.smsResp.ackPDU,msg.smsResp.errorCode);
RLOGD("request is %d,token is %x,error is %d,messageRef is %d,ackPDU is %s,errorCode is %d",msg.base.request,msg.base.token,msg.base.e,
msg.smsResp.messageRef,msg.smsResp.ackPDU,msg.smsResp.errorCode);
return 0;
}
int eventSMSController::eventImsSendSms(int argc,char *argv[])
{
int32_t token;
smsResponse msg;
msg.smsResp.ackPDU=NULL;
if(argc <7)
{
RLOGD("send IMS sms paramter is inavailable!");
printf("send IMS sms paramter is inavailable!\n");
return -1;
}
if(argc==7)
{
token = lynq_Ims_send_sms(argv[2], atoi(argv[3]),argv[4], argv[5],argv[6],NULL,&msg);
}
else if(argc==8)
{
token = lynq_Ims_send_sms(argv[2], atoi(argv[3]),argv[4], argv[5],argv[6],argv[7],&msg);
}
else
{
RLOGD("should not be here!");
return -1;
}
printf("request is %d,token is %x,error is %d,\nmessageRef is %d,ackPDU is %s,errorCode is %d\n",msg.base.request,msg.base.token,msg.base.e,
msg.smsResp.messageRef,msg.smsResp.ackPDU,msg.smsResp.errorCode);
RLOGD("request is %d,token is %x,error is %d,messageRef is %d,ackPDU is %s,errorCode is %d",msg.base.request,msg.base.token,msg.base.e,
msg.smsResp.messageRef,msg.smsResp.ackPDU,msg.smsResp.errorCode);
return 0;
}
int eventSMSController::eventWriteSmsToSim(int argc,char *argv[])
{
int32_t token;
messageStoreInfo msg;
if(argc <6)
{
RLOGD("write sms to sim paramter is inavailable!");
printf("write sms to sim paramter is inavailable!\n");
return -1;
}
if(argc==6)
{
token = lynq_write_sms_to_sim(atoi(argv[2]), argv[3],atoi(argv[4]), argv[5],NULL,&msg);
}
else if(argc==7)
{
token = lynq_write_sms_to_sim(atoi(argv[2]), argv[3],atoi(argv[4]), argv[5],argv[6],&msg);
}
else
{
RLOGD("should not be here!");
return -1;
}
printf("request is %d,token is %x,error is %d,\nmessage strore index is %d\n",msg.base.request,msg.base.token,msg.base.e,
msg.msgStoreIndex);
RLOGD("request is %d,token is %x,error is %d,\nmessage strore index is %d\n",msg.base.request,msg.base.token,msg.base.e,
msg.msgStoreIndex);
return 0;
}
int eventSMSController::eventReportSmsMemoryStatus(int argc,char *argv[])
{
lynqBase msg;
if(argc<3)
{
RLOGD("report sms memory status parameter is inavailable!");
printf("report sms memory status parameter is inavailable!");
return -1;
}
lynq_report_sms_memory_status(atoi(argv[2]),&msg);
printf("request is %d,token is %x,error is %d,\n",msg.request,msg.token,msg.e);
RLOGD("request is %d,token is %x,error is %d",msg.request,msg.token,msg.e);
return 0;
}
int eventSMSController::eventDeletSmsOnSim(int argc,char *argv[])
{
lynqBase msg;
if(argc<3)
{
RLOGD("report sms memory status parameter is inavailable!");
printf("report sms memory status parameter is inavailable!");
return -1;
}
lynq_delet_sms_on_sim(atoi(argv[2]),&msg);
printf("request is %d,token is %x,error is %d,\n",msg.request,msg.token,msg.e);
RLOGD("request is %d,token is %x,error is %d",msg.request,msg.token,msg.e);
return 0;
}
int eventSMSController::eventGetSmscAddress(int argc,char *argv[])
{
smscCbInfo msg;
lynq_get_smsc_address(&msg);
printf("request is %d,token is %x,error is %d,smsc address is %s\n",msg.base.request,msg.base.token,msg.base.e,msg.smsc);
RLOGD("request is %d,token is %x,error is %d,smsc address is %s",msg.base.request,msg.base.token,msg.base.e,msg.smsc);
return 0;
}
int eventSMSController::eventSetSmscAddress(int argc,char *argv[])
{
lynqBase msg;
if(argc<3)
{
RLOGD("report sms memory status parameter is inavailable!");
printf("report sms memory status parameter is inavailable!");
return -1;
}
lynq_set_smsc_address(argv[2],&msg);
printf("request is %d,token is %x,error is %d,\n",msg.request,msg.token,msg.e);
RLOGD("request is %d,token is %x,error is %d",msg.request,msg.token,msg.e);
return 0;
return 0;
}
int eventSMSController::evenStoreSmsToMemory(int argc,char *argv[])
{
lynqBase msg;
msg.e = (RIL_Errno)(-1);
if(argc<5)
{
RLOGD("store sms to memoryparameter is inavailable!");
printf("store sms to memoryparameter is inavailable!");
return -1;
}
//printf("argv[2]%d,argv[3]%s,argv[4]%s\n",atoi(argv[2]), argv[3],argv[4]);
lynq_store_sms_to_memory(RIL_SOCKET_1,atoi(argv[2]), argv[3],argv[4],&msg);
printf("+LYNQ_SSTM:Error_code:%d\n",msg.e);
return 0;
}
int eventSMSController::eventGetSmsFromMemory(int argc,char *argv[])
{
lynqBase msg;
msg.e = (RIL_Errno)(-1);
storeMessageInfo sms;
if(argc<3)
{
RLOGD("get sms from memoryparameter is inavailable!");
printf("get sms from memoryparameter is inavailable!");
return -1;
}
lynq_get_sms_from_memory(atoi(argv[2]),&sms, &msg);
printf("+LYNQ_GSFM:Error_code:%d,Index:%d,Message:%s,Status:%d,Telephony number:%s,Socket_id:%d\n",msg.e,sms.index,sms.message,sms.status,sms.teleNum,sms.soc_id);
return 0;
}
int eventSMSController::eventDeleteMessageFromMemory(int argc,char *argv[])
{
lynqBase msg;
msg.e = (RIL_Errno)(-1);
if(argc<3)
{
RLOGD("get sms from memoryparameter is inavailable!");
printf("get sms from memoryparameter is inavailable!");
return -1;
}
lynq_delete_message_from_memory(atoi(argv[2]), &msg);
printf("+LYNQ_DMFM:Error_code:%d\n",msg.e);
return 0;
}