public void Run(IProperties properties, GlobalDic <string, object> globalDic) { GetBtRssiAtCommandProperties config = properties as GetBtRssiAtCommandProperties; ComDut comDut = globalDic[typeof(ComDut).ToString()] as ComDut; OpenPhoneProperties configOpenPhone = globalDic[typeof(OpenPhoneProperties).ToString()] as OpenPhoneProperties; ILog log = globalDic[typeof(ILog).ToString()] as ILog; configGv = globalDic[typeof(GlobalVaribles).ToString()] as GlobalVaribles; string moudleBtMac = configGv.Get("MoudleBtMac"); string endLine = configOpenPhone.EndLine; if (!string.IsNullOrEmpty(endLine)) { endLine = Parse_r_n(endLine); } string atCommand = PreTranslateAtCommand(config.AtCommand); log.Info("AT Commond=" + atCommand); comDut.DtrEnable = configOpenPhone.Dtr; comDut.RtsEnable = configOpenPhone.Rts; comDut.Write(atCommand + endLine); Thread.Sleep(config.AtCommandInterval); string response = comDut.ReadExisting(); comDut.DtrEnable = false; comDut.RtsEnable = false; log.Info("AT Response=" + response); if (!string.IsNullOrEmpty(config.AtCommandError)) { if (response.Contains(config.AtCommandError)) { throw new BaseException(string.Format("AT response=[{0}] contain error=[{1}]", response, config.AtCommandError)); } } if (!string.IsNullOrEmpty(config.AtCommandOk)) { if (!response.Contains(config.AtCommandOk)) { throw new BaseException(string.Format("AT response=[{0}] not contain error=[{1}]", response, config.AtCommandOk)); } } if (config.CheckInfo != null) { for (int i = 0; i < config.CheckInfo.Length; i++) { if (!string.IsNullOrEmpty(config.CheckInfo[i])) { string checkInfo = PreTranslateCheckInfo(config.CheckInfo[i]); if (!response.Contains(checkInfo)) { throw new BaseException(string.Format("AT response=[{0}] not contain check info=[{1}]", response, checkInfo)); } } } } if (!string.IsNullOrEmpty(config.GlobalVariblesKey) && !string.IsNullOrEmpty(config.GlobalVariblesKeyPattern)) { string pattern = Parse_r_n(config.GlobalVariblesKeyPattern);//"E000E64CCACE:RSSI:([0-9-]{3,4})[:]" E000E64CCACE:RSSI:-052: pattern = moudleBtMac + pattern; Match matchValue = Regex.Match(response, pattern); if (!matchValue.Success) { throw new BaseException("read info value fail"); } string value = matchValue.Groups[1].ToString(); Match matchKey = Regex.Match(config.GlobalVariblesKey, this.pattern); if (!matchKey.Success) { throw new BaseException("read info key fail"); } string key = matchKey.Groups[1].ToString(); configGv.Add(key, value); } }
private void button1_Click(object sender, EventArgs e) { ParseLabelProperties properties = new ParseLabelProperties() { ImeiLocation = 1, SnLocation = 2, }; TaskItemManager taskItemManager = new TaskItemManager(properties); taskItemManager.MesPreCheckProperties.EnableCheckMac = true; taskItemManager.TaskItemParseLabel.Enable = true; //生成log taskItemManager.DeinitProperties.LogType = LogType.MAC; //打开WIFI UART OpenPhoneProperties configOpenWifiUart = new OpenPhoneProperties(); configOpenWifiUart.PortName = "COM18"; configOpenWifiUart.BaudRate = 115200; configOpenWifiUart.Dtr = true; configOpenWifiUart.Rts = true; configOpenWifiUart.EndLine = "\\r\\n"; configOpenWifiUart.Timeout = 10 * 1000; configOpenWifiUart.RetryCount = 0; configOpenWifiUart.AtType = AtType.Manual; configOpenWifiUart.SleepTimeAfterFindDut = 1000; TaskItem openWifiUartItem = new TaskItem(); openWifiUartItem.Enable = true; openWifiUartItem.Item = "打开WIFI串口";//Open Wifi Uart openWifiUartItem.CommonProperties = configOpenWifiUart; openWifiUartItem.Executer = new OpenPhoneExecutor(); taskItemManager.Put(openWifiUartItem); //发现设备 TaskItem findDevice = new TaskItem(); findDevice.Enable = true; findDevice.Item = "发现设备";//Find Device findDevice.CommonProperties = new FindDeviceProperties() { TestPowerOnAT = "", AtCommandInterval = 1000, EndLine = "\r\n", AtCommandOk = "WIFI initialized", Timeout = 10 * 1000, RetryCount = 0, SleepTimeBefore = 200, }; findDevice.Executer = new FindDeviceExecuter(); taskItemManager.Put(findDevice); //关闭WIFI UART TaskItem closeWifiUartItem = new TaskItem(); closeWifiUartItem.Enable = true; closeWifiUartItem.Item = "关闭WIFI串口";//Close WIFI Uart closeWifiUartItem.Executer = new ClosePhoneExecutor(); closeWifiUartItem.CommonProperties = new CommonProperties() { ExecuteCondition = ExecuteCondition.ALWAYS, RetryCount = 0, }; taskItemManager.Put(closeWifiUartItem); //打开BT OpenPhoneProperties configOpenPhone = new OpenPhoneProperties(); configOpenPhone.PortName = "COM17"; configOpenPhone.BaudRate = 2400; configOpenPhone.Dtr = true; configOpenPhone.Rts = true; configOpenPhone.EndLine = "\\r\\n"; configOpenPhone.Timeout = 10 * 1000; configOpenPhone.RetryCount = 0; configOpenPhone.AtType = AtType.Manual; configOpenPhone.SleepTimeAfterFindDut = 1000; TaskItem openPhoneItem = new TaskItem(); openPhoneItem.Enable = true; openPhoneItem.Item = "打开BT串口";//Open BT Uart openPhoneItem.CommonProperties = configOpenPhone; openPhoneItem.Executer = new OpenPhoneExecutor(); taskItemManager.Put(openPhoneItem); //读BT MAC,若读到则放到 MAC_BT中即可,后续fetch sn将自动+1,而不是取。若未读到,则info一下即可 if (true) { TaskItem isitWrittenMac = new TaskItem(); isitWrittenMac.Enable = true; isitWrittenMac.Item = "BT MAC预读";//Check BT MAC isitWrittenMac.CommonProperties = new IsitWrittenToTheBtMacProperties() { ResultType = AILinkFactoryAuto.Task.SmartBracelet.Property.IsitWrittenToTheBtMacProperties.GetBtMacRetType.ThrowExcption, ImesPreCheck = true, Timeout = 3 * 1000, RetryCount = 0, AtCommand = "AT+GETBLEMAC", AtCommandError = "ERROR", GlobalVariblesKeyPattern = "BLE MAC:([0-9A-F]{12})", GlobalVariblesKey = "{MAC_BT}", AtCommandInterval = 1000, SleepTimeBefore = 1500, }; isitWrittenMac.Executer = new IsitWrittenToTheBtMacExecuter(); taskItemManager.Put(isitWrittenMac); } //写BT 固件 TaskItem writeBtBin = new TaskItem(); writeBtBin.Enable = true; writeBtBin.Item = "写BT固件";//Write BT Bin writeBtBin.CommonProperties = new WriteBtBinProperties() { EraseCmd = "nrfjprog.exe --eraseall -f NRF52", ProgramCmd = "nrfjprog.exe --program {0} --verify -f NRF52", BinFileFullPath = " ./bin/whole.hex", ResetCmd = "nrfjprog.exe --reset -f NRF52", CmdCommandInterval = 500, Timeout = 10 * 1000, RetryCount = 0, SleepTimeBefore = 100, }; writeBtBin.Executer = new WriteBtBinExecuter(); taskItemManager.Put(writeBtBin); //BT版本号检查 if (true) { TaskItem checkBtVersionItem = new TaskItem(); checkBtVersionItem.Enable = true; checkBtVersionItem.Item = "BLE固件版本号检查";//Write BT MAC AtCommandProperties checkBtVersionProperties = new AtCommandProperties(); checkBtVersionProperties.AtCommand = "AT+GETINFO"; checkBtVersionProperties.AtCommandOk = "GET INFO OK"; checkBtVersionProperties.AtCommandError = "ERROR"; checkBtVersionProperties.CheckInfo = new string[] { "AI_WRIST_V1.15", "Apr 9 2020 18:58:47" }; checkBtVersionProperties.AtCommandInterval = 1000; checkBtVersionProperties.SleepTimeBefore = 800; checkBtVersionItem.CommonProperties = checkBtVersionProperties; checkBtVersionItem.Executer = new AtCommandExecuter(); taskItemManager.Put(checkBtVersionItem); } ////读BT MAC,判断是否要取号 //if (true) //{ // //读BT MAC // TaskItem getBTMacItem = new TaskItem(); // getBTMacItem.Enable = true; // getBTMacItem.Item = "读BT MAC";//GET BT MAC // AtCommandProperties configGetBtMac = new AtCommandProperties(); // configGetBtMac.AtCommand = "AT+GETBLEMAC"; // configGetBtMac.AtCommandOk = "OK"; // configGetBtMac.AtCommandError = "ERROR"; // configGetBtMac.GlobalVariblesKeyPattern = "BLE MAC:([0-9A-F]{12})";//KBLE MAC:112233445566OK // configGetBtMac.GlobalVariblesKey = "{MoudleBtMac}"; // configGetBtMac.AtCommandInterval = 800; // configGetBtMac.SleepTimeBefore = 800; // getBTMacItem.CommonProperties = configGetBtMac; // getBTMacItem.Executer = new AtCommandExecuter(); // taskItemManager.Put(getBTMacItem); //} //判断是否要取号,不取则+1赋值,并通知不从imes取号 //if (true) //{ // TaskItem isFetchMac = new TaskItem(); // isFetchMac.Enable = true; // isFetchMac.Item = "取MAC号方式自动判断";//Check BT MAC // isFetchMac.CommonProperties = new AccessToMacProperties() // { // Timeout = 3 * 1000, // RetryCount = 0, // AtCommand = "AT+GETBLEMAC", // AtCommandError = "ERROR", // GlobalVariblesKeyPattern = "BLE MAC:([0-9A-F]{12})", // GlobalVariblesKey = "{MoudleBtMac}", // AtCommandInterval = 800, // SleepTimeBefore = 800, // }; // isFetchMac.Executer = new AccessToMacExecuter(); // taskItemManager.Put(isFetchMac); //} //从IMES取wifi MAC,bt mac会自动放入全局变量 if (true) { MesFetchSnProperties mesFetchSnProperties = new MesFetchSnProperties(); mesFetchSnProperties.RetryCount = 0; mesFetchSnProperties.IsNeedInc1 = true; taskItemManager.AppendMesFetchSn(mesFetchSnProperties); } //写BT MAC TaskItem writeBTMacItem = new TaskItem(); writeBTMacItem.Enable = true; writeBTMacItem.Item = "写BT MAC";//Write BT MAC AtCommandProperties configWriteBtMac = new AtCommandProperties(); configWriteBtMac.AtCommand = "AT+SETBLEMAC={MAC_BT}"; configWriteBtMac.AtCommandOk = "reboot system"; configWriteBtMac.AtCommandError = "ERROR"; configWriteBtMac.AtCommandInterval = 800; configWriteBtMac.SleepTimeBefore = 3000; writeBTMacItem.CommonProperties = configWriteBtMac; writeBTMacItem.Executer = new AtCommandExecuter(); taskItemManager.Put(writeBTMacItem); //读BT MAC if (true) { TaskItem getBTMacItem = new TaskItem(); getBTMacItem.Enable = true; getBTMacItem.Item = "读BT MAC";//GET BT MAC AtCommandProperties configGetBtMac = new AtCommandProperties(); configGetBtMac.AtCommand = "AT+GETBLEMAC"; configGetBtMac.AtCommandOk = "OK"; configGetBtMac.AtCommandError = "ERROR"; configGetBtMac.GlobalVariblesKeyPattern = "BLE MAC:([0-9A-F]{12})";//KBLE MAC:112233445566OK configGetBtMac.GlobalVariblesKey = "{MoudleBtMac}"; configGetBtMac.AtCommandInterval = 800; getBTMacItem.CommonProperties = configGetBtMac; getBTMacItem.Executer = new AtCommandExecuter(); taskItemManager.Put(getBTMacItem); } //生成BT MAC二维码 if (true) { TaskItem showBtMacQrCodeItem = new TaskItem(); showBtMacQrCodeItem.Enable = true; showBtMacQrCodeItem.Item = "展示BT MAC二维码";//Check BT RSSI showBtMacQrCodeItem.CommonProperties = new ShowBtMacQrCodeProperties() { RetryCount = 3, StrQrcode = "http://www.baidu.com", ShowTime = 8000, }; showBtMacQrCodeItem.Executer = new ShowBtMacQrCodeExecuter(); taskItemManager.Put(showBtMacQrCodeItem); } //校验BT MAC //************待补充:来自IMES的BtMac应存在全局变量中************* TaskItem checkBtMac = new TaskItem(); checkBtMac.Enable = true; checkBtMac.Item = "校验BT MAC";//Check BT MAC checkBtMac.CommonProperties = new CheckBtMacProperties() { Timeout = 3 * 1000, RetryCount = 0, }; checkBtMac.Executer = new CheckBtMacExecuter(); taskItemManager.Put(checkBtMac); //设置BT FACMODE TaskItem setBtFacModeItem = new TaskItem(); setBtFacModeItem.Enable = true; setBtFacModeItem.Item = "设置BT 进入工厂模式";//Set Bt FactoryMode AtCommandProperties configSetBtFacMode = new AtCommandProperties(); configSetBtFacMode.AtCommand = "AT+SETFACMODE=1"; configSetBtFacMode.AtCommandOk = "OK"; configSetBtFacMode.AtCommandError = "ERROR"; configSetBtFacMode.AtCommandInterval = 800; configSetBtFacMode.SleepTimeAfter = 7000; setBtFacModeItem.CommonProperties = configSetBtFacMode; setBtFacModeItem.Executer = new AtCommandExecuter(); taskItemManager.Put(setBtFacModeItem); //BT串口发WIFI 软断电电指令 TaskItem wifiPowerOff = new TaskItem(); wifiPowerOff.Enable = true; wifiPowerOff.Item = "Wifi 断电";//Wifi PowerOff AtCommandProperties configWifiPowerOff = new AtCommandProperties(); configWifiPowerOff.AtCommand = "AT+SETGPSWIFIPWR=0"; configWifiPowerOff.AtCommandOk = "OK"; configWifiPowerOff.AtCommandError = "ERROR"; configWifiPowerOff.CheckInfo = new string[] { "wifi power off" }; configWifiPowerOff.AtCommandInterval = 3000; //configWifiPowerOff.SleepTimeBefore = 6000; configWifiPowerOff.Timeout = 12000; configWifiPowerOff.RetryCount = 3; wifiPowerOff.CommonProperties = configWifiPowerOff; wifiPowerOff.Executer = new AtCommandExecuter(); taskItemManager.Put(wifiPowerOff); //BT串口发WIFI 软上电指令 TaskItem wifiPowerOn = new TaskItem(); wifiPowerOn.Enable = true; wifiPowerOn.Item = "Wifi 上电";//Wifi PowerOn AtCommandProperties configWifiPowerOn = new AtCommandProperties(); configWifiPowerOn.AtCommand = "AT+SETGPSWIFIPWR=1"; configWifiPowerOn.AtCommandOk = "OK"; configWifiPowerOn.AtCommandError = "ERROR"; configWifiPowerOn.CheckInfo = new string[] { "wifi power on" }; configWifiPowerOn.AtCommandInterval = 2000; configWifiPowerOn.Timeout = 3000; configWifiPowerOff.RetryCount = 3; wifiPowerOn.CommonProperties = configWifiPowerOn; wifiPowerOn.Executer = new AtCommandExecuter(); taskItemManager.Put(wifiPowerOn); //BT发检查BT广播命令 TaskItem btBroadcastItem = new TaskItem(); btBroadcastItem.Enable = true; btBroadcastItem.Item = "BT 开始广播";//BT Broadcast AtCommandProperties configBtBroadcast = new AtCommandProperties(); configBtBroadcast.AtCommand = "AT+OPENBLEADV"; configBtBroadcast.AtCommandOk = "OK"; configBtBroadcast.AtCommandError = "ERROR"; configBtBroadcast.AtCommandInterval = 600; configBtBroadcast.Timeout = 2000; configBtBroadcast.RetryCount = 3; btBroadcastItem.CommonProperties = configBtBroadcast; btBroadcastItem.Executer = new AtCommandExecuter(); taskItemManager.Put(btBroadcastItem); //关闭BT UART TaskItem closePhoneItem = new TaskItem(); closePhoneItem.Enable = true; closePhoneItem.Item = "关闭BT 串口";//Close BT Uart closePhoneItem.Executer = new ClosePhoneExecutor(); closePhoneItem.CommonProperties = new CommonProperties() { ExecuteCondition = ExecuteCondition.ALWAYS, RetryCount = 0, }; taskItemManager.Put(closePhoneItem); #region BT扫描工具 //打开蓝牙扫描工具 UART OpenPhoneProperties configOpentToolUart = new OpenPhoneProperties(); configOpentToolUart.PortName = "COM21"; configOpentToolUart.BaudRate = 115200; configOpentToolUart.Dtr = true; configOpentToolUart.Rts = true; configOpentToolUart.EndLine = "\\r\\n"; configOpentToolUart.Timeout = 10 * 1000; configOpentToolUart.RetryCount = 0; configOpentToolUart.AtType = AtType.Manual; configOpentToolUart.SleepTimeAfterFindDut = 1000; TaskItem configOpentToolUartTtem = new TaskItem(); configOpentToolUartTtem.Enable = true; configOpentToolUartTtem.Item = "打开蓝牙扫描工具的串口";//Open Scan Tool Uart configOpentToolUartTtem.CommonProperties = configOpentToolUart; configOpentToolUartTtem.Executer = new OpenPhoneExecutor(); taskItemManager.Put(configOpentToolUartTtem); //发送开始扫描命令并获取BT RSSI TaskItem getBtRssiItem = new TaskItem(); getBtRssiItem.Enable = true; getBtRssiItem.Item = "开始扫描BT广播包并获取BT RSSI"; //Satrt Scan And Get BT RSSI GetBtRssiAtCommandProperties configGetBtRssiPro = new GetBtRssiAtCommandProperties(); //GetBtRssiAtCommandProperties configGetBtRssiPro.AtCommand = "AT+INQ"; configGetBtRssiPro.AtCommandOk = "OK"; configGetBtRssiPro.AtCommandError = "ERROR"; configGetBtRssiPro.CheckInfo = new string[] { "INQS" }; //********************************************正则表达式中存在变量的情况:该产品的蓝牙MAC后的值***************************************** configGetBtRssiPro.GlobalVariblesKeyPattern = ":RSSI:([0-9-]{3,4})[:]";//"BLE MAC->([0-9A-F:]{17})"; configGetBtRssiPro.GlobalVariblesKey = "{MoudleBtRssi}"; configGetBtRssiPro.AtCommandInterval = 7000; configGetBtRssiPro.Timeout = 7000; configGetBtRssiPro.RetryCount = 2; getBtRssiItem.CommonProperties = configGetBtRssiPro; getBtRssiItem.Executer = new GetBtRssiAtCommandExecuter();//GetBtRssiAtCommandExecuter taskItemManager.Put(getBtRssiItem); //检查BT RSSI if (true) { TaskItem checkBtRssiItem = new TaskItem(); checkBtRssiItem.Enable = true; checkBtRssiItem.Item = "检查BT RSSI";//Check BT RSSI checkBtRssiItem.CommonProperties = new CheckBtRssiProperties() { MaxValue = -10, MinValue = -90, Timeout = 2 * 1000, RetryCount = 0, }; checkBtRssiItem.Executer = new CheckBtRssiExecuter(); taskItemManager.Put(checkBtRssiItem); } //停止扫描 TaskItem stopScanBtRssiItem = new TaskItem(); stopScanBtRssiItem.Enable = true; stopScanBtRssiItem.Item = "停止扫描";//Stop Scan BT RSSI AtCommandProperties configStopScanBtRssiPro = new AtCommandProperties(); configStopScanBtRssiPro.AtCommand = "AT+SINQ"; configStopScanBtRssiPro.AtCommandOk = "INQE"; configStopScanBtRssiPro.AtCommandError = "ERROR"; configStopScanBtRssiPro.ExecuteCondition = ExecuteCondition.ALWAYS; configStopScanBtRssiPro.AtCommandInterval = 800; configStopScanBtRssiPro.Timeout = 2000; configStopScanBtRssiPro.RetryCount = 0; stopScanBtRssiItem.CommonProperties = configStopScanBtRssiPro; stopScanBtRssiItem.Executer = new AtCommandExecuter(); taskItemManager.Put(stopScanBtRssiItem); //关闭蓝牙扫描工具 UART TaskItem closeScanToolItem = new TaskItem(); closeScanToolItem.Enable = true; closeScanToolItem.Item = "关闭BT扫描工具串口";//Close Scan Tool Uart closeScanToolItem.Executer = new ClosePhoneExecutor(); closeScanToolItem.CommonProperties = new CommonProperties() { ExecuteCondition = ExecuteCondition.ALWAYS, RetryCount = 0, }; taskItemManager.Put(closeScanToolItem); #endregion //打开WIFI UART //OpenPhoneProperties configOpenWifiUart = new OpenPhoneProperties(); //configOpenWifiUart.PortName = "COM18"; //configOpenWifiUart.BaudRate = 115200; //configOpenWifiUart.Dtr = true; //configOpenWifiUart.Rts = true; //configOpenWifiUart.EndLine = "\\r\\n"; //configOpenWifiUart.Timeout = 10 * 1000; //configOpenWifiUart.RetryCount = 0; //configOpenWifiUart.AtType = AtType.Manual; //configOpenWifiUart.SleepTimeAfterFindDut = 1000; //TaskItem openWifiUartItem = new TaskItem(); //openWifiUartItem.Enable = true; //openWifiUartItem.Item = "Open Wifi Uart"; //openWifiUartItem.CommonProperties = configOpenWifiUart; //openWifiUartItem.Executer = new OpenPhoneExecutor(); taskItemManager.Put(openWifiUartItem); //读取WIFI MAP文件至内存********并更新MAC至内存************* TaskItem readMapItem = new TaskItem(); readMapItem.Enable = true; readMapItem.Item = "读取WIFI MAP文件并更新MAC至内存";//Read MAP From File readMapItem.CommonProperties = new ReadMapProperties() { MapFilePath = "./Map/8710BX.map", Timeout = 2 * 1000, RetryCount = 0, }; readMapItem.Executer = new ReadMapExecuter(); taskItemManager.Put(readMapItem); //写WIFI MAP 使用comdut自定义来写 TaskItem writeWifiMapItem = new TaskItem(); writeWifiMapItem.Enable = true; writeWifiMapItem.Item = "写WIFI MAP";// writeWifiMapItem.CommonProperties = new WriteWifiMapProperties() { //取MAC文件一行一行的写(16个字节) WriteMapAtCommand = "iwpriv config_set wmap,{0},{1}", Address = "0x00", AtCommandInterval = 50, AtCommandOk = "[MEM] After do cmd", AtCommandError = "unknown command", Timeout = 20 * 1000,//5 RetryCount = 0, RetryInterval = 50, }; writeWifiMapItem.Executer = new WriteWifiMapExecuter(); taskItemManager.Put(writeWifiMapItem); //写WIFI MAC //TaskItem writeWifiMacItem = new TaskItem(); //writeWifiMacItem.Enable = true; //writeWifiMacItem.Item = "Write WIFI MAC"; //AtCommandProperties configWriteWifiMac = new AtCommandProperties(); //configWriteWifiMac.AtCommand = "iwpriv config_set wmap,0x0a,{MAC}"; //configWriteWifiMac.AtCommandOk = "Private Message: 0x"; //configWriteWifiMac.AtCommandError = "unknown command"; //configWriteWifiMac.AtCommandInterval = 800; //writeWifiMacItem.CommonProperties = configWriteWifiMac; //writeWifiMacItem.Executer = new AtCommandExecuter(); //taskItemManager.Put(writeWifiMacItem); ////读并校验WIFI MAC //读并WIFI MAP TaskItem getWifiMoudleMapItem = new TaskItem(); getWifiMoudleMapItem.Enable = true; getWifiMoudleMapItem.Item = "读产品内部WIFI Map";//Get Wifi Moudle Map AtCommandProperties configGetWifiMoudleMap = new AtCommandProperties(); configGetWifiMoudleMap.AtCommand = "iwpriv config_get rmap,00,512"; configGetWifiMoudleMap.AtCommandOk = "Private Message: 0x"; configGetWifiMoudleMap.AtCommandError = "unknown command"; configGetWifiMoudleMap.GlobalVariblesKeyPattern = "Private Message: ([0-9A-Fx ]{2560})";//"BLE MAC->([0-9A-F:]{17})"; configGetWifiMoudleMap.GlobalVariblesKey = "{MoudleWifiMap}"; configGetWifiMoudleMap.AtCommandInterval = 800; configGetWifiMoudleMap.RetryCount = 5; getWifiMoudleMapItem.CommonProperties = configGetWifiMoudleMap; getWifiMoudleMapItem.Executer = new AtCommandExecuter(); taskItemManager.Put(getWifiMoudleMapItem); //校验WIFI MAP TaskItem checkWifiMapItem = new TaskItem(); checkWifiMapItem.Enable = true; checkWifiMapItem.Item = "校验WIFI Map";//Check Wifi Map checkWifiMapItem.CommonProperties = new CheckWifiMapProperties() { Timeout = 3 * 1000, RetryCount = 0, }; checkWifiMapItem.Executer = new CheckWifiMapExecuter(); taskItemManager.Put(checkWifiMapItem); //WIFI退出MP模式,进入用户模式 TaskItem wifiIntoUserMode = new TaskItem(); wifiIntoUserMode.Enable = true; wifiIntoUserMode.Item = "WIFI进入用户模式";//Wifi Into User Mode AtCommandProperties configWifiIntoUserProperties = new AtCommandProperties(); configWifiIntoUserProperties.AtCommand = "ATSC"; //****************************进入用户模式是否回复OK?*********************** configWifiIntoUserProperties.AtCommandOk = "Enter Image 2 "; configWifiIntoUserProperties.AtCommandError = "ERROR"; //configWifiIntoUserProperties.CheckInfo = new string[] { "[ATSC]:", "AT_SYSTEM_CLEAR_OTA_SIGNATURE" }; configWifiIntoUserProperties.AtCommandInterval = 4000; wifiIntoUserMode.CommonProperties = configWifiIntoUserProperties; wifiIntoUserMode.Executer = new AtCommandExecuter(); taskItemManager.Put(wifiIntoUserMode); //检查WIFI版本号 关键字 TaskItem getWifiVersionItem = new TaskItem(); getWifiVersionItem.Enable = true; getWifiVersionItem.Item = "检查WIFI版本号";//Get Wifi Version AtCommandProperties configGetWifiVersionProperties = new AtCommandProperties(); configGetWifiVersionProperties.AtCommand = "ATS?"; configGetWifiVersionProperties.AtCommandOk = "[ATS?]: SW VERSION:"; configGetWifiVersionProperties.AtCommandError = "unknown command"; configGetWifiVersionProperties.CheckInfo = new string[] { "SW VERSION: v.3.4" }; //configGetWifiVersionProperties.GlobalVariblesKeyPattern = "SW VERSION: ([v0-9.]{5})";//"BLE MAC->([0-9A-F:]{17})"; //configGetWifiVersionProperties.GlobalVariblesKey = "{MoudleWifiVersion}"; configGetWifiVersionProperties.AtCommandInterval = 800; configGetWifiVersionProperties.RetryCount = 3; getWifiVersionItem.CommonProperties = configGetWifiVersionProperties; getWifiVersionItem.Executer = new AtCommandExecuter(); taskItemManager.Put(getWifiVersionItem); //关闭WIFI UART //TaskItem closeWifiUartItem = new TaskItem(); //closeWifiUartItem.Enable = true; //closeWifiUartItem.Item = "Close WIFI Uart"; //closeWifiUartItem.Executer = new ClosePhoneExecutor(); //closeWifiUartItem.CommonProperties = new CommonProperties() //{ // ExecuteCondition = ExecuteCondition.ALWAYS, // RetryCount = 0, //}; taskItemManager.Put(closeWifiUartItem); //打开BT UART->版本号检查->信号强度检查->心率检查 //OpenPhoneProperties configOpenBtUart = new OpenPhoneProperties(); //configOpenBtUart.PortName = "COM17"; //configOpenBtUart.BaudRate = 2400; //configOpenBtUart.Dtr = true; //configOpenBtUart.Rts = true; //configOpenBtUart.EndLine = "\\r\\n"; //configOpenBtUart.Timeout = 10 * 1000; //configOpenBtUart.RetryCount = 0; //configOpenBtUart.AtType = AtType.Manual; //configOpenBtUart.SleepTimeAfterFindDut = 1000; //TaskItem openBtUartItem = new TaskItem(); //openBtUartItem.Enable = true; //openBtUartItem.Item = "Open BT Uart"; //openBtUartItem.CommonProperties = configOpenBtUart; //openBtUartItem.Executer = new OpenPhoneExecutor(); //taskItemManager.Put(openBtUartItem); taskItemManager.Put(openPhoneItem); //NB 软件版本号检查 AT+CGMR 关键字 TaskItem nbSoftVersionCheck = new TaskItem(); nbSoftVersionCheck.Enable = true; nbSoftVersionCheck.Item = "检查NB软件版本号";//NB Soft Version Check AtCommandProperties configNbSoftVersionCheck = new AtCommandProperties(); configNbSoftVersionCheck.AtCommand = "AT+CGMR"; configNbSoftVersionCheck.AtCommandOk = "OK"; configNbSoftVersionCheck.AtCommandError = "ERROR"; configNbSoftVersionCheck.CheckInfo = new string[] { "SOTFWAREVER:AI_LITEOS_NB15_B300SP5_V1.9_20200229" }; configNbSoftVersionCheck.AtCommandInterval = 1500; configNbSoftVersionCheck.SleepTimeBefore = 500; nbSoftVersionCheck.CommonProperties = configNbSoftVersionCheck; nbSoftVersionCheck.Executer = new AtCommandExecuter(); taskItemManager.Put(nbSoftVersionCheck); # region NB IMEI号等