features:4月新绚多设备适配 & 修复一些已知bug

This commit is contained in:
一只会编程的狮子
2019-05-15 20:24:53 +08:00
parent 4b74588759
commit c586949438
59 changed files with 2912 additions and 130 deletions
@@ -67,6 +67,7 @@
#import "HaveHotCoolWenDuPicview.h"
#import "RuSunLightOrder.h"
#import "RuiMeiSetViewController.h"
#import "Xuanduo2SettingController.h"
//上部分视频封装 下部分分段控制器 封装 (下一步代码优化)
@interface IfishP2PMonitorController ()<HaveHotCoolWenDuPicviewDelegate>
@@ -87,7 +88,7 @@
BOOL _isStop;//是否暂停 用于区分是 暂停按钮 还是 连接失败按钮
dispatch_queue_t _xutoMainQueue;
BOOL _isPushNextView; //是否push下级界面
BOOL _isNewXuanduo; //是新绚多设备
}
@property(nonatomic,strong) SetTimeController*SetTimeVC;
@@ -113,6 +114,8 @@
@property (nonatomic,strong) UILabel *nameTitle;
@property (strong, nonatomic) UIView *shutterView;
@property(nonatomic,strong) HaveHotCoolWenDuPicview *xuanduoPicView;
@end
extern BOOL formLogIn;//连接页面是否来自登录界面
@@ -4316,6 +4319,16 @@
[self.navigationController pushViewController:connectVC animated:YES];
}
-(void)didselectXuanduo2SetttngWithData:(DeviceModel *)dmodel
andBackModel:(Xuanduo2Model *)backmodel {
Xuanduo2SettingController *setVC = [[Xuanduo2SettingController alloc] init];
setVC.currentdevice = dmodel;
setVC.dataModel = backmodel;
usleep(50*1000);
[self.navigationController pushViewController:setVC animated:YES];
}
//炫多
-(void)selectXuToAtIndex:(NSIndexPath*)index withbackModel:(XutoBackMsgModel *)backmodel{
@@ -4625,6 +4638,108 @@
}
-(void)selectXuanduo2Index:(NSIndexPath *)index withBackModel:(Xuanduo2Model *)backModel{
if (backModel) {
if (index.row == 3) {
//循环泵
manulswitchMSModel*manulModel=[[manulswitchMSModel alloc]init];
[[Socketsingleton sharedInstance] setSoketLightDataWith:manulModel];
NSString*switchString=manulModel.description;
manulModel.lightNumber = @"04";
if([[backModel.waterPump substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"])
{
manulModel.switchBtn = @"01";
}else{
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"提示" message:@"确认关闭循环泵?" preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:nil];
UIAlertAction *sureAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
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];
}];
[alertController addAction:cancelAction];
[alertController addAction:sureAction];
[self.navigationController presentViewController:alertController animated:YES completion:nil];
return;
}
manulModel.crc16Str = @"0000";
NSString*switchString2=[NSString stringWithFormat:@"%@%@%@%@",switchString,manulModel.lightNumber,manulModel.switchBtn,manulModel.crc16Str];
NSData*manulData=[dataContorl stringToHexData:switchString2];
[[Socketsingleton sharedInstance] soketWriteData:manulData];
}else {
_xuanduoPicView=[[HaveHotCoolWenDuPicview alloc] init];
_xuanduoPicView.frame=CGRectMake(0, 0, kScreenSize.width, kScreenSize.height);
[_xuanduoPicView.sureBtn addTarget:self action:@selector(xuanduoSureBtnClick:) forControlEvents:UIControlEventTouchUpInside];
_isNewXuanduo = YES;
[self.view.window addSubview:_xuanduoPicView];
_xuanduoPicView.wenDuPicviewDelegate = self;
NSString *stateStr =nil;
if ([backModel.status isKindOfClass:[NSNull class]]||!backModel.status ) {
backModel.status = @"0000";
}
stateStr = [backModel.status substringWithRange:NSMakeRange(2, 2)];
[_xuanduoPicView initCateBtnSate:stateStr];
[self heatAction:backModel];
}
}
}
- (void)heatAction:(Xuanduo2Model*)model
{
UInt64 mac=[dataContorl hexToTen:model.heatingTemperature];
NSLog(@"%llu",mac);
float TPlabel=mac/10;
int temp= (int)(TPlabel+0.5);
NSString *stringFloat = [NSString stringWithFormat:@"%d",temp];
NSLog(@"%@",stringFloat);
NSArray*wenDuArr=[_xuanduoPicView.picArr objectAtIndex:0];
for (NSInteger i=0; i<wenDuArr.count; i++) {
NSString*picString=wenDuArr[i];
if ([picString isEqualToString:stringFloat ] ) {
[_xuanduoPicView.pic selectRow:i inComponent:0 animated:NO];
}
}
}
- (void)xuanduoSureBtnClick:(UIButton *)btn {
NSLog(@"%@******** _wenduPicview.picViewResultString",_wenduPicview.picViewResultString);
if (_xuanduoPicView.picViewResultString ==nil) {
[_xuanduoPicView removeFromSuperview];
}else{
JiaReWenDuModel *model=[[JiaReWenDuModel alloc] init];
model.resavemacId = [Socketsingleton sharedInstance].macAddress;
model.sendmacId =[Socketsingleton sharedInstance].macAddress;
int intlowString = [_xuanduoPicView.picViewResultString intValue];
int newIntlowString=intlowString*10;
NSLog(@"%d******** newIntlowString",newIntlowString);
// 转四位16进制
model.JiaReWenDu=[dataContorl tpIntStringToFourHex:newIntlowString];
model.crc16Code =@"0000";
NSString * hexstring=[NSString stringWithFormat:@"%@%@%@",model.description,model.JiaReWenDu,model.crc16Code];
NSData*data=[dataContorl stringToHexData:hexstring];
[ [Socketsingleton sharedInstance] soketWriteData:data];
}
[_xuanduoPicView removeFromSuperview];
_isNewXuanduo = NO;
}
-(void)songNuoBDMianQueue
{
@@ -4680,7 +4795,11 @@
NSString*switchString1=lightOrder.description;
lightOrder.switchBtn = hotCool;
lightOrder.crc16Str=@"0000";
lightOrder.lightNumber=@"05";
if (_isNewXuanduo) {
lightOrder.lightNumber=@"07";
}else{
lightOrder.lightNumber=@"05";
}
NSString*switchString2=[NSString stringWithFormat:@"%@%@%@%@",switchString1,lightOrder.lightNumber,lightOrder.switchBtn,lightOrder.crc16Str];
NSData*manulData=[dataContorl stringToHexData:switchString2];
@@ -19,8 +19,12 @@
#import "SongNuoBDProtocol.h"
#import "RunSun84Protocol.h"
#import "RuiMeiProtocolModel.h"
#import "Xuanduo2Model.h"
@interface BootomViewSoketBackMasgConreol : NSObject<UIAlertViewDelegate>
@property (nonatomic,strong) Xuanduo2Model *dataModel;
@interface BootomViewSoketBackMasgConreol : NSObject
//获取温度
+(NSString*)getTempWithSoketData:(NSData *)data;
+(NSString *)getTempNewWayWithSoketData:(NSData *)data adddeviceType:(NSString *)type;
@@ -42,6 +46,11 @@ indexPath;
+(void)XuToControlCommandSelectorWithBackModel73:(XutoBackMsgModel *)model atindexPath:(NSIndexPath *)
indexPath;
// 新绚多
+(void)XuTo2ControlCommandSelectorWithBackModel73:(Xuanduo2Model *)model atindexPath:(NSIndexPath *)
indexPath;
+(void)FourControlCommandSelectorWithBackModel85:(FourControlbackMassge *)model atindexPath:(NSIndexPath *)indexPath;
@@ -9,6 +9,7 @@
#import "BootomViewSoketBackMasgConreol.h"
#import "IfishDeviceInfo.h"
#import "RuSunGuiDeng.h"
#import "XuanduoHuliModel.h"
@implementation BootomViewSoketBackMasgConreol
@@ -88,6 +89,8 @@
//
str=[str substringWithRange:NSMakeRange(148,IFISH_TEMPERATURE_BYTE2)];
}else if ([type isEqualToString:DECICE_TYPE_XUANDUO2F]){
str=[str substringWithRange:NSMakeRange(60,IFISH_TEMPERATURE_BYTE2)];
}
UInt64 mac=[dataContorl hexToTen:str];
@@ -913,6 +916,110 @@ indexPath{
}
//
+(void)XuTo2ControlCommandSelectorWithBackModel73:(Xuanduo2Model *)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 = @"04";
if([[model.waterPump substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"])
{
manulModel.switchBtn = @"01";
}else{
manulModel.switchBtn = @"00";
}
}else if (index == 1){ //
manulModel.lightNumber = @"01";
if([[model.gasPump substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"])
{
manulModel.switchBtn = @"01";
}else{
manulModel.switchBtn = @"00";
}
}else if (index == 2){ //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 == 3){ //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 == 4){ //
manulModel.lightNumber = @"06";
if([[model.waveMakingPump substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"])
{
manulModel.switchBtn = @"01";
}else{
manulModel.switchBtn = @"00";
}
}else if (index == 5){ //
manulModel.lightNumber = @"05";
if([[model.uvLamp substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"])
{
manulModel.switchBtn = @"01";
}else{
manulModel.switchBtn = @"00";
}
}else if (index == 6) { //
XuanduoHuliModel *huliModel = [[XuanduoHuliModel alloc] init];
huliModel.sendmacId = [Socketsingleton sharedInstance].macAddress;
huliModel.resavemacId = [Socketsingleton sharedInstance].macAddress;
NSString *switchString = huliModel.description;
if([[model.huliLight substringWithRange:NSMakeRange(0, IFISH_LIGHTBTN_BYTE)] isEqualToString:@"00"])
{
huliModel.switchBtn = @"01";
}else{
huliModel.switchBtn = @"00";
}
huliModel.crc16Str=@"0000";// CRC16验证码
NSString *switchString2 = [NSString stringWithFormat:@"%@%@%@",switchString,huliModel.switchBtn,huliModel.crc16Str];
NSData *manulData=[dataContorl stringToHexData:switchString2];
[[Socketsingleton sharedInstance] soketWriteData:manulData];
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
@@ -9,6 +9,7 @@
#import <UIKit/UIKit.h>
//竖屏水族箱 底部view
#import "DeviceModel.h"
#import "Xuanduo2Model.h"
#import "Socketsingleton.h"
#import "BootomViewSoketBackMasgConreol.h"
#import "DeviceCommunicateDataUnity.h"
@@ -47,6 +48,9 @@
withData:(DeviceModel *)dmodel
addMassglength:(NSUInteger) bufferlenth;
// 新绚多设置页面
-(void)didselectXuanduo2SetttngWithData:(DeviceModel *)dmodel
andBackModel:(Xuanduo2Model *)backmodel;
-(void)cameraBindDeviceSuccess;
@@ -58,6 +62,8 @@
-(void)selectXuToAtIndex:(NSIndexPath*)index withbackModel:(XutoBackMsgModel *)backmodel ;
-(void)selectXuanduo2Index:(NSIndexPath *)index withBackModel:(Xuanduo2Model *)backModel;
//对应松诺加热棒
-(void)slectSongNuoInde:(NSIndexPath*)index withBackModel:(SongNuoBackMassage *)backModel;
@@ -148,6 +154,8 @@
@property(nonatomic,strong) RunSun84Protocol *ruSun84Back;
@property (nonatomic, strong) RuiMeiProtocolModel *ruiMeiBack;
@property(nonatomic,strong) SongNuoBDProtocol *songNuoBDBack;
@property(nonatomic,strong) Xuanduo2Model *xuanduoBack;
-(void)setTabViewWithFrame:(CGRect)frame;
@@ -29,8 +29,14 @@
#import "XuToControlName.h"
#import "RuiMeiCHNameCustom.h"
#import "RuiMeiCHControl.h"
#import "Xuanduo2DataUtility.h"
#import "NSString+Add.h"
#define ktempTag 600
@implementation MonitorBootmView
{
NSTimer *_switchTimer;
}
-(id)initWithFrame:(CGRect)frame
{
@@ -610,7 +616,9 @@
} else if ([self.device.type isEqualToString:DECICE_TYPE_RUIMEI]) {
return 3 + 5;
} else {
} else if ([self.device.type isEqualToString:DECICE_TYPE_XUANDUO2F]){
return 3 + self.device.controlAmount.integerValue + 1;
}else {
if (self.device.controlAmount.integerValue ==5) {
@@ -690,7 +698,30 @@
withData:self.device
addMassglength:self.dataLength];
}else{
}else if ([self.device.type isEqualToString:DECICE_TYPE_XUANDUO2F]){
if (!_xuanduoBack) {
[self makeToast:@"暂未连接"];
return;
}
if (indexPath.row == 1) {
FishControlSecondCell *cell = [self.collectionView viewWithTag:ktempTag];
if (!cell || [cell.templabel.text containsString:@"kwh"]) {
return;
}
UInt64 mac = [dataContorl hexToTen:_xuanduoBack.electricity];
NSString *stringTemp = [NSString stringWithFormat:@"%llukwh",mac];
cell.templabel.font = [UIFont systemFontOfSize:37];
cell.templabel.textColor = RGB(253, 188, 63);
[cell.templabel setAttributedText:[NSString ls_changeFontAndColor:[UIFont systemFontOfSize:17] Color:nil TotalString:stringTemp SubStringArray:@[@"kwh"]]];
if (!_switchTimer) {
_switchTimer = [NSTimer timerWithTimeInterval:3.0 target:self selector:@selector(changeTemp) userInfo:nil repeats:YES];
[[NSRunLoop currentRunLoop] addTimer:_switchTimer forMode:NSRunLoopCommonModes];
}
}else if(indexPath.row == 2) {
[self.MonitorBottomDelegate didselectXuanduo2SetttngWithData:self.device andBackModel:_xuanduoBack];
}
}
else{
int controlAmount=[self.device.controlAmount intValue];
switch (controlAmount) {
@@ -894,6 +925,20 @@
}
[self makeToastActivity];
}else if ([self.device.type isEqualToString:DECICE_TYPE_XUANDUO2F]){
//
if (!_xuanduoBack) {
[self makeToast:@"暂未连接"];
return;
}
if (indexPath.row == 10 || indexPath.row == 3) {
//
[self.MonitorBottomDelegate selectXuanduo2Index:indexPath withBackModel:_xuanduoBack];
}else{
[BootomViewSoketBackMasgConreol XuTo2ControlCommandSelectorWithBackModel73:_xuanduoBack atindexPath:indexPath];
}
[self makeToastActivity];
}else{
int controlAmount=[self.device.controlAmount intValue];
@@ -1062,6 +1107,25 @@
}
- (void)changeTemp {
[self setTemperature];
[_switchTimer invalidate];
_switchTimer = nil;
}
- (void)setTemperature {
FishControlSecondCell *cell = [self.collectionView viewWithTag:ktempTag];
if (!cell) {
return;
}
UInt64 mac = [dataContorl hexToTen:_xuanduoBack.waterTemperature];
NSLog(@"%llu",mac);
//float TPlabel=mac/10+(mac%10)*0.1;
float temp = mac/10.0;
NSString *stringTemp = [NSString stringWithFormat:@"%.1f",temp];
[cell setTemWith:stringTemp];
}
#pragma mark 加载脚步视图
//- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath{
@@ -1116,7 +1180,7 @@
//
FishControlSecondCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"FishControlSecondCell" forIndexPath:indexPath];
cell.tag = ktempTag;
cell.backgroundColor = [UIColor whiteColor];
[cell setTemWith:self.temperature];
@@ -1179,6 +1243,14 @@
[cell setSongNuoBDControBtnImg:self.btnImgArr addArr:self.btnOnImgArr atIndex:indexPath addBackModel:_songNuoBDBack];
}else if ([self.device.type isEqualToString:DECICE_TYPE_XUANDUO2F]){
if (!_xuanduoBack) {
cell.controBtnImg.image = self.btnImgArr[indexPath.row - 3];
[self makeToast:@"连接设备中..."];
}else {
[cell setXuanduo2ControBtnImg:self.btnImgArr addArr:self.btnOnImgArr atIndex:indexPath addBackModel:_xuanduoBack];
}
}else{
int controlAmount=[self.device.controlAmount intValue];
@@ -1395,7 +1467,27 @@
LXImageWithImageName(@"bootview_co2_on"),
LXImageWithImageName(@"bootview_heat_on")];
} else{
}else if ([self.device.type isEqualToString:DECICE_TYPE_XUANDUO2F]){
self.btnNameArr = @[@"循环泵",@"增氧泵",@"灯光1",@"灯光2",@"造浪泵",@"杀菌灯",@"护理灯",@"加热棒"];
self.btnImgArr = @[[UIImage imageNamed:@"xunhuan_noraml"],
[UIImage imageNamed:@"zengyang_noraml"],
[UIImage imageNamed:@"dengguang_normal"],
[UIImage imageNamed:@"dengguang_normal"],
[UIImage imageNamed:@"zaolang_normal"],
[UIImage imageNamed:@"shajun_normal"],
[UIImage imageNamed:@"huli_noraml"],
[UIImage imageNamed:@"jiare_normal"]];
self.btnOnImgArr = @[[UIImage imageNamed:@"xunhuan_selected"],
[UIImage imageNamed:@"zengyang_selected"],
[UIImage imageNamed:@"dengguang_selected"],
[UIImage imageNamed:@"dengguang_selected"],
[UIImage imageNamed:@"zaolang_selectd"],
[UIImage imageNamed:@"shajun_selected"],
[UIImage imageNamed:@"huli_selected"],
[UIImage imageNamed:@"jiare_selected"]];
}else{
int controlAmount=[self.device.controlAmount intValue];
@@ -1702,6 +1794,14 @@
addMassglength:string1.length];
}else if ([self.device.type isEqualToString:DECICE_TYPE_XUANDUO2F]){
//
if (!_xuanduoBack) {
_xuanduoBack = [[Xuanduo2Model alloc] init];
}
[Xuanduo2DataUtility readSocketDataWithBackMsgModel:_xuanduoBack addWithBackData:data];
self.temperature = [BootomViewSoketBackMasgConreol getTempNewWayWithSoketData:data adddeviceType:DECICE_TYPE_XUANDUO2F];
[self.collectionView reloadData];
}else{
int controlAmount=[devicemoel.controlAmount intValue];
@@ -17,6 +17,7 @@
#import "SongNuoBDProtocol.h"
#import "RunSun84Protocol.h"
#import "RuiMeiProtocolModel.h"
#import "Xuanduo2Model.h"
@interface FishControlFourthCell : UICollectionViewCell
@@ -59,6 +60,12 @@
atIndex:(NSIndexPath *)indexPath
addBackModel:(XutoBackMsgModel *)model;
//新绚多
-(void)setXuanduo2ControBtnImg:(NSArray *)imgOffArr
addArr:(NSArray *)imgOnArr
atIndex:(NSIndexPath *)indexPath
addBackModel:(Xuanduo2Model*)model;
//松诺
-(void)setSongNuoControlBtnImg:(NSArray *)imgOffArr
@@ -88,4 +95,6 @@
atIndex:(NSIndexPath *)indexPath
addBackModel:(RuiMeiProtocolModel*)model;
@end
@@ -251,6 +251,63 @@
}
}
-(void)setXuanduo2ControBtnImg:(NSArray *)imgOffArr
addArr:(NSArray *)imgOnArr
atIndex:(NSIndexPath *)indexPath
addBackModel:(Xuanduo2Model*)model {
NSInteger index = indexPath.row - 3;
if (index == 0) {
NSString*stateString=[model.waterPump substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)];
[self btnImgAtIndex:indexPath withStr:stateString addWithOnImg:imgOnArr
addOffArr:imgOffArr];
}else if (index == 1){
NSString*stateString=[model.gasPump substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)];
[self btnImgAtIndex:indexPath withStr:stateString addWithOnImg:imgOnArr
addOffArr:imgOffArr];
}else if (index == 2){
NSString*stateString=[model.light1 substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)];
[self btnImgAtIndex:indexPath withStr:stateString addWithOnImg:imgOnArr
addOffArr:imgOffArr];
}else if (index == 3){
NSString*stateString=[model.light2 substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)];
[self btnImgAtIndex:indexPath withStr:stateString addWithOnImg:imgOnArr
addOffArr:imgOffArr];
}else if (index == 4){
NSString*stateString=[model.waveMakingPump substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)];
[self btnImgAtIndex:indexPath withStr:stateString addWithOnImg:imgOnArr
addOffArr:imgOffArr];
}else if (index == 5){
NSString*stateString=[model.uvLamp substringWithRange:NSMakeRange(2, IFISH_LIGHTBTN_BYTE)];
[self btnImgAtIndex:indexPath withStr:stateString addWithOnImg:imgOnArr
addOffArr:imgOffArr];
}else if (index == 6){
NSString*stateString=[model.huliLight substringWithRange:NSMakeRange(0, IFISH_LIGHTBTN_BYTE)];
[self btnImgAtIndex:indexPath withStr:stateString addWithOnImg:imgOnArr
addOffArr:imgOffArr];
}else if (index == 7){
NSString*stateString=[model.heatStatus substringWithRange:NSMakeRange(0, IFISH_LIGHTBTN_BYTE)];
[self btnImgAtIndex:indexPath withStr:stateString addWithOnImg:imgOnArr
addOffArr:imgOffArr];
}
}
@@ -38,7 +38,7 @@
formattemp = @"暂无数据";
}
self.templabel.font = [UIFont systemFontOfSize:17];
NSMutableAttributedString * attributedString = [[NSMutableAttributedString alloc] initWithString:formattemp ];
[attributedString addAttribute:NSForegroundColorAttributeName value:RGB(253, 188, 63) range:NSMakeRange(0,[formattemp length])];