中文和eps的广播地址处理
This commit is contained in:
@@ -77,11 +77,7 @@
|
||||
*/
|
||||
- (void)connectAirKissWithSSID:(NSString *)ssidStr
|
||||
password:(NSString *)password {
|
||||
//处理中文的情况
|
||||
if([self validateContainsChinese:ssidStr])
|
||||
{
|
||||
ssidStr = [ssidStr stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
|
||||
}
|
||||
|
||||
NSMutableArray *dataArray = [_airKissEncoder createAirKissEncorderWithSSID:ssidStr ? :@""
|
||||
password:password ? :@""];
|
||||
|
||||
|
||||
@@ -91,7 +91,12 @@
|
||||
*/
|
||||
- (void)getMagicCodeWithSSID:(NSString *)ssid
|
||||
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};
|
||||
magicCode[0] = 0x00 | (length >> 4 & 0xF);
|
||||
|
||||
@@ -101,8 +106,8 @@
|
||||
|
||||
magicCode[1] = 0x10 | (length & 0xF);
|
||||
|
||||
UInt8 *cipherBuffer = (UInt8*)[ssid UTF8String];
|
||||
UInt8 crc8 = CRC8(cipherBuffer, (int)ssid.length);
|
||||
UInt8 *cipherBuffer = (UInt8*)bytes;
|
||||
UInt8 crc8 = CRC8(cipherBuffer, (int)numberOfBytes);
|
||||
|
||||
magicCode[2] = 0x20 | (crc8 >> 4 & 0xF);
|
||||
magicCode[3] = 0x30 | (crc8 & 0xF);
|
||||
|
||||
Reference in New Issue
Block a user