919 lines
27 KiB
Objective-C
919 lines
27 KiB
Objective-C
//
|
|
// BootomViewSoketBackMasgConreol.m
|
|
// Ifish
|
|
//
|
|
// Created by imac on 16/7/6.
|
|
// Copyright © 2016年 lianxiang. All rights reserved.
|
|
//
|
|
|
|
#import "BootomViewSoketBackMasgConreol.h"
|
|
#import "IfishDeviceInfo.h"
|
|
#import "RuSunGuiDeng.h"
|
|
@implementation BootomViewSoketBackMasgConreol
|
|
|
|
|
|
|
|
+(NSString *)getTempWithSoketData:(NSData *)data{
|
|
|
|
NSString*str=[dataContorl dataToHexString:data];
|
|
|
|
if (str.length==IFISH_BACKMASGTYAP99) {
|
|
//三控99字节温度显示 和两控四定时器 也有个返回99 字节类型设备
|
|
str=[str substringWithRange:NSMakeRange(172,IFISH_TEMPERATURE_BYTE2)];
|
|
|
|
}else if (str.length == IFISH_BACKMASGTYAP71){
|
|
|
|
//三控71字节温度显示
|
|
str=[str substringWithRange:NSMakeRange(116,IFISH_TEMPERATURE_BYTE2)];
|
|
|
|
}else if (str.length == IFISH_BACKMASGTYAP57){
|
|
|
|
//两空四定时器 返回57 字节时
|
|
str=[str substringWithRange:NSMakeRange(88,IFISH_TEMPERATURE_BYTE2)];
|
|
|
|
}else if (str.length == IFISH_BACKMASGTYAP57){
|
|
//零控
|
|
str=[str substringWithRange:NSMakeRange(30,IFISH_TEMPERATURE_BYTE2)];
|
|
|
|
}else if (str.length == IFISH_BACKMASGTYAP85){
|
|
// sikong
|
|
str=[str substringWithRange:NSMakeRange(144,IFISH_TEMPERATURE_BYTE2)];
|
|
|
|
}else if (str.length == IFISH_BACKMASGTYAP73){
|
|
//xuanduo
|
|
str=[str substringWithRange:NSMakeRange(124,IFISH_TEMPERATURE_BYTE2)];
|
|
|
|
}else if (str.length == IFISH_BACKMASGTYAP72){
|
|
//keliai
|
|
str=[str substringWithRange:NSMakeRange(120,IFISH_TEMPERATURE_BYTE2)];
|
|
|
|
}else if (str.length == IFISH_BACKMASGTYAP128){
|
|
//songnuo
|
|
str=[str substringWithRange:NSMakeRange(234,IFISH_TEMPERATURE_BYTE2)];
|
|
|
|
}
|
|
|
|
UInt64 mac=[dataContorl hexToTen:str];
|
|
NSLog(@"%llu",mac);
|
|
|
|
float TPlabel=mac/10+(mac%10)*0.1;
|
|
NSString *stringFloat = [NSString stringWithFormat:@"%.1f",TPlabel];
|
|
NSLog(@"%@",stringFloat);
|
|
return stringFloat;
|
|
|
|
}
|
|
|
|
//新加设备类型用此接口 按类型取温度 上面按照返回字节接口暂时保留
|
|
|
|
+(NSString *)getTempNewWayWithSoketData:(NSData *)data adddeviceType:(NSString *)type{
|
|
NSString*str=[dataContorl dataToHexString:data];
|
|
|
|
if ([type isEqualToString:DECICE_TYPE_THREETMP]) {
|
|
//三控温控 74 字节
|
|
str=[str substringWithRange:NSMakeRange(120,IFISH_TEMPERATURE_BYTE2)];
|
|
|
|
|
|
}else if ([type isEqualToString:DECICE_TYPE_JUNENGCC]){
|
|
//四川巨能 128 字节
|
|
|
|
}else if ([type isEqualToString:DECICE_TYPE_SONGNEWBD]){
|
|
//松诺新方案 86 字节
|
|
str=[str substringWithRange:NSMakeRange(150,IFISH_TEMPERATURE_BYTE2)];
|
|
|
|
}else if ([type isEqualToString:DECICE_TYPE_RUSUN2A]){
|
|
//睿芯 86 字节
|
|
str=[str substringWithRange:NSMakeRange(148,IFISH_TEMPERATURE_BYTE2)];
|
|
|
|
}else if ([type isEqualToString:DECICE_TYPE_RUIMEI]){
|
|
//瑞美
|
|
str=[str substringWithRange:NSMakeRange(148,IFISH_TEMPERATURE_BYTE2)];
|
|
|
|
}
|
|
|
|
UInt64 mac=[dataContorl hexToTen:str];
|
|
NSLog(@"%llu",mac);
|
|
|
|
float TPlabel=mac/10+(mac%10)*0.1;
|
|
NSString *stringFloat = [NSString stringWithFormat:@"%.1f",TPlabel];
|
|
NSLog(@"%@",stringFloat);
|
|
return stringFloat;
|
|
|
|
}
|
|
|
|
+(void)threeControlCommandSelectorWithBackModel:(BackmassegeModel *)model
|
|
atindexPath:(NSIndexPath *)indexPath{
|
|
|
|
NSInteger index= indexPath.row - 3;
|
|
manulswitchMSModel*manulModel=[[manulswitchMSModel alloc]init];
|
|
[[Socketsingleton sharedInstance] setSoketLightDataWith:manulModel];
|
|
NSString*switchString=manulModel.description;
|
|
|
|
if (index == 0) {
|
|
|
|
manulModel.lightNumber = @"01";
|
|
if([[model.light1 substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"])
|
|
{
|
|
manulModel.switchBtn = @"01";
|
|
|
|
}else{
|
|
|
|
manulModel.switchBtn = @"00";
|
|
}
|
|
|
|
}else if (index == 1){
|
|
|
|
manulModel.lightNumber = @"02";
|
|
if([[model.light2 substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"])
|
|
{
|
|
manulModel.switchBtn = @"01";
|
|
|
|
}else{
|
|
|
|
manulModel.switchBtn = @"00";
|
|
}
|
|
|
|
|
|
}else if (index == 2){
|
|
|
|
if([[model.pump substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"])
|
|
{
|
|
manulModel.switchBtn = @"01";
|
|
|
|
}else{
|
|
|
|
manulModel.switchBtn = @"00";
|
|
}
|
|
|
|
manulModel.lightNumber = @"03";
|
|
}
|
|
|
|
manulModel.crc16Str = @"0000";
|
|
NSString*switchString2=[NSString stringWithFormat:@"%@%@%@%@",switchString,manulModel.lightNumber,manulModel.switchBtn,manulModel.crc16Str];
|
|
NSData*manulData=[dataContorl stringToHexData:switchString2];
|
|
|
|
[[Socketsingleton sharedInstance] soketWriteData:manulData];
|
|
|
|
}
|
|
|
|
+(void)TwoControlCommandSelectorWithBackModel99:(BackmassegeModel *)model
|
|
atindexPath:(NSIndexPath *)indexPath
|
|
{
|
|
NSInteger index= indexPath.row - 3;
|
|
manulswitchMSModel*manulModel=[[manulswitchMSModel alloc]init];
|
|
[[Socketsingleton sharedInstance] setSoketLightDataWith:manulModel];
|
|
NSString*switchString=manulModel.description;
|
|
|
|
if (index == 0) {
|
|
|
|
manulModel.lightNumber = @"01";
|
|
if([[model.light1 substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"])
|
|
{
|
|
manulModel.switchBtn = @"01";
|
|
|
|
}else{
|
|
|
|
manulModel.switchBtn = @"00";
|
|
}
|
|
|
|
}else if (index == 1){
|
|
|
|
manulModel.lightNumber = @"02";
|
|
|
|
if([[model.pump substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"])
|
|
{
|
|
manulModel.switchBtn = @"01";
|
|
|
|
}else{
|
|
|
|
manulModel.switchBtn = @"00";
|
|
}
|
|
|
|
|
|
}
|
|
manulModel.crc16Str = @"0000";
|
|
NSString*switchString2=[NSString stringWithFormat:@"%@%@%@%@",switchString,manulModel.lightNumber,manulModel.switchBtn,manulModel.crc16Str];
|
|
NSData*manulData=[dataContorl stringToHexData:switchString2];
|
|
[[Socketsingleton sharedInstance] soketWriteData:manulData];
|
|
|
|
|
|
}
|
|
|
|
+(void)TwoControlCommandSelectorWithBackModel57:(TwoControlBackmsgmodel *)model
|
|
atindexPath:(NSIndexPath *)indexPath{
|
|
|
|
NSInteger index= indexPath.row - 3;
|
|
manulswitchMSModel*manulModel=[[manulswitchMSModel alloc]init];
|
|
[[Socketsingleton sharedInstance] setSoketLightDataWith:manulModel];
|
|
NSString*switchString=manulModel.description;
|
|
|
|
if (index == 0) {
|
|
|
|
manulModel.lightNumber = @"01";
|
|
if([[model.light substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"])
|
|
{
|
|
manulModel.switchBtn = @"01";
|
|
|
|
}else{
|
|
|
|
manulModel.switchBtn = @"00";
|
|
}
|
|
|
|
}else if (index == 1){
|
|
|
|
manulModel.lightNumber = @"02";
|
|
|
|
if([[model.pump substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"])
|
|
{
|
|
manulModel.switchBtn = @"01";
|
|
|
|
}else{
|
|
|
|
manulModel.switchBtn = @"00";
|
|
}
|
|
|
|
|
|
}
|
|
manulModel.crc16Str = @"0000";
|
|
NSString*switchString2=[NSString stringWithFormat:@"%@%@%@%@",switchString,manulModel.lightNumber,manulModel.switchBtn,manulModel.crc16Str];
|
|
NSData*manulData=[dataContorl stringToHexData:switchString2];
|
|
[[Socketsingleton sharedInstance] soketWriteData:manulData];
|
|
|
|
}
|
|
|
|
+(void)XuToControlCommandSelectorWithBackModel73:(XutoBackMsgModel *)model atindexPath:(NSIndexPath *)
|
|
indexPath{
|
|
|
|
NSInteger index= indexPath.row - 3;
|
|
manulswitchMSModel*manulModel=[[manulswitchMSModel alloc]init];
|
|
[[Socketsingleton sharedInstance] setSoketLightDataWith:manulModel];
|
|
NSString*switchString=manulModel.description;
|
|
|
|
if (index == 0) {
|
|
|
|
manulModel.lightNumber = @"01";
|
|
if([[model.gaspump substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"])
|
|
{
|
|
manulModel.switchBtn = @"01";
|
|
|
|
}else{
|
|
|
|
manulModel.switchBtn = @"00";
|
|
}
|
|
|
|
}else if (index == 1){
|
|
|
|
manulModel.lightNumber = @"02";
|
|
|
|
if([[model.light1 substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"])
|
|
{
|
|
manulModel.switchBtn = @"01";
|
|
|
|
}else{
|
|
|
|
manulModel.switchBtn = @"00";
|
|
}
|
|
|
|
|
|
}else if (index == 2){
|
|
|
|
manulModel.lightNumber = @"03";
|
|
|
|
if([[model.light2 substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"])
|
|
{
|
|
manulModel.switchBtn = @"01";
|
|
|
|
}else{
|
|
|
|
manulModel.switchBtn = @"00";
|
|
}
|
|
|
|
|
|
}else if (index == 3){
|
|
|
|
manulModel.lightNumber = @"04";
|
|
|
|
if([[model.hulilight substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"])
|
|
{
|
|
manulModel.switchBtn = @"01";
|
|
|
|
}else{
|
|
|
|
manulModel.switchBtn = @"00";
|
|
}
|
|
|
|
|
|
}else if (index == 4){
|
|
//水泵加热绷 设置代理 在p2p 视频界面实现
|
|
// manulModel.lightNumber = @"05";
|
|
//
|
|
// if([[model.waterpump substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"])
|
|
// {
|
|
// manulModel.switchBtn = @"01";
|
|
//
|
|
// }else{
|
|
//
|
|
// manulModel.switchBtn = @"00";
|
|
// }
|
|
|
|
|
|
}else if (index == 5){
|
|
|
|
// manulModel.lightNumber = @"06";
|
|
// //只显示不可操控
|
|
// if([[model.heatStickState substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"])
|
|
// {
|
|
// manulModel.switchBtn = @"01";
|
|
//
|
|
// }else{
|
|
//
|
|
// manulModel.switchBtn = @"00";
|
|
// }
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
manulModel.crc16Str = @"0000";
|
|
NSString*switchString2=[NSString stringWithFormat:@"%@%@%@%@",switchString,manulModel.lightNumber,manulModel.switchBtn,manulModel.crc16Str];
|
|
NSData*manulData=[dataContorl stringToHexData:switchString2];
|
|
[[Socketsingleton sharedInstance] soketWriteData:manulData];
|
|
|
|
|
|
|
|
}
|
|
+(void)FourControlCommandSelectorWithBackModel85:(FourControlbackMassge *)model atindexPath:(NSIndexPath *)indexPath{
|
|
|
|
NSInteger index= indexPath.row - 3;
|
|
manulswitchMSModel*manulModel=[[manulswitchMSModel alloc]init];
|
|
[[Socketsingleton sharedInstance] setSoketLightDataWith:manulModel];
|
|
NSString*switchString=manulModel.description;
|
|
|
|
if (index == 0) {
|
|
|
|
manulModel.lightNumber = @"01";
|
|
if([[model.light1 substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"])
|
|
{
|
|
manulModel.switchBtn = @"01";
|
|
|
|
}else{
|
|
|
|
manulModel.switchBtn = @"00";
|
|
}
|
|
|
|
}else if (index == 1){
|
|
|
|
manulModel.lightNumber = @"02";
|
|
if([[model.light2 substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"])
|
|
{
|
|
manulModel.switchBtn = @"01";
|
|
|
|
}else{
|
|
|
|
manulModel.switchBtn = @"00";
|
|
}
|
|
|
|
|
|
}else if (index == 2){
|
|
|
|
|
|
if([[model.light3 substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"])
|
|
{
|
|
manulModel.switchBtn = @"01";
|
|
|
|
}else{
|
|
|
|
manulModel.switchBtn = @"00";
|
|
}
|
|
|
|
manulModel.lightNumber = @"03";
|
|
|
|
}else if (index == 3){
|
|
|
|
if([[model.pump substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"])
|
|
{
|
|
manulModel.switchBtn = @"01";
|
|
|
|
}else{
|
|
|
|
manulModel.switchBtn = @"00";
|
|
}
|
|
|
|
manulModel.lightNumber = @"04";
|
|
|
|
}
|
|
|
|
manulModel.crc16Str = @"0000";
|
|
NSString*switchString2=[NSString stringWithFormat:@"%@%@%@%@",switchString,manulModel.lightNumber,manulModel.switchBtn,manulModel.crc16Str];
|
|
NSData*manulData=[dataContorl stringToHexData:switchString2];
|
|
|
|
[[Socketsingleton sharedInstance] soketWriteData:manulData];
|
|
|
|
}
|
|
|
|
|
|
+(void)SongNuoControlCommandSelectorWithBackModel128:(SongNuoBackMassage*)model atindexPath:(NSIndexPath *)indexPath{
|
|
|
|
NSInteger index= indexPath.row - 3;
|
|
manulswitchMSModel*manulModel=[[manulswitchMSModel alloc]init];
|
|
[[Socketsingleton sharedInstance] setSoketLightDataWith:manulModel];
|
|
NSString*switchString=manulModel.description;
|
|
|
|
if (index == 0) {
|
|
|
|
manulModel.lightNumber = @"01";
|
|
if([[model.light1btn substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"])
|
|
{
|
|
manulModel.switchBtn = @"01";
|
|
|
|
}else{
|
|
|
|
manulModel.switchBtn = @"00";
|
|
}
|
|
|
|
}else if (index == 1){
|
|
|
|
manulModel.lightNumber = @"02";
|
|
if([[model.light2btn substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"])
|
|
{
|
|
manulModel.switchBtn = @"01";
|
|
|
|
}else{
|
|
|
|
manulModel.switchBtn = @"00";
|
|
}
|
|
|
|
|
|
}else if (index == 2){
|
|
|
|
|
|
if([[model.waterPumpBtn substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"])
|
|
{
|
|
manulModel.switchBtn = @"01";
|
|
|
|
}else{
|
|
|
|
manulModel.switchBtn = @"00";
|
|
}
|
|
|
|
manulModel.lightNumber = @"03";
|
|
|
|
}else if (index == 3){
|
|
|
|
if([[model.gasPumpBtn substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"])
|
|
{
|
|
manulModel.switchBtn = @"01";
|
|
|
|
}else{
|
|
|
|
manulModel.switchBtn = @"00";
|
|
}
|
|
|
|
manulModel.lightNumber = @"04";
|
|
|
|
}else if (index == 4){
|
|
|
|
if([[model.uvPumpBtn substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"])
|
|
{
|
|
manulModel.switchBtn = @"01";
|
|
|
|
}else{
|
|
|
|
manulModel.switchBtn = @"00";
|
|
}
|
|
|
|
manulModel.lightNumber = @"05";
|
|
|
|
}else if (index == 5){
|
|
|
|
if([[model.waveBtn substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"])
|
|
{
|
|
manulModel.switchBtn = @"01";
|
|
|
|
}else{
|
|
|
|
manulModel.switchBtn = @"00";
|
|
}
|
|
|
|
manulModel.lightNumber = @"06";
|
|
|
|
}else if (index == 6){
|
|
//备用 暂时不做处理
|
|
|
|
if([[model.beiyongBtn substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"])
|
|
{
|
|
manulModel.switchBtn = @"01";
|
|
|
|
}else{
|
|
|
|
manulModel.switchBtn = @"00";
|
|
}
|
|
|
|
manulModel.lightNumber = @"07";
|
|
|
|
}else if (index == 7){
|
|
//加热棒
|
|
// if([[model.jiaReBtn substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"])
|
|
// {
|
|
// manulModel.switchBtn = @"01";
|
|
//
|
|
// }else{
|
|
//
|
|
// manulModel.switchBtn = @"00";
|
|
// }
|
|
//
|
|
// manulModel.lightNumber = @"08";
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
manulModel.crc16Str = @"0000";
|
|
NSString*switchString2=[NSString stringWithFormat:@"%@%@%@%@",switchString,manulModel.lightNumber,manulModel.switchBtn,manulModel.crc16Str];
|
|
NSData*manulData=[dataContorl stringToHexData:switchString2];
|
|
|
|
[[Socketsingleton sharedInstance] soketWriteData:manulData];
|
|
|
|
|
|
|
|
}
|
|
|
|
+(void)KeLiAiCommandSelectorWithBackModel72:(KeLiAiBackMassage *)model atindexPath:(NSIndexPath *)indexPath
|
|
{
|
|
|
|
NSInteger index= indexPath.row - 3;
|
|
manulswitchMSModel*manulModel=[[manulswitchMSModel alloc]init];
|
|
[[Socketsingleton sharedInstance] setSoketLightDataWith:manulModel];
|
|
NSString*switchString=manulModel.description;
|
|
|
|
if (index == 0) {
|
|
|
|
manulModel.lightNumber = @"01";
|
|
if([[model.light1btn substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"])
|
|
{
|
|
manulModel.switchBtn = @"01";
|
|
|
|
}else{
|
|
|
|
manulModel.switchBtn = @"00";
|
|
}
|
|
|
|
}else if (index == 1){
|
|
|
|
manulModel.lightNumber = @"02";
|
|
if([[model.light2btn substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"])
|
|
{
|
|
manulModel.switchBtn = @"01";
|
|
|
|
}else{
|
|
|
|
manulModel.switchBtn = @"00";
|
|
}
|
|
|
|
}else if (index == 2){
|
|
|
|
|
|
if([[model.ultravioletRay substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"])
|
|
{
|
|
manulModel.switchBtn = @"01";
|
|
|
|
}else{
|
|
|
|
manulModel.switchBtn = @"00";
|
|
}
|
|
|
|
manulModel.lightNumber = @"03";
|
|
|
|
}else if (index == 3){
|
|
|
|
if([[model.pumpBtn substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"])
|
|
{
|
|
manulModel.switchBtn = @"01";
|
|
|
|
}else{
|
|
|
|
manulModel.switchBtn = @"00";
|
|
}
|
|
|
|
manulModel.lightNumber = @"04";
|
|
|
|
}else if (index == 4){
|
|
//加热棒
|
|
return;
|
|
}
|
|
|
|
manulModel.crc16Str = @"0000";
|
|
NSString*switchString2=[NSString stringWithFormat:@"%@%@%@%@",switchString,manulModel.lightNumber,manulModel.switchBtn,manulModel.crc16Str];
|
|
NSData*manulData=[dataContorl stringToHexData:switchString2];
|
|
[[Socketsingleton sharedInstance] soketWriteData:manulData];
|
|
}
|
|
|
|
+(void)RusunCommandSelectorWithBackMode148:(RuSunProtocol *)model atindexPath:(NSIndexPath *)indexPath
|
|
{
|
|
NSInteger index= indexPath.row - 3;
|
|
manulswitchMSModel*manulModel=[[manulswitchMSModel alloc]init];
|
|
[[Socketsingleton sharedInstance] setSoketLightDataWith:manulModel];
|
|
NSString*switchString=manulModel.description;
|
|
|
|
if (index == 0) {
|
|
|
|
manulModel.lightNumber = @"01";
|
|
if([[model.light1btn substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"])
|
|
{
|
|
manulModel.switchBtn = @"01";
|
|
|
|
}else{
|
|
|
|
manulModel.switchBtn = @"00";
|
|
}
|
|
|
|
}else if (index == 1){
|
|
|
|
manulModel.lightNumber = @"02";
|
|
if([[model.light2btn substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"])
|
|
{
|
|
manulModel.switchBtn = @"01";
|
|
|
|
}else{
|
|
|
|
manulModel.switchBtn = @"00";
|
|
}
|
|
|
|
|
|
}else if (index == 2){
|
|
|
|
|
|
if([[model.waterPumpBtn substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"])
|
|
{
|
|
manulModel.switchBtn = @"01";
|
|
|
|
}else{
|
|
|
|
manulModel.switchBtn = @"00";
|
|
}
|
|
|
|
manulModel.lightNumber = @"03";
|
|
|
|
}else if (index == 4){
|
|
//加热棒
|
|
return;
|
|
|
|
}
|
|
|
|
manulModel.crc16Str = @"0000";
|
|
NSString*switchString2=[NSString stringWithFormat:@"%@%@%@%@",switchString,manulModel.lightNumber,manulModel.switchBtn,manulModel.crc16Str];
|
|
NSData*manulData=[dataContorl stringToHexData:switchString2];
|
|
|
|
[[Socketsingleton sharedInstance] soketWriteData:manulData];
|
|
|
|
}
|
|
|
|
+(void)RusunCommandSelectorWithBackMode168:(RunSun84Protocol *)model atindexPath:(NSIndexPath *)indexPath
|
|
{
|
|
|
|
NSInteger index= indexPath.row - 3;
|
|
manulswitchMSModel*manulModel=[[manulswitchMSModel alloc]init];
|
|
[[Socketsingleton sharedInstance] setSoketLightDataWith:manulModel];
|
|
NSString*switchString=manulModel.description;
|
|
|
|
if (index == 0) {
|
|
|
|
manulModel.lightNumber = @"01";
|
|
if([[model.ch1 substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"])
|
|
{
|
|
manulModel.switchBtn = @"01";
|
|
|
|
}else{
|
|
|
|
manulModel.switchBtn = @"00";
|
|
}
|
|
|
|
}else if (index == 1){
|
|
|
|
manulModel.lightNumber = @"02";
|
|
if([[model.ch2 substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"])
|
|
{
|
|
manulModel.switchBtn = @"01";
|
|
|
|
}else{
|
|
|
|
manulModel.switchBtn = @"00";
|
|
}
|
|
|
|
|
|
}else if (index == 2){
|
|
|
|
|
|
manulModel.lightNumber = @"03";
|
|
if([[model.ch3 substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"])
|
|
{
|
|
manulModel.switchBtn = @"01";
|
|
|
|
}else{
|
|
|
|
manulModel.switchBtn = @"00";
|
|
}
|
|
|
|
|
|
}else if (index == 3){
|
|
|
|
|
|
manulModel.lightNumber = @"04";
|
|
if([[model.ch4 substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"])
|
|
{
|
|
manulModel.switchBtn = @"01";
|
|
|
|
}else{
|
|
|
|
manulModel.switchBtn = @"00";
|
|
}
|
|
|
|
|
|
}else if (index == 4){
|
|
//柜灯
|
|
RuSunGuiDeng*guidengModel=[[RuSunGuiDeng alloc]init];
|
|
guidengModel.resavemacId = [Socketsingleton sharedInstance].macAddress;
|
|
guidengModel.sendmacId = [Socketsingleton sharedInstance].macAddress;
|
|
guidengModel.crc16Str=@"0000";
|
|
if([[model.guiDengState substringWithRange:NSMakeRange(0, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"])
|
|
{
|
|
guidengModel.onOff= @"01";
|
|
|
|
}else{
|
|
|
|
guidengModel.onOff= @"00";
|
|
}
|
|
|
|
NSString* guidengOrder=[NSString stringWithFormat:@"%@%@%@",guidengModel.description,guidengModel.onOff,guidengModel.crc16Str];
|
|
NSData*guidengData=[dataContorl stringToHexData:guidengOrder];
|
|
[[Socketsingleton sharedInstance] soketWriteData:guidengData];
|
|
|
|
return;
|
|
|
|
}else if (index == 5){
|
|
//加热棒
|
|
return;
|
|
|
|
}
|
|
|
|
manulModel.crc16Str = @"0000";
|
|
NSString*switchString2=[NSString stringWithFormat:@"%@%@%@%@",switchString,manulModel.lightNumber,manulModel.switchBtn,manulModel.crc16Str];
|
|
NSData*manulData=[dataContorl stringToHexData:switchString2];
|
|
|
|
[[Socketsingleton sharedInstance] soketWriteData:manulData];
|
|
|
|
}
|
|
|
|
+(void)RuiMeiCommandSelectorWithBackMode168:(RuiMeiProtocolModel *)model atindexPath:(NSIndexPath *)indexPath
|
|
{
|
|
|
|
NSInteger index= indexPath.row - 3;
|
|
manulswitchMSModel*manulModel=[[manulswitchMSModel alloc]init];
|
|
[[Socketsingleton sharedInstance] setSoketLightDataWith:manulModel];
|
|
NSString*switchString=manulModel.description;
|
|
|
|
if (index == 0) {
|
|
|
|
manulModel.lightNumber = @"01";
|
|
if([[model.ch1 substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"])
|
|
{
|
|
manulModel.switchBtn = @"01";
|
|
|
|
}else{
|
|
|
|
manulModel.switchBtn = @"00";
|
|
}
|
|
|
|
}else if (index == 1){
|
|
|
|
manulModel.lightNumber = @"02";
|
|
if([[model.ch2 substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"])
|
|
{
|
|
manulModel.switchBtn = @"01";
|
|
|
|
}else{
|
|
|
|
manulModel.switchBtn = @"00";
|
|
}
|
|
|
|
|
|
}else if (index == 2){
|
|
|
|
|
|
manulModel.lightNumber = @"03";
|
|
if([[model.ch3 substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"])
|
|
{
|
|
manulModel.switchBtn = @"01";
|
|
|
|
}else{
|
|
|
|
manulModel.switchBtn = @"00";
|
|
}
|
|
|
|
|
|
}else if (index == 3){
|
|
|
|
|
|
manulModel.lightNumber = @"04";
|
|
if([[model.ch4 substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"])
|
|
{
|
|
manulModel.switchBtn = @"01";
|
|
|
|
}else{
|
|
|
|
manulModel.switchBtn = @"00";
|
|
}
|
|
|
|
|
|
}else if (index == 4){
|
|
//加热棒
|
|
return;
|
|
|
|
}
|
|
|
|
manulModel.crc16Str = @"0000";
|
|
NSString*switchString2=[NSString stringWithFormat:@"%@%@%@%@",switchString,manulModel.lightNumber,manulModel.switchBtn,manulModel.crc16Str];
|
|
NSData*manulData=[dataContorl stringToHexData:switchString2];
|
|
|
|
[[Socketsingleton sharedInstance] soketWriteData:manulData];
|
|
|
|
}
|
|
|
|
+(void)SongnuoBDCommandSelectorWithBackMode86:(SongNuoBDProtocol *)model atindexPath:(NSIndexPath *)indexPath
|
|
{
|
|
NSInteger index= indexPath.row - 3;
|
|
manulswitchMSModel*manulModel=[[manulswitchMSModel alloc]init];
|
|
[[Socketsingleton sharedInstance] setSoketLightDataWith:manulModel];
|
|
NSString*switchString=manulModel.description;
|
|
|
|
if (index == 0) {
|
|
|
|
manulModel.lightNumber = @"01";
|
|
if([[model.light1btn substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"])
|
|
{
|
|
manulModel.switchBtn = @"01";
|
|
|
|
}else{
|
|
|
|
manulModel.switchBtn = @"00";
|
|
}
|
|
|
|
}else if (index == 1){
|
|
|
|
manulModel.lightNumber = @"02";
|
|
if([[model.light2btn substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"])
|
|
{
|
|
manulModel.switchBtn = @"01";
|
|
|
|
}else{
|
|
|
|
manulModel.switchBtn = @"00";
|
|
}
|
|
|
|
|
|
}else if (index == 2){
|
|
|
|
|
|
if([[model.waterPumpBtn substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"])
|
|
{
|
|
manulModel.switchBtn = @"01";
|
|
|
|
}else{
|
|
|
|
manulModel.switchBtn = @"00";
|
|
}
|
|
|
|
manulModel.lightNumber = @"03";
|
|
|
|
}else if (index == 3){
|
|
|
|
if([[model.gasPumpBtn substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"])
|
|
{
|
|
manulModel.switchBtn = @"01";
|
|
|
|
}else{
|
|
|
|
manulModel.switchBtn = @"00";
|
|
}
|
|
|
|
manulModel.lightNumber = @"04";
|
|
|
|
}
|
|
else if (index == 4){
|
|
//加热棒
|
|
return;
|
|
}
|
|
|
|
manulModel.crc16Str = @"0000";
|
|
NSString*switchString2=[NSString stringWithFormat:@"%@%@%@%@",switchString,manulModel.lightNumber,manulModel.switchBtn,manulModel.crc16Str];
|
|
NSData*manulData=[dataContorl stringToHexData:switchString2];
|
|
[[Socketsingleton sharedInstance] soketWriteData:manulData];
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|