epptouch sdk更新,闪退修改强化

This commit is contained in:
kai
2021-06-26 22:37:40 +08:00
parent 0ab7d833a0
commit 6d1d973610
19 changed files with 268 additions and 203 deletions
BIN
View File
Binary file not shown.
+1 -1
View File
@@ -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;
+31
View File
@@ -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.");
+2 -3
View File
@@ -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)
+1 -1
View File
@@ -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;
+4 -1
View File
@@ -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];
+6 -6
View File
@@ -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
+1 -1
View File
@@ -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));
+1
View File
@@ -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;
@@ -317,6 +317,10 @@ Copy NSString *deviceId;
- (void)udpHelperMessage:(NSString *)msg {
if (!self.timer)
{
return;
}
self.HUD = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
self.HUD.mode = MBProgressHUDModeIndeterminate;
self.HUD.labelText = msg;
@@ -324,6 +328,7 @@ Copy NSString *deviceId;
{
[self.HUD hide:YES afterDelay:3];
[self endProgress];
[self.progressView endProgressWithString:@"连接失败"];
}
}
-(void)endProgress{
@@ -40,7 +40,7 @@
xuanduoModel.waterLevel=[dataString substringWithRange:NSMakeRange(84, 2)];
}
}
else if ([type isEqualToString:DECICE_TYPE_XUANDUO3F]&&[model isKindOfClass:[Xuanduo3fModel class]])
else if ([type isEqualToString:DECICE_TYPE_XUANDUO3F]&&[model isKindOfClass:[Xuanduo3fModel class]]&&dataString.length>67)
{
Xuanduo3fModel*xuanduoModel=model;
@@ -1038,7 +1038,7 @@
#pragma mark -设置页面 -
- (void)setting {
if (self.dataModel.gasPump) {
if (self.dataModel.gasPump.length) {
Xuanduo2SettingController *_settingVC = [[Xuanduo2SettingController alloc] init];
_settingVC.currentdevice = self.currentDevice;
_settingVC.dataModel = self.dataModel;
@@ -25,7 +25,7 @@
// CFShow((__bridge CFTypeRef)(infoDic));
NSString *app_Version=[infoDic objectForKey:@"CFBundleShortVersionString"];
NSLog(@"app_Version%@",app_Version);
app_Version=@"4.7.13";
app_Version=@"4.7.14";
NSString *versionStr = [NSString stringWithFormat:@"v%@",app_Version];
NSString *buildVersion = [infoDic objectForKey:@"CFBundleVersion"];
if (buildVersion.length > 0) {
+9 -1
View File
@@ -99,7 +99,10 @@
}
-(void)showStoreName:(UIButton*)button
{
if (self.titles.count)
{
self.tableView.frame = CGRectMake(0, 0, self.frame.size.width-40, self.titles.count>2?2*44:self.titles.count*44);
DXPopover *popover = [DXPopover new];
self.tableView.layer.masksToBounds=YES;
@@ -111,6 +114,11 @@
[popover showAtPoint:CGPointMake(self.oldStoreNameField.center.x, self.oldStoreNameField.center.y+15) popoverPostion:DXPopoverPositionDown withContentView:self.tableView inView:self];
}
else
{
[self makeToast:@"不存在其他宠物店"];
}
}