epptouch sdk更新,闪退修改强化
This commit is contained in:
Vendored
BIN
Binary file not shown.
@@ -53,7 +53,7 @@
|
||||
/**
|
||||
* Updates the checksum value with the given byte.
|
||||
*
|
||||
* @param value
|
||||
* @param val
|
||||
* the byte to update the checksum with.
|
||||
*/
|
||||
- (void)updateWithValue:(int)value;
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
# EspTouch
|
||||
|
||||
## Example
|
||||
- [example](../UI/V1/)
|
||||
|
||||
## APIs
|
||||
- Create task instance
|
||||
```Objective-C
|
||||
ESPTouchTask *task = [[ESPTouchTask alloc] initWithApSsid:apSsid andApBssid:apBssid andApPwd:apPwd];
|
||||
[task setEsptouchDelegate:delegate]; // Set result callback
|
||||
[Task setPackageBroadcast:YES]; // if YES send broadcast packets, else send multicast packets
|
||||
```
|
||||
|
||||
- Execute task
|
||||
```Objective-C
|
||||
int expectCount = 1;
|
||||
NSArray * results = [task executeForResults:expectCount];
|
||||
ESPTouchResult *first = [results objectAtIndex:0];
|
||||
if (first.isCancelled) {
|
||||
// User cancel the task
|
||||
return;
|
||||
}
|
||||
if (first.isSuc) {
|
||||
// EspTouch successfully
|
||||
}
|
||||
```
|
||||
|
||||
- Cancel task
|
||||
```Objective-C
|
||||
[task interrupt];
|
||||
```
|
||||
@@ -11,7 +11,7 @@
|
||||
#import "ESPTouchDelegate.h"
|
||||
#import "ESPAES.h"
|
||||
|
||||
#define ESPTOUCH_VERSION @"SDK-v1.0.0"
|
||||
#define ESPTOUCH_VERSION @"SDK-v1.1.0"
|
||||
|
||||
#define DEBUG_ON YES
|
||||
|
||||
@@ -28,8 +28,10 @@
|
||||
* the Ap's ssid
|
||||
* @param apBssid
|
||||
* the Ap's bssid
|
||||
* @param apPwd
|
||||
* @param apPassword
|
||||
* the Ap's password
|
||||
* @param isSsidHidden
|
||||
* whether the Ap's ssid is hidden
|
||||
*/
|
||||
- (id) initWithApSsid: (NSString *)apSsid andApBssid: (NSString *) apBssid andApPwd: (NSString *)apPwd;
|
||||
|
||||
@@ -45,10 +47,14 @@
|
||||
* the Ap's ssid
|
||||
* @param apBssid
|
||||
* the Ap's bssid
|
||||
* @param apPwd
|
||||
* @param apPassword
|
||||
* the Ap's password
|
||||
* @param timeoutMillisecond (it should be >= 15000+6000)
|
||||
* millisecond of total timeout
|
||||
* @param isSsidHidden
|
||||
* whether the Ap's ssid is hidden
|
||||
* @param timeoutMillisecond(it should be >= 15000+6000)
|
||||
* millisecond of total timeout
|
||||
* @param context
|
||||
* the Context of the Application
|
||||
*/
|
||||
- (id) initWithApSsid: (NSString *)apSsid andApBssid: (NSString *) apBssid andApPwd: (NSString *)apPwd andTimeoutMillisecond: (int) timeoutMillisecond;
|
||||
|
||||
@@ -59,12 +65,14 @@
|
||||
* the Ap's ssid
|
||||
* @param apBssid
|
||||
* the Ap's bssid
|
||||
* @param apPwd
|
||||
* @param apPassword
|
||||
* the Ap's password
|
||||
* @param isSsidHidden
|
||||
* whether the Ap's ssid is hidden
|
||||
* @param timeoutMillisecond (it should be >= 15000+6000)
|
||||
* millisecond of total timeout
|
||||
* @param timeoutMillisecond(it should be >= 15000+6000)
|
||||
* millisecond of total timeout
|
||||
* @param context
|
||||
* the Context of the Application
|
||||
*/
|
||||
- (id) initWithApSsid: (NSString *)apSsid andApBssid: (NSString *) apBssid andApPwd: (NSString *)apPwd andIsSsidHiden: (BOOL) isSsidHidden andTimeoutMillisecond: (int) timeoutMillisecond __deprecated_msg("Use initWithApSsid:(NSString *) andApBssid:(NSString *) andApPwd:(NSString *) andTimeoutMillisecond:(int) instead.");
|
||||
|
||||
@@ -62,20 +62,19 @@
|
||||
|
||||
- (id)initWithApSsid:(NSString *)apSsid andApBssid:(NSString *)apBssid andApPwd:(NSString *)apPwd andAES:(ESPAES *)aes
|
||||
{
|
||||
self = [super init];
|
||||
NSLog(@"Welcome Esptouch %@",ESPTOUCH_VERSION);
|
||||
if (apSsid==nil||[apSsid isEqualToString:@""])
|
||||
{
|
||||
perror("ESPTouchTask initWithApSsid() apSsid shouldn't be null or empty");
|
||||
return self;
|
||||
}
|
||||
// the apSsid should be null or empty
|
||||
assert(apSsid!=nil&&![apSsid isEqualToString:@""]);
|
||||
// assert(apSsid!=nil&&![apSsid isEqualToString:@""]);
|
||||
if (apPwd == nil)
|
||||
{
|
||||
apPwd = @"";
|
||||
}
|
||||
|
||||
self = [super init];
|
||||
if (self)
|
||||
{
|
||||
if (DEBUG_ON)
|
||||
|
||||
@@ -156,7 +156,7 @@
|
||||
|
||||
/**
|
||||
* set whether the router support IPv6
|
||||
* @param isIPv6Supported whether the router support IPv6
|
||||
* @param isIPv4Supported whether the router support IPv6
|
||||
*/
|
||||
- (void) setIsIPv6Supported:(BOOL) isIPv6Supported;
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
//
|
||||
|
||||
#import "ESPTouchTaskParameter.h"
|
||||
#import "ESP_NetUtil.h"
|
||||
|
||||
@interface ESPTaskParameter()
|
||||
@property (nonatomic,assign) long intervalGuideCodeMillisecond;
|
||||
@@ -147,7 +148,9 @@ static int _datagramCount = 0;
|
||||
{
|
||||
if (_isIPv4Supported0) {
|
||||
if (self.broadcast) {
|
||||
return @"255.255.255.255";
|
||||
NSString *localInetAddr4 = [ESP_NetUtil getLocalIPv4];
|
||||
NSArray *arr = [localInetAddr4 componentsSeparatedByString:@"."];
|
||||
return [NSString stringWithFormat:@"%@.%@.%@.255",arr[0], arr[1], arr[2]];
|
||||
} else {
|
||||
int count = [self __getNextDatagramCount];
|
||||
return [NSString stringWithFormat: @"234.%d.%d.%d", count, count, count];
|
||||
|
||||
@@ -17,11 +17,11 @@
|
||||
/**
|
||||
* send the data by UDP
|
||||
*
|
||||
* @param bytesArray2
|
||||
* @param bytes
|
||||
* the array of datas to be sent
|
||||
* @param targetHostName
|
||||
* @param targetHost
|
||||
* the host name of target, e.g. 192.168.1.101
|
||||
* @param port
|
||||
* @param targetPort
|
||||
* the port of target
|
||||
* @param interval
|
||||
* the milliseconds to between each UDP sent
|
||||
@@ -32,15 +32,15 @@
|
||||
/**
|
||||
* send the data by UDP
|
||||
*
|
||||
* @param bytesArray2
|
||||
* @param data
|
||||
* the data to be sent
|
||||
* @param offset
|
||||
* the offset which data to be sent
|
||||
* @param count
|
||||
* the count of the data
|
||||
* @param targetHostName
|
||||
* @param targetHost
|
||||
* the host name of target, e.g. 192.168.1.101
|
||||
* @param port
|
||||
* @param targetPort
|
||||
* the port of target
|
||||
* @param interval
|
||||
* the milliseconds to between each UDP sent
|
||||
|
||||
@@ -133,7 +133,7 @@
|
||||
andInterval: (long) interval
|
||||
{
|
||||
// init socket parameters
|
||||
bool isBroadcast = [targetHostName isEqualToString:@"255.255.255.255"];
|
||||
bool isBroadcast = [targetHostName hasSuffix:@"255"];
|
||||
socklen_t addr_len;
|
||||
struct sockaddr_in target_addr;
|
||||
memset(&target_addr, 0, sizeof(target_addr));
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
*
|
||||
* @param timeout
|
||||
* the timeout in milliseconds or 0 for no timeout.
|
||||
* @return true whether the timeout is set suc
|
||||
*/
|
||||
- (void) setSocketTimeout: (int) timeout;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user