Skip to content

Latest commit

 

History

History
204 lines (166 loc) · 5.17 KB

ESPMeshLocalApi_en.md

File metadata and controls

204 lines (166 loc) · 5.17 KB

[简体中文]

ESP-Mesh Local Api

One: Introduction

ESPMesh is an App that integrates bluetooth distribution network and wi-fi control, The App is available in the App Store. The main functions of ESPMesh are as follows:

  • Wi-fi network configuration function based on bluetooth channel
  • Send control commands over a wi-fi network
  • OTA upgrades for remote and local devices
  • UDP and mDNS scanning

Two: interface directory

  1. Enable bluetooth scan
  2. Turn off bluetooth scan
  3. Get bluetooth status
  4. Bluetooth connection
  5. Send custom data
  6. Device negotiation encryption
  7. Notifies the device to enter encryption mode
  8. Bluetooth config network
  9. Bluetooth disconnection
  10. Enable UDP scanning
  11. Send multiple device commands
  12. Device upgrades
  13. Stop OTA upgrade
  14. Restart device command

Three: details of the interface

/**
 Enable bluetooth scan

 @param success Bluetooth scan successful callback
 @param failure Callback for failed bluetooth scan
 */
- (void)startBleScanSuccess:(BleScanSuccessBlock)success andFailure:(void(^)(int fail))failure;
/**
 Turn off bluetooth scan
 */
- (void)stopBleScan;
// Get bluetooth status, Implement the following proxy method via <BleDelegate>
- (void)bleUpdateStatusBlock:(CBCentralManager *)central;
/**
 Bluetooth connection

 @param deviceInfo Bluetooth connection parameters
 @param success Bluetooth connection successful callback
 @param failure Bluetooth connection failed callback
 */
+ (void)BleConnection:(NSDictionary *)deviceInfo andSuccess:(void(^)(NSDictionary *dic))success andFailure:(void(^)(NSDictionary *dic))failure;
/**
 Send custom data
 
 @param dataMessage Custom data that needs to be sent
 */
- (void)sendMDFCustomDataToDevice:(NSData *)dataMessage;
/**
 Device negotiation encryption
 */
- (void)sendDevicesNegotiatesEncryption;
/**
 Notifies the device to enter encryption mode
 */
- (void)notifyDevicesToEnterEncryptionMode;
/**
 Bluetooth config network
 messageDic = @{
 @"ssid":@"",
 @"password":@"",
 @"ble_addr":@""
 }
 @param messageDic Bluetooth config network information
 @param success Successful callback of bluetooth config network
 @param failure failed callback of bluetooth config network
 */
- (void)startConfigureBlufi:(NSDictionary *)messageDic andSuccess:(void(^)(NSDictionary *dic))success andFailure:(void(^)(NSDictionary *dic))failure;
/**
 Bluetooth disconnection
 */
- (void)stopConfigureBlufi;
/**
 Enable UDP scanning

 @param success UDP scans successful callbacks, There are two scenarios for callbacks: 1. Gets device basic information onDeviceScanning, 2. Get device details DevicesOfScanUDP.
 @param failure UDP scan failed callback, fail is 8010 ande 8011,8010 contains (allArray Incorrect format、getMeshInfoFromHost Network request failed、Device basic information tempInfosArr is empty), 8011 failed to load local storage data for device details query.
 */
+ (void)scanDevicesAsyncSuccess:(DevicesAsyncSuccessBlock)success andFailure:(void(^)(int fail))failure;
/**
 Send multiple device commands
 messageDic = @{
 @"request":@"",
 @"callback":@"",
 @"tag":@"",
 @"mac":@"",
 @"host":@"",
 @"root_response":@"",
 @"isSendQueue":@""
 }
 @param messageDic Send device command information
 @param success Successful callback to send device command
 @param failure Failed callback to send device command
 */
+ (void)requestDevicesMulticastAsync:(NSDictionary *)messageDic andSuccess:(void(^)(NSDictionary *dic))success andFailure:(void(^)(NSDictionary *failureDic))failure;
/**
 Device upgrades
 messageDic = @{
 @"macs":@"",
 @"bin":@"",
 @"host":@"",
 @"type":@""
 }
 @param messageDic Information about equipment upgrades
 @param success Callback for successful device upgrade
 @param failure callback for a failed device upgrade
 */
- (void)startOTA:(NSDictionary *)messageDic Success:(startOTASuccessBlock)success andFailure:(void(^)(int fail))failure;
/**
 Stop OTA upgrade
 messageDic = @{
 @"host":@[]
 }
 @param messageDic Stop OTA upgrade information
 */
- (void)stopOTA:(NSDictionary *)messageDic;
/**
 Restart device command
 messageDic = @{
 @"macs":@[]
 }
 @param messageDic Restart device command information
 */
- (void)reboot:(NSDictionary *)messageDic;