public RspDataInThread(DeviceForm deviceForm) { ExtCmdStatus = new ExtCmdStatus(); AttErrorRsp = new AttErrorRsp(); m_attFindInfoRsp = new AttFindInfoRsp(deviceForm); m_attFindByTypeValueRsp = new AttFindByTypeValueRsp(deviceForm); m_attReadByTypeRsp = new AttReadByTypeRsp(deviceForm); AttReadRsp = new AttReadRsp(deviceForm); AttReadBlobRsp = new AttReadBlobRsp(deviceForm); m_attReadByGrpTypeRsp = new AttReadByGrpTypeRsp(deviceForm); AttWriteRsp = new AttWriteRsp(); AttPrepareWriteRsp = new AttPrepareWriteRsp(); AttExecuteWriteRsp = new AttExecuteWriteRsp(); AttHandleValueNotification = new AttHandleValueNotification(deviceForm); AttHandleValueIndication = new AttHandleValueIndication(deviceForm); m_taskThread = new Thread(new ParameterizedThreadStart(TaskThread)); m_taskThread.Name = moduleName; m_taskThread.Start(m_threadData); Thread.Sleep(0); while (!m_taskThread.IsAlive) { } }
public void AttExecuteWriteRsp(AttExecuteWriteRsp.RspInfo rspInfo) { if (InvokeRequired) { try { Invoke((Delegate)new AttExecuteWriteRsp.AttExecuteWriteRspDelegate(AttExecuteWriteRsp), rspInfo); } catch { } } else { ClearRspDelegates(); if (!rspInfo.success) { string msg = "Att Execute Write Command Failed\n"; if (DisplayMsgCallback != null) DisplayMsgCallback(SharedAppObjs.MsgType.Error, msg); msgBox.UserMsgBox(SharedObjects.MainWin, MsgBox.MsgTypes.Error, msg); } else if ((int)rspInfo.header.EventStatus != 0) { string msg = "Att Execute Write Command Failed\n" + "Status = " + devUtils.GetStatusStr(rspInfo.header.EventStatus) + "\n"; if (DisplayMsgCallback != null) DisplayMsgCallback(SharedAppObjs.MsgType.Error, msg); msgBox.UserMsgBox(SharedObjects.MainWin, MsgBox.MsgTypes.Error, msg); } else { formDataAccess.WaitOne(); gattWriteDataAttr.DataUpdate = true; if (!attrDataUtils.UpdateAttrDictItem(gattWriteDataAttr)) { string msg = "Att Write Execute Command Data Update Failed\nAttribute Form Data For This Items Did Not Update\n"; if (DisplayMsgCallback != null) DisplayMsgCallback(SharedAppObjs.MsgType.Warning, msg); msgBox.UserMsgBox(SharedObjects.MainWin, MsgBox.MsgTypes.Warning, msg); } else if (AttrDataItemChangedCallback != null) AttrDataItemChangedCallback(); formDataAccess.ReleaseMutex(); } RestoreFormInput(); } }