中文和eps的广播地址处理
This commit is contained in:
parent
ad1e90604b
commit
128c00989c
|
|
@ -16101,7 +16101,7 @@
|
||||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 10;
|
CURRENT_PROJECT_VERSION = 11;
|
||||||
DEVELOPMENT_TEAM = WFX8GD5HFX;
|
DEVELOPMENT_TEAM = WFX8GD5HFX;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
ENABLE_TESTABILITY = YES;
|
ENABLE_TESTABILITY = YES;
|
||||||
|
|
@ -16221,7 +16221,7 @@
|
||||||
CODE_SIGN_IDENTITY = "Apple Development";
|
CODE_SIGN_IDENTITY = "Apple Development";
|
||||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Apple Development";
|
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Apple Development";
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 10;
|
CURRENT_PROJECT_VERSION = 11;
|
||||||
DEVELOPMENT_TEAM = WFX8GD5HFX;
|
DEVELOPMENT_TEAM = WFX8GD5HFX;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
ENABLE_TESTABILITY = YES;
|
ENABLE_TESTABILITY = YES;
|
||||||
|
|
|
||||||
|
|
@ -150,7 +150,8 @@ static int _datagramCount = 0;
|
||||||
if (self.broadcast) {
|
if (self.broadcast) {
|
||||||
NSString *localInetAddr4 = [ESP_NetUtil getLocalIPv4];
|
NSString *localInetAddr4 = [ESP_NetUtil getLocalIPv4];
|
||||||
NSArray *arr = [localInetAddr4 componentsSeparatedByString:@"."];
|
NSArray *arr = [localInetAddr4 componentsSeparatedByString:@"."];
|
||||||
return [NSString stringWithFormat:@"%@.%@.%@.255",arr[0], arr[1], arr[2]];
|
//[NSString stringWithFormat:@"%@.%@.%@.255",arr[0], arr[1], arr[2]];
|
||||||
|
return @"255.255.255.255";
|
||||||
} else {
|
} else {
|
||||||
int count = [self __getNextDatagramCount];
|
int count = [self __getNextDatagramCount];
|
||||||
return [NSString stringWithFormat: @"234.%d.%d.%d", count, count, count];
|
return [NSString stringWithFormat: @"234.%d.%d.%d", count, count, count];
|
||||||
|
|
|
||||||
|
|
@ -77,11 +77,7 @@
|
||||||
*/
|
*/
|
||||||
- (void)connectAirKissWithSSID:(NSString *)ssidStr
|
- (void)connectAirKissWithSSID:(NSString *)ssidStr
|
||||||
password:(NSString *)password {
|
password:(NSString *)password {
|
||||||
//处理中文的情况
|
|
||||||
if([self validateContainsChinese:ssidStr])
|
|
||||||
{
|
|
||||||
ssidStr = [ssidStr stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
|
|
||||||
}
|
|
||||||
NSMutableArray *dataArray = [_airKissEncoder createAirKissEncorderWithSSID:ssidStr ? :@""
|
NSMutableArray *dataArray = [_airKissEncoder createAirKissEncorderWithSSID:ssidStr ? :@""
|
||||||
password:password ? :@""];
|
password:password ? :@""];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,12 @@
|
||||||
*/
|
*/
|
||||||
- (void)getMagicCodeWithSSID:(NSString *)ssid
|
- (void)getMagicCodeWithSSID:(NSString *)ssid
|
||||||
password:(NSString *)password {
|
password:(NSString *)password {
|
||||||
UInt8 length = ssid.length + password.length + 1;
|
|
||||||
|
NSUInteger numberOfBytes = [ssid lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
|
||||||
|
Byte bytes[numberOfBytes];
|
||||||
|
NSRange range = NSMakeRange(0, numberOfBytes);
|
||||||
|
[ssid getBytes:bytes maxLength:numberOfBytes usedLength:nil encoding:NSUTF8StringEncoding options:0 range:range remainingRange:NULL];
|
||||||
|
UInt8 length = numberOfBytes + password.length + 1;
|
||||||
UInt8 magicCode[4] = {0x00,0x00,0x00,0x00};
|
UInt8 magicCode[4] = {0x00,0x00,0x00,0x00};
|
||||||
magicCode[0] = 0x00 | (length >> 4 & 0xF);
|
magicCode[0] = 0x00 | (length >> 4 & 0xF);
|
||||||
|
|
||||||
|
|
@ -101,8 +106,8 @@
|
||||||
|
|
||||||
magicCode[1] = 0x10 | (length & 0xF);
|
magicCode[1] = 0x10 | (length & 0xF);
|
||||||
|
|
||||||
UInt8 *cipherBuffer = (UInt8*)[ssid UTF8String];
|
UInt8 *cipherBuffer = (UInt8*)bytes;
|
||||||
UInt8 crc8 = CRC8(cipherBuffer, (int)ssid.length);
|
UInt8 crc8 = CRC8(cipherBuffer, (int)numberOfBytes);
|
||||||
|
|
||||||
magicCode[2] = 0x20 | (crc8 >> 4 & 0xF);
|
magicCode[2] = 0x20 | (crc8 >> 4 & 0xF);
|
||||||
magicCode[3] = 0x30 | (crc8 & 0xF);
|
magicCode[3] = 0x30 | (crc8 & 0xF);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue