Example #1
0
void _checkIfReturnedValueIsCorrect(Array<Uint16>& providerReturnedVal)
{

   Array<Uint16> actualVal(NUM_QUERY_CAPABILITIES);

   if (providerReturnedVal.size() != (unsigned)NUM_QUERY_CAPABILITIES)
   {
      throw Exception(
          "Number of capabilities returned by the Provider "
              "does not match the actual value.");
   }

   getFeatureSet(actualVal);

   for (unsigned int j=0; j<(unsigned)NUM_QUERY_CAPABILITIES; j++)
   {
     if (providerReturnedVal[j] != actualVal[j])
     {
        char msg[1024];
        sprintf(msg, "Expected capability value=%hu, returned=%hu.",
                actualVal[j], providerReturnedVal[j]);
        throw Exception(msg);
     }
   }
}
Example #2
0
FeatureSet* PathTable::getFeatureSet(SSPath& p)
{
   if ( f_lastSymIndex == 0 ) {
     initLastSymIndex();
   }

   int pids[3];
   FeatureSet* fs[3];

   fs[0] = getFeatureSet(findIndex(p), p, pids[0]);
   fs[1] = getFeatureSet(gElemSymTab -> wildCardId(), p, pids[1]);
   fs[2] = getFeatureSet(gElemSymTab -> unlimitedWildCardId(), p, pids[2]);

   int index = 0;
   int x = pids[0];

   for ( int i=1; i<3; i++ ) {
     if ( pids[i] > x )
       index = i;
   }

   return fs[index];
}
int main(int argc, char *argv[]) {

    pthread_mutex_init(&printMutex, NULL);

    if (init() != 0) {
        printMsg("could not initiate HAL");
        return -1;
    } else {
        printMsg("successfully initialized HAL; wlan0 = %p\n", wlan0Handle);
    }

    pthread_cond_init(&eventCacheCondition, NULL);
    pthread_mutex_init(&eventCacheMutex, NULL);

    pthread_t tidEvent;
    pthread_create(&tidEvent, NULL, &eventThreadFunc, NULL);

    sleep(2);     // let the thread start

    if (argc < 2 || argv[1][0] != '-') {
        printf("Usage:  halutil [OPTION]\n");
        printf(" -s               start AP scan test\n");
        printf(" -swc             start Significant Wifi change test\n");
        printf(" -h               start Hotlist APs scan test\n");
        printf(" -ss              stop scan test\n");
        printf(" -max_ap          Max AP for scan \n");
        printf(" -base_period     Base period for scan \n");
        printf(" -threshold       Threshold scan test\n");
        printf(" -avg_RSSI        samples for averaging RSSI\n");
        printf(" -ap_loss         samples to confirm AP loss\n");
        printf(" -ap_breach       APs breaching threshold\n");
        printf(" -ch_threshold    Change in threshold\n");
        printf(" -wt_event        Waiting event for test\n");
        printf(" -low_th          Low threshold for hotlist APs\n");
        printf(" -hight_th        High threshold for hotlist APs\n");
        printf(" -hotlist_bssids  BSSIDs for hotlist test\n");
        printf(" -stats       print link layer statistics\n");
        printf(" -get_ch_list <a/bg/abg/a_nodfs/abg_nodfs/dfs>  Get channel list\n");
        printf(" -get_feature_set  Get Feature set\n");
        printf(" -get_feature_matrix  Get concurrent feature matrix\n");
        printf(" -rtt             Run RTT on nearby APs\n");
        printf(" -rtt_samples     Run RTT on nearby APs\n");
        printf(" -scan_mac_oui XY:AB:CD\n");
        printf(" -nodfs <0|1>     Turn OFF/ON non-DFS locales\n");
        goto cleanup;
    }
    memset(mac_oui, 0, 3);

    if (strcmp(argv[1], "-s") == 0) {
        readTestOptions(argc, argv);
        setPnoMacOui();
        testScan();
    }else if(strcmp(argv[1], "-swc") == 0){
        readTestOptions(argc, argv);
        setPnoMacOui();
        trackSignificantChange();
    }else if (strcmp(argv[1], "-ss") == 0) {
        // Stop scan so clear the OUI too
        setPnoMacOui();
        testStopScan();
    }else if ((strcmp(argv[1], "-h") == 0)  ||
              (strcmp(argv[1], "-hotlist_bssids") == 0)) {
        readTestOptions(argc, argv);
        setPnoMacOui();
        testHotlistAPs();
    }else if (strcmp(argv[1], "-stats") == 0) {
        getLinkStats();
    } else if ((strcmp(argv[1], "-rtt") == 0)) {
        readTestOptions(argc, argv);
        testRTT();
    } else if ((strcmp(argv[1], "-get_ch_list") == 0)) {
        readTestOptions(argc, argv);
        getChannelList();
    } else if ((strcmp(argv[1], "-get_feature_set") == 0)) {
        getFeatureSet();
    } else if ((strcmp(argv[1], "-get_feature_matrix") == 0)) {
        getFeatureSetMatrix();
    } else if ((strcmp(argv[1], "-scan_mac_oui") == 0)) {
        readTestOptions(argc, argv);
        setPnoMacOui();
        testScan();
    } else if (strcmp(argv[1], "-nodfs") == 0) {
        u32 nodfs = 0;
        if (argc > 2)
            nodfs = (u32)atoi(argv[2]);
        wifi_set_nodfs_flag(wlan0Handle, nodfs);
    }
cleanup:
    cleanup();
    return 0;
}