コード例 #1
0
        /// <summary>
        /// Writes the ports values
        /// returns zero on sucess, else non-zero erro
        /// </summary>
        public UInt32 SendCommand(HidTxPacketStruct TxCmd)
        {
            try
            {
                int Length;
                if (TxCmd.MajorCmd == 102)
                {
                    Length = 16;
                }
                else
                {
                    Length = 8;
                }
                if (Hid.HidD_SetFeature(myDeviceHandle, StructureToByteArray(TxCmd), Length) == false)
                {
                    return(1);
                }
                else
                {
                    return(0);
                }
            }

            catch (Exception ex)
            {
                DisplayException(MODULE_NAME, ex);
                //throw;
                return(2);
            }
        }
コード例 #2
0
ファイル: DelcomHID.cs プロジェクト: JRoughan/Emanate
        /// <summary>
        /// Writes the ports values
        /// returns zero on sucess, else non-zero erro
        /// </summary>
        public UInt32 SendCommand(HidTxPacketStruct txCmd)
        {

            try
            {
                int length = txCmd.MajorCmd == 102 ? 16 : 8;
                return Hid.HidD_SetFeature(deviceHandle, StructureToByteArray(txCmd), length) ? 0 : 1u;
            }

            catch (Exception)
            {
                //throw;
                return (2);
            }
        }
コード例 #3
0
ファイル: DelcomHID.cs プロジェクト: bdebray/build-indicator
        /// <summary>
        /// Writes the ports values
        /// returns zero on sucess, else non-zero erro
        /// </summary>
        public UInt32 SendCommand( HidTxPacketStruct TxCmd)
        {
            try
            {
                int Length;
                if (TxCmd.MajorCmd == 102) Length = 16;
                else Length = 8;
                if (Hid.HidD_SetFeature(myDeviceHandle, StructureToByteArray(TxCmd), Length) == false) return (1);
                else return (0);
            }

            catch (Exception ex)
            {
                DisplayException(MODULE_NAME, ex);
                //throw;
                return (2);
            }
        }