Search in sources :

Example 1 with DobbyWifiInfo

use of com.inceptai.dobby.model.DobbyWifiInfo in project dobby-android by InceptAi.

the class WifiAnalyzer method initializeWifiState.

private void initializeWifiState() {
    Preconditions.checkNotNull(wifiManager);
    WifiInfo wifiInfo = wifiManager.getConnectionInfo();
    //Switch thread and do this.
    wifiState.updateWifiStats(new DobbyWifiInfo(wifiInfo), null);
    registerWifiStateReceiver();
    //Publish detailed connection state and wifi state on the bus
    updateWifiStatsDetailedState(WifiInfo.getDetailedStateOf(wifiInfo.getSupplicantState()));
    processWifiStateChanged(wifiManager.getWifiState());
}
Also used : DobbyWifiInfo(com.inceptai.dobby.model.DobbyWifiInfo) WifiInfo(android.net.wifi.WifiInfo) DobbyWifiInfo(com.inceptai.dobby.model.DobbyWifiInfo)

Example 2 with DobbyWifiInfo

use of com.inceptai.dobby.model.DobbyWifiInfo in project dobby-android by InceptAi.

the class InferenceEngine method notifyWifiState.

public synchronized DataInterpreter.WifiGrade notifyWifiState(WifiState wifiState, @WifiState.WifiLinkMode int wifiLinkMode, @ConnectivityAnalyzer.WifiConnectivityMode int wifiConnectivityMode) {
    DataInterpreter.WifiGrade wifiGrade = new DataInterpreter.WifiGrade();
    if (wifiState != null) {
        HashMap<Integer, WifiState.ChannelInfo> channelMap = wifiState.getChannelInfoMap();
        DobbyWifiInfo wifiInfo = wifiState.getLinkInfo();
        wifiGrade = DataInterpreter.interpret(channelMap, wifiInfo, wifiLinkMode, wifiConnectivityMode);
        wifiGrade.errorCode = getWifiErrorCode(wifiConnectivityMode);
    }
    metricsDb.updateWifiGrade(wifiGrade);
    PossibleConditions conditions = InferenceMap.getPossibleConditionsFor(wifiGrade);
    currentConditions.mergeIn(conditions);
    DobbyLog.i("InferenceEngine Wifi Grade: " + wifiGrade.toString());
    DobbyLog.i("InferenceEngine which gives conditions: " + conditions.toString());
    DobbyLog.i("InferenceEngine After merging: " + currentConditions.toString());
    checkAndSendSuggestions();
    return wifiGrade;
}
Also used : DobbyWifiInfo(com.inceptai.dobby.model.DobbyWifiInfo)

Example 3 with DobbyWifiInfo

use of com.inceptai.dobby.model.DobbyWifiInfo in project dobby-android by InceptAi.

the class NetworkLayer method getCurrentWifiGrade.

public DataInterpreter.WifiGrade getCurrentWifiGrade() {
    HashMap<Integer, WifiState.ChannelInfo> channelMap = getWifiState().getChannelInfoMap();
    DobbyWifiInfo wifiInfo = getWifiState().getLinkInfo();
    DataInterpreter.WifiGrade wifiGrade = DataInterpreter.interpret(channelMap, wifiInfo, getWifiLinkMode(), getCurrentConnectivityMode());
    return wifiGrade;
}
Also used : DobbyWifiInfo(com.inceptai.dobby.model.DobbyWifiInfo) DataInterpreter(com.inceptai.dobby.ai.DataInterpreter)

Example 4 with DobbyWifiInfo

use of com.inceptai.dobby.model.DobbyWifiInfo in project dobby-android by InceptAi.

the class WifiAnalyzer method updateWifiStatsWithWifiInfo.

protected void updateWifiStatsWithWifiInfo(WifiInfo info) {
    if (info == null) {
        info = wifiManager.getConnectionInfo();
    }
    //Convert to DobbyWifiInfo
    DobbyWifiInfo dobbyWifiInfo = new DobbyWifiInfo(info);
    ;
    wifiState.updateWifiStats(dobbyWifiInfo, null);
}
Also used : DobbyWifiInfo(com.inceptai.dobby.model.DobbyWifiInfo)

Aggregations

DobbyWifiInfo (com.inceptai.dobby.model.DobbyWifiInfo)4 WifiInfo (android.net.wifi.WifiInfo)1 DataInterpreter (com.inceptai.dobby.ai.DataInterpreter)1