Ejemplo n.º 1
0
        public void Assign(object right)
        {
            tSENDDATA val = right as tSENDDATA;

            if (val == null)
            {
                throw new Exception("object is not tSENDDATA type!");
            }
            else
            {
                this.mac.Assign(val.mac);
                this.priority   = val.priority;
                this.u16SrcPort = val.u16SrcPort;
                this.u16DstPort = val.u16DstPort;
                this.u8Options  = val.u8Options;

                if (val.u8aData == null || val.u8aData.Length <= 0)
                {
                    return;
                }
                else
                {
                    this.u8aData = new byte[val.u8aData.Length];
                    Array.Copy(val.u8aData, this.u8aData, val.u8aData.Length);
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 将用户请求转换成有意义的字符串
        /// </summary>
        /// <param name="element">用户请求元素</param>
        /// <returns>用户请求字符串描述</returns>
        private string describeCmd(UserRequestElement element)
        {
            if (element == null)
            {
                return("");
            }
            if (element.cmd != enCmd.CMDID_SENDDATA)
            {
                return(element.cmd.ToString());
            }
            else
            {
                tSENDDATA    sendData = (tSENDDATA)element.param;
                enAppMainCMD cmd      = (enAppMainCMD)(sendData.u8aData[APP_CMD_OFFS_IN_NOTF_DATA] >> 5);
                byte         subCmd   = (byte)(sendData.u8aData[APP_CMD_OFFS_IN_NOTF_DATA] & 0x1F);
                switch (cmd)
                {
                case enAppMainCMD.eNotify:
                {
                    if (subCmd == (byte)enAppNotifySubCMD.eSelfReport)
                    {
                        return("ReplySelfReport(" + sendData.mac.ToHexString() + ")");
                    }
                    else if (subCmd == (byte)enAppNotifySubCMD.eHealthReport)
                    {
                        return("ReplyHealthReport(" + sendData.mac.ToHexString() + ")");
                    }
                    else if (subCmd == (byte)enAppNotifySubCMD.eWaveDesc)
                    {
                        return("ReplyWaveDesc(" + sendData.mac.ToHexString() + ")");
                    }
                    else if (subCmd == (byte)enAppNotifySubCMD.eWaveData)
                    {
                        return("ReplyWaveData(" + sendData.mac.ToHexString() + ")");
                    }
                    else if (subCmd == (byte)enAppNotifySubCMD.eEigenVal)
                    {
                        return("ReplyEigenVal(" + sendData.mac.ToHexString() + ")");
                    }
                    else
                    {
                        return(null);
                    }
                }

                case enAppMainCMD.eSet:
                {
                    if (subCmd == (byte)enAppSetSubCMD.eTimeCali)
                    {
                        return("SetTimeCali(" + sendData.mac.ToHexString() + ")");
                    }
                    else if (subCmd == (byte)enAppSetSubCMD.eNetworkID)
                    {
                        return("SetNetworkID(" + sendData.mac.ToHexString() + ")");
                    }
                    else if (subCmd == (byte)enAppSetSubCMD.eMeasDef)
                    {
                        return("SetMeasDef(" + sendData.mac.ToHexString() + ")");
                    }
                    else if (subCmd == (byte)enAppSetSubCMD.eSn)
                    {
                        return("SetSn(" + sendData.mac.ToHexString() + ")");
                    }
                    else if (subCmd == (byte)enAppSetSubCMD.eCaliCoeff)
                    {
                        return("SetSensorCali(" + sendData.mac.ToHexString() + ")");
                    }
                    else if (subCmd == (byte)enAppSetSubCMD.eADCloseVolt)
                    {
                        return("SetADCloseVolt(" + sendData.mac.ToHexString() + ")");
                    }
                    else if (subCmd == (byte)enAppSetSubCMD.eRevStop)
                    {
                        return("SetRevStop(" + sendData.mac.ToHexString() + ")");
                    }
                    else if (subCmd == (byte)enAppSetSubCMD.eTrigParam)
                    {
                        return("SetTrigParam(" + sendData.mac.ToHexString() + ")");
                    }
                    else if (subCmd == (byte)enAppSetSubCMD.eWsRouteMode)
                    {
                        return("SetWsRouteMode(" + sendData.mac.ToHexString() + ")");
                    }
                    else if (subCmd == (byte)enAppSetSubCMD.eWsDebugMode)
                    {
                        return("SetWsDebugMode(" + sendData.mac.ToHexString() + ")");
                    }
                    else
                    {
                        return(null);
                    }
                }

                case enAppMainCMD.eGet:
                {
                    if (subCmd == (byte)enAppGetSubCMD.eSn)
                    {
                        return("GetSn(" + sendData.mac.ToHexString() + ")");
                    }
                    else if (subCmd == (byte)enAppGetSubCMD.eCaliCoeff)
                    {
                        return("GetCaliCoeff(" + sendData.mac.ToHexString() + ")");
                    }
                    else if (subCmd == (byte)enAppGetSubCMD.eADCloseVolt)
                    {
                        return("GetADCloseVolt(" + sendData.mac.ToHexString() + ")");
                    }
                    else if (subCmd == (byte)enAppGetSubCMD.eRevStop)
                    {
                        return("GetRevStop(" + sendData.mac.ToHexString() + ")");
                    }
                    else if (subCmd == (byte)enAppGetSubCMD.eTrigParam)
                    {
                        return("GetTrigParam(" + sendData.mac.ToHexString() + ")");
                    }
                    else if (subCmd == (byte)enAppGetSubCMD.eWsRouteMode)
                    {
                        return("GetWsRouteMode(" + sendData.mac.ToHexString() + ")");
                    }
                    else
                    {
                        return(null);
                    }
                }

                case enAppMainCMD.eRestore:
                {
                    if (subCmd == (byte)enAppRestoreSubCMD.eWS)
                    {
                        return("RestoreWS(" + sendData.mac.ToHexString() + ")");
                    }
                    else if (subCmd == (byte)enAppRestoreSubCMD.eWG)
                    {
                        return("RestoreWG" + sendData.mac.ToHexString() + ")");
                    }
                    else
                    {
                        return(null);
                    }
                }

                case enAppMainCMD.eReset:
                {
                    if (subCmd == (byte)enAppResetSubCMD.eWS)
                    {
                        return("ResetWS(" + sendData.mac.ToHexString() + ")");
                    }
                    else if (subCmd == (byte)enAppResetSubCMD.eWG)
                    {
                        return("ResetWG" + sendData.mac.ToHexString() + ")");
                    }
                    else
                    {
                        return(null);
                    }
                }

                case enAppMainCMD.eUpdate:
                {
                    if (subCmd == (byte)enAppUpdateSubCMD.eFwDesc)
                    {
                        return("UpdateFwDesc(" + sendData.mac.ToHexString() + ")");
                    }
                    else if (subCmd == (byte)enAppUpdateSubCMD.eFwData)
                    {
                        return("UpdateFwData(" + sendData.mac.ToHexString() + ")");
                    }
                    else if (subCmd == (byte)enAppUpdateSubCMD.eControl)
                    {
                        return("UpdateControl(" + sendData.mac.ToHexString() + ")");
                    }
                    else
                    {
                        return(null);
                    }
                }

                default: return("");
                }
            }
        }