App SDK FAQ
1 Why SDK authentication is failed?
1.License issue. You may get an error code -4023. Please apply for a valid license for controlling on DNA Kit portal. Please make sure the bundle ID of your App is the same as you applied with the license.
2.Network failure You may get an error code -4034. Please make sure the domain names .ibroadlink.com and .broadlink.com.cn are not filtered / blocked on your router. Port 12345 is required to be open on server for SDK authentication. Please confirm the port is not redirected or closed. If the problem still exists, please contact BroadLink FAE and report your license for troubleshooting.
2 The device cannot be added into network?
1.1.Please make sure the device is in configuration mode (blue LED fast flash: configuration mode; slow flash: connecting to network; off: connected. You may need to long press the reset button to resume it to fast flash state) 2. Please make sure the network is in 2.4GHz mode (5GHz is not supported even in 802.11n). It is recommended to give different names to SSIDs for 2.4GHz and 5GHz. 3. If there is no setting for 2.4G/5GHz, please check if your router is working in 802.11n or 802.11b/g/n. If so, please switch it to 802.11b/g for configuration and then switch back after the configuration is done. This is to ensure the router is not working in 802.11n 5GHz. 4. WEP shared key is not supported. If it is used, please change to other encryption mode (WPA2 is recommended).
3 The device was added but why still cannot be discovered?
- Please make sure the device and your mobile phone are in the same WLAN. The device can be only discovered in WLAN.
Please make sure your router or AP is not enabled with AP isolation (in WLAN) mode.
If the discovery sometimes fails, please check the network conditions in your WLAN. The configuration process cannot guarantee 100% success because WLAN broadcasting is used for device discovery. This method is easier for user but it is not guaranteed from protocol layer. It is recommended to repeat the discovery every 3 sec if the app is active.
[self.let.controller startProbe:3000]; // Start probe device
self.let.controller.delegate = self;
4. The device is found but configuration is failed
- Please make sure the device and control terminal are in the same WLAN as the configuration process is only valid in WLAN.
- The ID and key are necessary parameters for device remote control. They are generated by the device and will be only changed after the device is reset. You need to re-pair the device after it is reset.
- Please make sure the device information is intact during calling the configuration interface.
BLDNADevice *dnaDevice = [[BLDNADevice alloc] init];
dnaDevice.pid = @"00000000000000000000000037270000";
dnaDevice.did = @"0000000000000000000034ea34b3060e";
dnaDevice.mac = @"34:ea:34:b3:06:0e";
dnaDevice.name = @"Universal Remote";
dnaDevice.type = 10039;
dnaDevice.password = 215625664;
dnaDevice.controlId = 5;
dnaDevice.controlKey = @"9bf3040cd1667b7b08daf16a3e4d685a";
[[BLLet sharedLet].controller addDevice:dnaDevice];
4.Please check network conditions of WLAN. If the WLAN is not stable, you can properly add the value of ‘ltimeout”.
5 Device control failed and return with error code -7
- The ID and key are necessary parameters for device remote control and must be correct. They are generated by the device and will be only changed after the device is reset. If you get a -7 error, that means your ID or key is incorrect.
- Please make sure the device has been added into network and the device information includes returned ID and key during calling the control interface.
- The device has been reset. After reset, the device needs to be re-configured to update its ID and key.
BLPairResult *result = [[BLLet sharedLet].controller pair:device.did];
NSLog(@"id:%ld,key:%@",(long)result.getId,result.getKey);
6 Device control failed and return with error code -4000
- Please check the network conditions. You can properly add the value of “ltimeout” for WLAN control or add the value of “rtimeout” for remote control.
objc [BLLet sharedLet].configParam.controllerLocalTimeout = 2000; [BLLet sharedLet].configParam.controllerRemoteTimeout = 4000;
- If you are developing with BroadLink Wi-Fi module, please make sure the communication data is correct. You can try to use UART mode to debug protocol and then test your script via standard interface until the data packet is correct.
7 How to determine if a device is in WLAN?
The device discovery adopts WLAN broadcasting mechanism which cannot guarantee 100% success. From our experience, if the app is active with Wi-Fi connected, the app can start a timer for repeated discovery for every 3s. If the discovery fails for 3 times, you can consider the device is not in WLAN, otherwise it is in WLAN. If the app is running in background or the control terminal is not connected to Wi-Fi, you can consider the device is not in WLAN. Due to the characteristics of broadcasting, the app cannot identify if the device is offline in WLAN immediately. There is a certain timeout and within the timeout period the device cannot be accessed.
typedef NS_ENUM(NSInteger, BLDeviceStatusEnum) {
/** Initializing (Unknown) */
BL_DEVICE_STATE_UNKNOWN = 0,
/** WLAN */
BL_DEVICE_STATE_LAN = 1,
/** Remote */
BL_DEVICE_STATE_REMOTE = 2,
/** Offline */
BL_DEVICE_STATE_OFFLINE = 3
};
8 Device control is successful locally but failed remotely?
- User login is required for remote control. You need to check SDK log after user login. If “auth result” returns error code “-4037” or “SDK not register, please call SDKAuth first”, that means the authentication is failed. <appsdk_v2_faq.html#sdk> A typical successful authentication log is shown as below:
[BLLet DEBUG]Controller auth param: {"license":"CceFpDt7d+r4pZ8KP74tbpNSf9Ug9pP+ytpIXApsCYpvvDEid0s8SdJtKgQMc5QmUsWWVwAAAACvEX37zpG5Wgi\/Mlnda1pd2B9J96AQz9N0vO6WstfgR9yEgbkpFXFyJbsnfyHXt8pOdkTVo81rQrPhkOnhmpQBsEkbxXTfoUSQjDzWcfVjcAAAAAA=","account_id":"53356bc73e636b2dc50f3e5ca8b76b0c","account_session":"0d80378bc4cdaac90430d2fb86e7b7b9"}
[Debug]:networkapi_network.c,622 https server: 09c785a43b7b77eaf8a59f0a3fbe2d6eauth.ibroadlink.com:1998
[BLLet DEBUG]Controller auth result: {"lid":"09c785a43b7b77eaf8a59f0a3fbe2d6e","status":0,"msg":"sdk register success"}
- If it returns an error code “-7”, please refer to the fifth faq.
- Please check the connection to device access service by pinging “devicetype+access.ibroadlink.com” from your phone.
9 Device control is successful but SDK returns with failure?
The device control is successful but SDK returns an error code “-4000” indicating the control has timed out.
This error may occur during the return of control result. The SDK needs to acknowledge the packet from device containing successful information and it will consider the control has timed out if it does not receive the return packet in valid time range.
10 The device keeps its uninitialized state 0
- You need to call “addDevice” in SDK to query device state after discovery.
BLDNADevice *dnaDevice = [[BLDNADevice alloc] init];
dnaDevice.pid = @"00000000000000000000000037270000";
dnaDevice.did = @"0000000000000000000034ea34b3060e";
dnaDevice.mac = @"34:ea:34:b3:06:0e";
dnaDevice.name = @"Universal Remote";
dnaDevice.type = 10039;
dnaDevice.password = 215625664;
dnaDevice.controlId = 5;
dnaDevice.controlKey = @"9bf3040cd1667b7b08daf16a3e4d685a";
[[BLLet sharedLet].controller addDevice:dnaDevice];
- The query result from SDK may stay as 0 (uninitialized) for 1-2s after the device is added and will soon refreshed as normal.
BLDeviceStatusEnum state = [[BLLet sharedLet].controller queryDeviceState:device.did];
typedef NS_ENUM(NSInteger, BLDeviceStatusEnum) {
/** Initializing (Unknown) */
BL_DEVICE_STATE_UNKNOWN = 0,
/** WLAN */
BL_DEVICE_STATE_LAN = 1,
/** Remote */
BL_DEVICE_STATE_REMOTE = 2,
/** Offline */
BL_DEVICE_STATE_OFFLINE = 3
};
11 Device binding failure
If the device binding is failed, it will return :{"status":-2016,"msg":"bind fail”}
- This may cause failure of remote control and it occurs because the device is not added in your license.
- Please log in to DNAKit platform and go to Platform Integration - SDK Integration - My License to add the products you want to control DNAkit platform
12 Error code -4020 returned from device control
- Device control relies on commands parsing by scripts. It is required to download device related scripts before controlling.
- Please check the existence and validity of script on phone. The default path for iOS is: xcappdata -> AppData -> Documents -> Let -> script The default path for Android is: cache -> let -> script The file is in the format like (e.g. Pid.script): 000000000000000000000000b54f0000.script
13 How to print out log?
- Logs are very helpful for developers to analyze issues during the use of SDK. You may see these types of logs: BL_LEVEL_NONE, BL_LEVEL_ERROR, BL_LEVEL_WARN, BL_LEVEL_DEBUG, BL_LEVEL_ALL.
- If the issue still cannot be located, you can set the log level to be BL_LEVEL_ALL and print out the complete log for further assistance from technical support.
typedef NS_ENUM(NSUInteger, BLDebugLevelEnum) {
/** Do not print */
BL_LEVEL_NONE = 0,
/** Print error messages */
BL_LEVEL_ERROR = 1,
/** Print error and warning messages */
BL_LEVEL_WARN = 2,
/** Print error, warning and debugging messages */
BL_LEVEL_DEBUG = 3,
/** Print all messages */
BL_LEVEL_ALL = 4
};
BLLet *let = [BLLet sharedLetWithLicense:@"Your License"]; // Init APPSDK
[let setDebugLog:BL_LEVEL_ALL]; // Set APPSDK debug log level
[let.controller setSDKRawDebugLevel:BL_LEVEL_ALL]; // Set DNASDK debug log level