51 lines
1.3 KiB
Objective-C
51 lines
1.3 KiB
Objective-C
//
|
|
// ConnectHotspotModel.m
|
|
// Ifish
|
|
//
|
|
// Created by Minghao Xue on 2018/8/6.
|
|
// Copyright © 2018年 lianlian. All rights reserved.
|
|
//
|
|
|
|
#import "ConnectHotspotModel.h"
|
|
|
|
@implementation ConnectHotspotModel
|
|
|
|
- (NSString *)description{
|
|
|
|
self.messagetype=@"00";
|
|
self.massagelegth=@"39";
|
|
self.functionCode=@"12";
|
|
self.sendmacId = @"000000000000";
|
|
self.resavemacId = @"000000000000";
|
|
|
|
return [NSString stringWithFormat:@"%@%@%@%@%@%@%@%@", self.messagetype,self.functionCode,self.sendmacId,self.resavemacId,self.massagelegth,[self zeroLeftPadding:[dataContorl hexStringFromString:self.ssidName]], [self zeroLeftPadding:[dataContorl hexStringFromString:self.pwd]],[self crcCode]];
|
|
}
|
|
|
|
- (NSString *)ssidName {
|
|
return [NSString stringWithFormat:@"%@\0", _ssidName];
|
|
}
|
|
|
|
- (NSString *)pwd {
|
|
return [NSString stringWithFormat:@"%@\0", _pwd];
|
|
}
|
|
|
|
- (NSString *)zeroLeftPadding:(NSString *)origin {
|
|
if (origin.length >= 40) {
|
|
return [origin substringToIndex:40];
|
|
} else {
|
|
NSInteger left = 40 - origin.length;
|
|
NSMutableString *str = [NSMutableString string];
|
|
[str appendString:origin];
|
|
for (NSInteger index = 0; index < left; index++) {
|
|
[str appendString:@"0"];
|
|
}
|
|
return [str copy];
|
|
}
|
|
}
|
|
|
|
- (NSString *)crcCode {
|
|
return @"0000";
|
|
}
|
|
|
|
@end
|