#include "common.h" | |
#include "libtel/lynq_call.h" | |
#include <log/log.h> | |
#include <cutils/properties.h> | |
int get_call(){ | |
char property_value[PHONE_SIZE] = { 0 }; | |
property_get(PHONE_NUMBER, property_value, "18964376469"); | |
RLOGD("factory_manual,property_value:%s",property_value); | |
//RIL_Dial *mRIL_Dial = (RIL_Dial *)calloc(1, sizeof(RIL_Dial)); | |
//mRIL_Dial->address = property_value; | |
//mRIL_Dial->clir = 0; | |
// return lynq_call(property_value); | |
return 1; | |
} | |
void register_factory_auto_hook_raw(RfAutomaticTest* rf){ | |
if(!m_RfDesense) { | |
m_RfDesense = rf; | |
} | |
} | |
void unregister_factory_auto_hook_raw(){ | |
if(m_RfDesense) { | |
m_RfDesense == NULL; | |
} | |
} | |
int getParameter(const int length, char* string, char* argv[]) | |
{ | |
int num = 0; | |
int count = 0; | |
int i = 0; | |
char* pos= string; | |
//string++; | |
while (1) | |
{ | |
if (*pos == '\0') | |
{ | |
break; | |
} | |
argv[num++] = pos; | |
while (1) | |
{ | |
if ((*pos == '\0')) | |
{ | |
break; | |
} | |
if ((*pos == '|') && (*(pos - 1) != '\\')) | |
{ | |
count++; | |
break; | |
} | |
pos++; | |
} | |
*pos++ = '\0'; | |
} | |
/* | |
for (int i = 0;i < num-1;i++) | |
{ | |
printf("agrv[%d]=%s\n", i, argv[i]); | |
} | |
*/ | |
if(count!=length) | |
{ | |
return 0; | |
} | |
return count; | |
} | |
int removeFlag(int argc, char* argv[]) | |
{ | |
char* temp = NULL; | |
char* temp1= NULL; | |
char** pos = argv; | |
for (int i = 0;i < argc+1;i++) | |
{ | |
temp1 = pos[i]; | |
while (1) | |
{ | |
if (*pos[i] == '\0') | |
{ | |
break; | |
} | |
if ((*pos[i] == '|') && (*(pos[i] - 1) == '\\')) | |
{ | |
temp = pos[i]; | |
while (1) | |
{ | |
*(pos[i]-1) = *(pos[i]); | |
if (*(pos[i]) == '\0') | |
{ | |
break; | |
} | |
pos[i]++; | |
} | |
pos[i] = temp; | |
} | |
pos[i]++; | |
} | |
pos[i] = temp1; | |
} | |
return 0; | |
} | |
int parseParam(const int length, char* string, char* argv[]) | |
{ | |
int num = 0; | |
if(string ==NULL) | |
{ | |
return 0; | |
} | |
if(num = getParameter(length, string, argv)) | |
{ | |
removeFlag(num,argv); | |
for (int i = 1;i < num + 1;i++) | |
{ | |
printf("argv[%d]=%s\n", i, argv[i]); | |
} | |
return num; | |
} | |
return 0; | |
} |