69 lines
2.2 KiB
Objective-C
69 lines
2.2 KiB
Objective-C
//
|
|
// baseModel.m
|
|
// Ifish
|
|
//
|
|
// Created by imac on 15/10/12.
|
|
// Copyright © 2015年 imac. All rights reserved.
|
|
//
|
|
|
|
#import "baseModel.h"
|
|
|
|
extern NSIndexPath*selectIndexPath;
|
|
|
|
extern BOOL collectionViewselect;
|
|
|
|
@implementation baseModel
|
|
-(instancetype)init{
|
|
self=[super init];
|
|
if (self) {
|
|
// NSArray*deviceArry=[[DataCenter defaultDtacenter]valueForKey:@"deviceInfo"];
|
|
// if ([deviceArry count]!=0) {
|
|
// if (collectionViewselect==YES) {//防删除选中状态下奔溃 还用于切换设备
|
|
// DeviceModel*devicemodel=[deviceArry objectAtIndex:selectIndexPath.row];
|
|
// self.sendmacId=devicemodel.macAddress;
|
|
// self.resavemacId=devicemodel.macAddress;
|
|
// }else{// 下拉菜单没有点击选中状态时
|
|
//
|
|
// /**
|
|
// *app 启动程序进入默认选中 退出程序所选中设备
|
|
// */
|
|
// DeviceModel*devicemodel=[[DeviceModel alloc]init];
|
|
// NSUserDefaults*userdefult=[NSUserDefaults standardUserDefaults];
|
|
//
|
|
// NSInteger indexPath=[userdefult integerForKey:@"lastIndex"];
|
|
//
|
|
// if (!indexPath) {
|
|
// devicemodel=[deviceArry objectAtIndex:0];//第一次启动 而且没有选中状态 默认选择第一个
|
|
//
|
|
// }else{//启动过app 并且之前有选中绑定设备 再次启动默认显示之前所选中设备
|
|
// devicemodel=[deviceArry objectAtIndex:indexPath];
|
|
// }
|
|
// self.sendmacId=devicemodel.macAddress;
|
|
// self.resavemacId=devicemodel.macAddress;
|
|
// }
|
|
// }
|
|
//
|
|
//
|
|
//
|
|
//
|
|
|
|
}
|
|
|
|
self.massagelegth=@"0f";//包长
|
|
return self;
|
|
|
|
}
|
|
- (NSString *)description
|
|
{
|
|
|
|
self.messagetype=@"00";
|
|
return [NSString stringWithFormat:@"%@%@%@%@%@",self.messagetype,self.functionCode, self.sendmacId,self.resavemacId,self.massagelegth];
|
|
|
|
}
|
|
//-(void)setmacIdWith:(DeviceModel *)devicemodel{
|
|
//
|
|
// self.sendmacId=devicemodel.macAddress;
|
|
// self.resavemacId=devicemodel.macAddress;
|
|
//}
|
|
@end
|