static const char DefaultCid[] = "default";
static const char automaticApn[] = "auto";
static const char PdpIpv4[] = "ipv4";
static const char PdpIpv6[] = "ipv6";
static const char PdpIpv4v6[] = "ipv4v6";
static const char AuthPap[] = "pap";
static const char AuthChap[] = "chap";
static const char AuthPapChap[] = "pap-chap";
typedef struct
{
char cid[10];
char pdp[10];
char auth[10];
}
Configuration_t;
typedef enum
{
TEST_SYNC,
TEST_ASYNC,
TEST_MAX
} Testcase_t;
struct
{
char testName[20];
Testcase_t testCase;
} testsDef[] = {
TEST_DEF(TEST_SYNC),
TEST_DEF(TEST_ASYNC),
TEST_DEF(TEST_MAX)
};
static void SessionHandlerFunc
(
void* contextPtr
)
{
*activationPtr = result;
}
static void SessionStartAsync
(
void* param1Ptr,
void* param2Ptr
)
{
}
static void SessionStopAsync
(
void* param1Ptr,
void* param2Ptr
)
{
}
static void SetConfiguration
(
)
{
FILE* configFilePtr = fopen("/tmp/config.txt","r");
Configuration_t configuration;
memset(&configuration, 0, sizeof(Configuration_t));
if (configFilePtr == NULL)
{
strncpy(configuration.cid, DefaultCid, sizeof(DefaultCid));
strncpy(configuration.pdp, PdpIpv4, sizeof(PdpIpv4));
strncpy(configuration.apn, automaticApn, sizeof(automaticApn));
}
else
{
fseek(configFilePtr, 0, SEEK_END);
uint32_t len = ftell(configFilePtr);
char cmdLine[ len + 1 ];
memset(cmdLine,0,len+1);
fseek(configFilePtr, 0, SEEK_SET);
fread(cmdLine, 1, len, configFilePtr);
fclose(configFilePtr);
if (( cmdLine[len-1] == '\n' ) || ( cmdLine[len-1] == '\r' ))
{
cmdLine[len-1]=' ';
}
char* cidPtr = strtok(cmdLine, " ");
strncpy(configuration.cid, cidPtr, strlen(cidPtr));
char* pdpPtr = strtok(NULL, " ");
strncpy(configuration.pdp, pdpPtr, strlen(pdpPtr));
char* apnPtr = strtok(NULL, " ");
strncpy(configuration.apn, apnPtr, strlen(apnPtr));
char* authPtr = strtok(NULL, " ");
if (authPtr != NULL)
{
strncpy(configuration.auth, authPtr, strlen(authPtr));
}
char* userNamePtr = strtok(NULL, " ");
if (userNamePtr != NULL)
{
strncpy(configuration.userName, userNamePtr, strlen(userNamePtr));
}
char* passwordPtr = strtok(NULL, " ");
if(passwordPtr != NULL)
{
strncpy(configuration.password, passwordPtr, strlen(passwordPtr));
}
}
uint32_t profile;
if ( strncmp(configuration.cid, DefaultCid, sizeof(DefaultCid)) == 0 )
{
}
else
{
profile = atoi(configuration.cid);
}
{
}
if ( strncmp(configuration.pdp, PdpIpv4, sizeof(PdpIpv4)) == 0 )
{
}
else if ( strncmp(configuration.pdp, PdpIpv6, sizeof(PdpIpv6)) == 0 )
{
}
else if ( strncmp(configuration.pdp, PdpIpv4v6, sizeof(PdpIpv4v6)) == 0 )
{
}
if ( strncmp(configuration.apn, automaticApn, sizeof(automaticApn)) == 0 )
{
}
else
{
}
if ( configuration.auth[0] != '\0' )
{
if ( strncmp(configuration.auth, AuthPapChap, sizeof(AuthPapChap)) == 0 )
{
}
else if ( strncmp(configuration.auth, AuthPap, sizeof(AuthPap)) == 0 )
{
}
else if ( strncmp(configuration.auth, AuthChap, sizeof(AuthChap)) == 0 )
{
}
{
auth,
configuration.userName,
configuration.password ) == LE_OK );
}
}
LE_INFO(
"cid: %d pdp: %d apn: %s auth: %d username: %s password: %s", profile, pdp,
configuration.apn, auth, configuration.userName, configuration.password);
}