configureWiFi方法alljoyn框架出错

时间:2016-04-29 04:21:36

标签: android alljoyn

将目标和onboardee wifinetwork配置传递给新手入门时,我看到了这个错误。

这是发生错误的代码段。

        ConfigureWifiMode res1 = this.onboardingClient.configureWiFi(this.onboardingConfiguration.getTarget().getSSID(), passForConfigureNetwork, this.onboardingConfiguration.getTarget().getAuthType());

        Log.i("OnboardingManager", "configureWiFi result=" + res1);
        switch(OnboardingManager.SyntheticClass_1.$SwitchMap$org$alljoyn$onboarding$transport$OnboardingTransport$ConfigureWifiMode[res1.ordinal()]) {
        case 1:
            this.onboardingClient.connectWiFi();
            return new OnboardingManager.DeviceResponse(OnboardingManager.DeviceResponse.ResponseCode.Status_OK);
        case 2:
            return new OnboardingManager.DeviceResponse(OnboardingManager.DeviceResponse.ResponseCode.Status_OK_CONNECT_SECOND_PHASE);
        default:
            Log.e("OnboardingManager", "configureWiFi returned an unexpected result: " + res1);
            return new OnboardingManager.DeviceResponse(OnboardingManager.DeviceResponse.ResponseCode.Status_ERROR);
        }

这是我的Logcat:

04-28 21:16:35.332 2812-2982/net.holisticlabs.august E/OnboardingManager: onboarddDevice 
                                                                          org.alljoyn.bus.BusException: ER_BUS_SECURITY_NOT_ENABLED

任何帮助都会很棒!谢谢!

1 个答案:

答案 0 :(得分:0)

尝试将身份验证侦听器添加到总线附件:

/* set keyListener */
String keyStoreFileName = getApplicationContext().getFileStreamPath("alljoyn_keystore").getAbsolutePath();

if (keyStoreFileName != null && keyStoreFileName.length() > 0) {
      SrpAnonymousKeyListener authListener = new SrpAnonymousKeyListener(this, m_logger, new String[] { "ALLJOYN_SRP_KEYX", "ALLJOYN_ECDHE_PSK" });
      Status authStatus = m_Bus.registerAuthListener(authListener.getAuthMechanismsAsString(), authListener, keyStoreFileName);

      if (authStatus != Status.OK) {
           Log.d("TAG","Failed to register Auth listener status = " + authStatus.toString());
      }
}


private final GenericLogger m_logger = new GenericLogger() {
        @Override
        public void debug(String TAG, String msg) {
            Logg.d(msg);
    }

    @Override
    public void info(String TAG, String msg) {
        Logg.i(msg);
    }

    @Override
    public void warn(String TAG, String msg) {
        Logg.w(msg);
    }

    @Override
    public void error(String TAG, String msg) {
        Logg.e(msg);
    }

    @Override
    public void fatal(String TAG, String msg) {
        Logg.d(msg);
    }
};