AliOS-Thingsネットワーク方式

10151 ワード

配網方式


テストプラットフォームesp 8266

1キーネットワーク


製品の作成
  • インテリジェントライフオープンプラットフォーム製品作成モジュールまたはプラットフォーム(esp 8266,mk 3060...)
  • 上記の情報をプログラム
  • に書き込む.
    #define PRODUCT_KEY     "a15trrE4PqM"
    #define PRODUCT_SECRET  "4uZsr1uSnCwzhjPM"
    #define DEVICE_NAME     "IFn66CxbVIlOoOaI2cJy"
    #define DEVICE_SECRET   "qwvShyphCALzDy380ppcRnj0zNZFjc8S"
    

    入力が間違っていると、配網時にpasswd errが表示されます.
  • 携帯アプリでWebページのQRコードをスキャンし、ネットワークに接続し、ssid/passwdを入力する.
  • ハードウェアに基づいて、キーを配置し、キーを1キーネットワークモード
  • に入れる.
    void linkkit_key_process(input_event_t *eventinfo, void *priv_data)
    {
        if (eventinfo->type != EV_KEY) {
            return;
        }
        LOG("awss config press %u
    ", eventinfo->value); if (eventinfo->code == CODE_BOOT) { //CODE_BOOT if (eventinfo->value == VALUE_KEY_CLICK) { do_awss_active(); } else if (eventinfo->value == VALUE_KEY_LTCLICK) { do_awss_reset(); } } }
    
    [010750] awss config press 2
    
    [010750] do_awss_active 0
    
    [010750] enable awss
    
    [010750] IOTX_AWSS_ENABLE
    
    
    [297980] chan 11
    
    [298150] hint frame: offset:52, F, sn:8c4
    
    [298150] src:dc0c5cd5c72e, bssid:586ab1a6b290
    
    [298150] chan lock @ 11
    
    [298150] IOTX_AWSS_LOCK_CHAN
    [298150] 8+0 [100] 8c7 F 3e1
    
    [298150] IOTX_AWSS_LOCK_CHAN
    [298160] 8+1 [92] 8cb F 146
    
    [298160] 8+2 [84] 8cf F 1c9
    
    [298250] [chan scanning] 116120 ms
    
    [298250] final chan 11
    
    [298250] 8+3 [76] 8d2 F 22a
    
    [298250] 8+4 [68] 8d5 F 28f
    
    [298250] 8+5 [60] 8d8 F 327
    
    [298250] 8+6 [58] 8da F 38c
    
    [298250] 8+7 [50] 8dd F 405
    
    [298350] 8+8 [42] 8e1 F 485
    
    [298350] 16+0 [100] 8e3 F 3e2
    
    [298360] IOTX_AWSS_LOCK_CHAN
    [298360] 16+0 [100] 8e5 F 3e2
    
    [298360] IOTX_AWSS_LOCK_CHAN
    [298360] 16+1 [92] 8e8 F 11e
    
    [298360] invalid len = 178
    
    [298360] 16+2 [84] 8ec F 192
    
    [298460] 16+3 [76] 8f1 F 23b
    
    [298460] 16+4 [68] 8f4 F 2a2
    
    [298460] 16+5 [60] 8f7 F 309
    
    [298460] 16+6 [52] 8fa F 38c
    
    [298460] 16+7 [36] 900 F 40d
    
    [298560] 0+0 [100] 908 F 4e0
    
    [298560] IOTX_AWSS_LOCK_CHAN
    [298560] 0+0 [100] 90a F 4e0
    
    [298560] IOTX_AWSS_LOCK_CHAN
    [298560] 0+0 [100] 90d F 4e0
    
    [298560] IOTX_AWSS_LOCK_CHAN
    [298560] 0+1 [98] 90f F 117
    
    [298660] 0+2 [90] 914 F 18f
    
    [298660] 0+3 [82] 918 F 206
    
    [298660] ssid auto-complete: gtwifi
    
    [298660] 0+4 [80] 91a F 28b
    
    [298660] 
    
    62 65 65 50 65 65 65 65 
    65 65 4c 44 3c 3a 32 2a 
    5c 54 4c 44 3c 34 24 
    [298670] 
    
    17 0f 06 0b 47 54 57 49 
    46 49 2a 0f 27 0c 05 05 
    1e 12 3b 22 09 0c 0d 
    [298670] 
    
    [298670] SSID1: [gtwifi]
    
    [298670] security level: 3
    [298670] zconfig done. ssid:gtwifi, mac:586ab1a6b290
    
    [298670] ssid:gtwifi, bssid:586ab1a6b290, 11
    
    [298670] IOTX_AWSS_GOT_SSID_PASSWD
    [298850] [chan recving] 116720 ms
    
    [298850] IOTX_AWSS_CONNECT_ROUTER
    scandone
    state: 0 -> 2 (b0)
    state: 2 -> 3 (0)
    state: 3 -> 5 (10)
    add 0
    aid 2
    pm open phy_2,type:2 0 0
    cnt 
    
    connected with gtwifi, channel 11
    dhcp client start...
    [WiFi] event 1
    ip:172.16.47.221,mask:255.255.254.0,gw:172.16.46.1
    [WiFi] event 4
    [302450] Got ip : 172.16.47.221, gw : 172.16.46.1, mask : 255.255.254.0
    memcmp2 success 3115fc
    [302450] Let's post GOT_IP event.
    memcmp2 success 311640
    [302460] wifi_service_event config.ssid gtwifi
    [prt] log level set as: [ 5 ]
    [302460] CM Fd: 0
    [302460] IOTX_CONN_CLOUD
    [302460] ....................................................
    [302470]           ProductKey : a1IoWyzxxf9
    [302470]           DeviceName : WQAEtYl7iZF7HEObchPx
    [302470]             DeviceID : a1IoWyzxxf9.WQAEtYl7iZF7HEObchPx
    [302470] ....................................................
    [302470]        PartnerID Buf : ,partner_id=example.demo.partner-id
    [302470]         ModuleID Buf : ,module_id=example.demo.module-id
    [302470]           Guider URL : 
    [302470]       Guider SecMode : 2 (TLS + Direct)
    [302470]     Guider Timestamp : 2524608000000
    [302470] ....................................................
    [302470] -----------------------------------------
    [302470]             Host : a1IoWyzxxf9.iot-as-mqtt.cn-shanghai.aliyuncs.com
    [302470]             Port : 1883
    [302470]         ClientID : a1IoWyzxxf9.WQAEtYl7iZF7HEObchPx|securemode=2,timestamp=2524608000000,signmethod=hmacsha256,gw=0,ext=0,partner_id=example.demo.partner-id,module_id=example.demo.module-id,a=aos-r-2.1.0|
    [302470]       TLS PubKey : 0x4020d19e ('-----BEGIN CERTI ...')
    [302480] -----------------------------------------
    [302480] MQTT init success!
    [302480] Loading the CA root certificate ...
    [302510]  ok (0 skipped)
    [302510] Connecting to /a1IoWyzxxf9.iot-as-mqtt.cn-shanghai.aliyuncs.com/1883...
    Wifi connected.
    [302600]  ok
    [302600]   . Setting up the SSL/TLS structure...
    [302600]  ok
    [302600] Performing the SSL/TLS handshake...
    [303350] AP connected
    [303350] awss connect ssid:gtwifi success
    [303350] IOTX_AWSS_GOT_IP
    [303350] --------------------------------AWSS STATIS-----------------------------------
    [303350] name                max     min     mean    cnt     suc     crc-err passwd-err
    [303350] Router              4500    4500    4500    1       1       0       0
    [303350] SM                  520     520     520     1       1       0       0
    [303350] WPS                 0       0       0       0       0       0       0
    [303350] Aha                 0       0       0       0       0       0       0
    [303350] Adha                0       0       0       0       0       0       0
    [303350] Zconfig             0       0       0       0       0       0       0
    [303350] Dev-ap              0       0       0       0       0       0       0
    [303350] ------------------------------------------------------------------------------
    [303350] start, ssid:gtwifi, strlen:6
    
    awss register /sys/awss/device/connectap/info/get
    awss register /sys/a1IoWyzxxf9/WQAEtYl7iZF7HEObchPx/awss/device/connectap/info/get
    [303360] resp:0
    
    [303360] IOTX_AWSS_SUC_NOTIFY
    [303360] topic:/sys/awss/event/connectap/notify
    
    [303360] payload:{"id":"1","version":"1.0","method":"awss.event.connectap.notify","params":{"awssVer":{"smartconfig":"2.0","zconfig":"2.0","router":"2.0","ap":"2.0","softap":"2.0"},"productKey":"a1IoWyzxxf9","deviceName":"WQAEtYl7iZF7HEObchPx","mac":"DC:4F:22:58:CD:D9","ip":"172.16.47.221","cipherType":4,"type":0}}
    
    [303370] send notify success
    [303370] --------------------------------AWSS STATIS-----------------------------------
    [303370] name                max     min     mean    cnt     suc     crc-err passwd-err
    [303370] Router              4500    4500    4500    1       1       0       0
    [303370] SM                  520     520     520     1       1       0       0
    [303370] WPS                 0       0       0       0       0       0       0
    [303380] Aha                 0       0       0       0       0       0       0
    [303380] Adha                0       0       0       0       0       0       0
    [303380] Zconfig             0       0       0       0       0       0       0
    [303380] Dev-ap              0       0       0       0       0       0       0
    [303380] ------------------------------------------------------------------------------
    [303470] resp:0
    
    [303470] topic:/sys/awss/event/connectap/notify
    
    [303470] payload:{"id":"2","version":"1.0","method":"awss.event.connectap.notify","params":{"awssVer":{"smartconfig":"2.0","zconfig":"2.0","router":"2.0","ap":"2.0","softap":"2.0"},"productKey":"a1IoWyzxxf9","deviceName":"WQAEtYl7iZF7HEObchPx","mac":"DC:4F:22:58:CD:D9","ip":"172.16.47.221","cipherType":4,"type":0}}
    
    [303470] send notify success
    [303640]  ok
    [303640]   . Verifying peer X.509 certificate..
    [303640] certificate verification result: 0x00
    [303670] resp:0
    
    [303670] topic:/sys/awss/event/connectap/notify
    
    [303670] payload:{"id":"3","version":"1.0","method":"awss.event.connectap.notify","params":{"awssVer":{"smartconfig":"2.0","zconfig":"2.0","router":"2.0","ap":"2.0","softap":"2.0"},"productKey":"a1IoWyzxxf9","deviceName":"WQAEtYl7iZF7HEObchPx","mac":"DC:4F:22:58:CD:D9","ip":"172.16.47.221","cipherType":4,"type":0}}
    
    [303670] send notify success
    [303730] mqtt connect success!
    [303730] Upstream Topic: '/sys/a1IoWyzxxf9/WQAEtYl7iZF7HEObchPx/thing/status/update'
    [303740] Upstream Payload:
    ␛[1;33m
    > {
    >     "id": "a1IoWyzxxf9_WQAEtYl7iZF7HEObchPx_mid",
    >     "params": {
    >         "_sys_device_mid": "example.demo.module-id",
    >         "_sys_device_pid": "example.demo.partner-id"
    >     }
    > }
    

    2携帯電話はホットスポットのネットをつけます


    デバイスデフォルト接続ホットスポット「aha」
    携帯電話で「aha」のホットスポットを開く