Example #1
0
File: wldsltr.c Project: ad7843/hi
/*Set radio Enable/Disable*/
void wl_dsl_tr_set_radioEnabled( int value, int idx )
{
    char buf[128];
    if ( value ) 
           sprintf(buf, "wlctl -i wl%d radio on", idx);
   else 
           sprintf(buf, "wlctl -i wl%d radio off", idx);
   bcmSystemEx(buf, 1);
}
Example #2
0
File: wldsltr.c Project: ad7843/hi
/*get Channel*/
void wl_dsl_tr_get_possibleChannels( char *value, int idx )
{
#define IFC_GIANT_LEN           1024


    char buf[IFC_GIANT_LEN] ={0};
    FILE *fp = NULL;
    char *pBuf= buf;
    char *pRes = value;

    *value = '\0';
	
    sprintf(buf, "wlctl -i wl%d channels > /var/wlchannels", idx);
    bcmSystemEx(buf, 1);
    fp = fopen("/var/wlchannels", "r");
    if ( fp != NULL ) {
        fgets(buf, IFC_GIANT_LEN, fp);
        // Skip all the white space
        while ( *pBuf == ' ' ) pBuf++;
	
        // process the string
        while ( *pBuf != '\0' ) 
	 {
            if ( *pBuf == ' ' ) {
                *pRes = ',';
                pRes++;
                // Skip all the white space till the next non space
                while ( *pBuf == ' ' ) 
			pBuf++;
            } 
	     else  {
		 if ( *pBuf >='0' && *pBuf <='9' ) {
	                *pRes = *pBuf;
	                pRes++;
		 }
                pBuf++;
            }
        }
        // Close the file and remove it.
        fclose(fp);
        bcmSystemEx("rm /var/wlchannels", 1);
        *pRes = '\0';
    }
}
Example #3
0
File: wldsltr.c Project: ad7843/hi
/*Get Radio State*/
void wl_dsl_tr_get_radioEnabled( int  *value, int idx )
{
    char buf[128] = {0};
    FILE *fp = NULL;

    *value = 1;
    sprintf(buf, "wlctl -i wl%d radio > /var/radiostatus", idx);
    bcmSystemEx(buf, 1);
    fp = fopen("/var/radiostatus", "r");
    if ( fp != NULL ) {
        fgets(buf, 32, fp);
        if ( strstr(buf, "1") != NULL ) {
           *value = 0;
        }
        else { 
            *value = 1;
        }
        fclose(fp);
        bcmSystemEx("rm /var/radiostatus", 1);
    }
}
Example #4
0
void bcmQoscmdExecuteIP(struct optioncmd *optcmd, u_int32_t leaseip)
{

    char *ptokenstart;
    char *pInsert, *pAppend;
    char cmdseg[256];
    char *command = optcmd->command;
    strcpy(cmdseg, command);
    ptokenstart = strstr(cmdseg, "sipop");
    strcpy(ptokenstart, inet_ntoa(leaseip));
    //strcat(ptokenstart, " ");
    strcat(ptokenstart, strstr(command, "]") + 1);
    bcmSystemEx(cmdseg, 1);
}
Example #5
0
void bcmQoscmdFinishIP(struct optioncmd *optcmd, u_int32_t leaseip)
{

    char *ptokenstart;
    char *pInsert, *pAppend;
    char cmdseg[256];
    char *command = optcmd->command;
    strcpy(cmdseg, command);
    ptokenstart = strstr(cmdseg, "sipop");
    strcpy(ptokenstart, inet_ntoa(leaseip));
    //strcat(ptokenstart, " ");
    strcat(ptokenstart, strstr(command, "]") + 1);
    pInsert = strstr(cmdseg, "-A");
    pAppend = strstr(cmdseg, "-I");
    if(pInsert != NULL)
        *(pInsert + 1) = 'D';
    else if(pAppend != NULL)
        *(pAppend + 1) = 'D';
    else
        return;
    bcmSystemEx(cmdseg, 1);
}