Anxin can share | Share a network distribution applet based on the airkiss protocol, which realizes one-click network distribution of the applet. Anxin can ESP32C3\ESP8266\ESP32\ESP32S2 series of modules. (with source code)

insert image description here


1. About WeChatAirkiss

    This open source project is an open source WeChat distribution network applet made by the Anxin open source team based on the WeChat distribution network airkiss protocol. It is suitable for many Wi-Fi modules sold by Anxin, including ESP32C3\ESP8266\ESP32\ESP32S2 series of modules. Group.

    If you need a wireless module that supports the airkiss distribution protocol, please go to Anxin to find one: click to visit

    See the bottom of the article for the source code!

1.1 Application Scenario

  • I want to get rid of any public cloud platform products and make private cloud platform products.
  • There is no need for a separate native APP, but a cross-platform applet program product.

2. Introduction to airkiss

    AirKiss is a technology of WeChat distribution, LAN discovery and LAN communication provided by WeChat hardware platform for Wi-Fi devices. If the developer wants to configure the Wi-Fi device through the WeChat client, discover the Wi-Fi device on the LAN through the WeChat client, or send the music, pictures, files and other messages in the WeChat client to the Wi-Fi through the LAN equipment.

    The device enters Wi-Fi promiscuous mode to monitor and capture surrounding Wi-Fi packets. Since the device is not connected to the Internet, and the data frame of the Wi-Fi network has been encrypted, the device cannot obtain the content of the payload, but it can obtain some characteristic data of the message, such as the length of each message, and for some data frames. ; For example, UDP broadcast packet or multicast packet, the frame header structure of the packet is relatively fixed, and it is easier to identify.

    At this time, on the mobile phone App or applet side, you can send UDP broadcast packets or multicast packets, and use the characteristics of the packets, such as length changes, to encode.

    Send the SSID/PSW characters of the target Wi-Fi router in the agreed encoding method. After the device captures the UDP packet, it decodes it according to the agreed method, and then the relevant information of the target Wi-Fi router can be obtained and connected to the network. .

    For more information on WeChat airkiss, please refer to the official website documentation: Click me to visit

3. Start using

    To register a WeChat applet by yourself, please download the latest version of WeChat developer tools.

    After creating a new project, open the app.jsfile add the following code:

  "plugins": {
    "airkiss": {
      "version": "1.1.0",
      "provider": "wx610ea582556c983e"
    }
  }

    Then, there will be a prompt whether to add a plug-in, follow the prompts below to add a plug-in to use.

insert image description here

    The following example shows how to use it. For more usage skills and methods, please refer to this applet.

const airkiss = requirePlugin('airkiss');

//获取版本
console.log( airkiss.version)

//这里最好加微信小程序判断账号密码是否为空,以及其长度和是否为5G频段
airkiss.startAirkiss(this.data.ssid, this.data.password, function (res) {
    
    
           switch (res.code) {
    
    
               case 0:
                    wx.showModal({
    
    
                        title: '初始化失败',
                        content: res.result,
                        showCancel: false,
                        confirmText: '收到',
                    })
                   break;
               case 1:
                   wx.showModal({
    
    
                        title: '配网成功',
                        content: '设备IP:' + res.ip + '\r\n 设备Mac:' + res.bssid,
                        showCancel: false,
                        confirmText: '好的',
                    })
                    break;
               case 2:
                   wx.showModal({
    
    
                        title: '配网失败',
                        content: '请检查密码是否正确',
                        showCancel: false,
                        confirmText: '收到',
                    })
                   break;

               default:
                   break;
            }

})


//停止配网,建议在页面 unload 等生命周期里面调用,释放线程
airkiss.stopAirkiss()	

4. API description

airkiss.startAirkiss(ssid,password,funtion())
    To start the configuration, you need to enter the SSID, password, and callback function of the router. See the example for reference instructions.

    Note: Please check whether it is a 2.4G band router and whether the password is correct.

airkiss.stopAirkiss()
Stop the configuration and release the memory of the configuration thread.

Note: It is recommended to call it in the life cycle such as page unload.

airkiss.version
get version


5. FAQ

Q1: It seems to be loading a distribution network plug-in. Is this plug-in open source?

   Answer: Considering some copyright issues, I made this a small program plug-in, which is not open source for the time being. If you want to know more about the use of this plug-in, please go to the Anxinke applet distribution network plug-in details page: click to visit

Q2: Is this distribution network plug-in officially adapted by WeChat? Is it commercial?

    Answer: It is not officially adapted to WeChat, but is not officially adapted to WeChat. The applet plug-in is now available for commercial use.


6. List of open source WeChat IoT control

open source project address open source time
WeChat applet connects to mqtt server and controls esp8266 intelligent hardware https://github.com/xuhongv/WeChatMiniEsp8266 2018.11
WeChat public account airkiss distribution network and the realization of near field discovery in esp8266 rtos3.1 https://github.com/xuhongv/xLibEsp8266Rtos3.1AirKiss 2019.3
WeChat public account airkiss distribution network and implementation of near field discovery in esp32 esp-idf https://github.com/xuhongv/xLibEsp32IdfAirKiss 2019.9
WeChat applet controls esp8266 to achieve colorful effect project source code https://github.com/xuhongv/WCMiniColorSetForEsp8266 2019.9
A WeChat applet location tracking display project based on Anxinke Ca-01 https://github.com/xuhongv/Cat.1TracerWcMini 2019.9
Wechat applet bluetooth distribution network blufi is implemented in esp32 source code https://github.com/xuhongv/BlufiEsp32WeChat 2019.11
WeChat applet bluetooth ble control esp32 colorful light effect https://blog.csdn.net/xh870189248/article/details/101849759 2019.10
Wechat applet mqtt disconnection and reconnection framework for commercial event distribution https://blog.csdn.net/xh870189248/article/details/88718302 2019.2
WeChat applet connects to Alibaba Cloud IoT platform mqtt server via websocket https://blog.csdn.net/xh870189248/article/details/91490697 2019.6
WeChat official account webpage realizes connection to mqtt server https://blog.csdn.net/xh870189248/article/details/100738444 2019.9
WeChat applet AP distribution network Anxinke Wi-Fi module network access example https://github.com/Ai-Thinker-Open/Ai-Thinker-Open_WeChatMiniAP2Net 2020.5
Anxinke IoT WeChat applet is fully open source, and the applet realizes one-key network distribution + control + binding https://blog.csdn.net/xh870189248/article/details/107140464 2020.8
WeChat applet Bluetooth + WiFi control Anxinke ESP32-S/C3S module application https://github.com/xuhongv/ESP32WiFiBleControlProject 2021.6
Anxinke ESP32-S module adapts to Tencent IoT development platform llsync Bluetooth distribution network + MQTT remote control https://github.com/xuhongv/qcloud-esp32-llsync-mqtt 2021.7

Github: https://github.com/Ai-Thinker-Open/WeChatAirkiss
Domestic Code Cloud: https://gitee.com/xuhongv/WeChatAirkiss

contact us

Official website: https://www.ai-thinker.com
Development of DOCS: https://docs.ai-thinker.com
Official forum: http://bbs.ai-thinker.com
Technical support: [email protected]

Guess you like

Origin blog.csdn.net/Boantong_/article/details/121536188