Beispiel #1
0
 /// <summary> Create a new instance of <c>wclWeDoInputFormat</c> class. </summary>
 /// <param name="ConnectionId"> The connection ID of the service.</param>
 /// <param name="DeviceType"> The type of the device. </param>
 /// <param name="Mode"> The mode of the device. </param>
 /// <param name="Interval"> The notifications interval. </param>
 /// <param name="Unit"> The unit the sensor should return values in. </param>
 /// <param name="NotificationsEnabled"> <c>True</c> if the device should send updates when the value changes. </param>
 /// <param name="Revision"> The Input Format revision. </param>
 /// <param name="NumberOfBytes"> The number of bytes in device's data packet. </param>
 /// <seealso cref="wclWeDoIoDeviceType"/>
 /// <seealso cref="wclWeDoSensorDataUnit"/>
 public wclWeDoInputFormat(Byte ConnectionId, wclWeDoIoDeviceType DeviceType, Byte Mode,
                           UInt32 Interval, wclWeDoSensorDataUnit Unit, Boolean NotificationsEnabled, Byte Revision,
                           Byte NumberOfBytes)
 {
     FConnectionId         = ConnectionId;
     FInterval             = Interval;
     FMode                 = Mode;
     FNotificationsEnabled = NotificationsEnabled;
     FDeviceType           = DeviceType;
     FUnit                 = Unit;
     FRevision             = Revision;
     FNumberOfBytes        = NumberOfBytes;
 }
Beispiel #2
0
 private wclWeDoIo GetDevice(wclWeDoHub Hub, wclWeDoIoDeviceType IoType)
 {
     if (Hub != null)
     {
         foreach (wclWeDoIo Io in Hub.IoDevices)
         {
             if (Io.DeviceType == IoType)
             {
                 return(Io);
             }
         }
     }
     return(null);
 }
Beispiel #3
0
        /// <summary> Gets the IO device by its type. </summary>
        /// <param name="Hub"> The WeDo Hub object. </param>
        /// <param name="IoType"> The device type. </param>
        /// <returns> The IO device or null. </returns>
        /// <seealso cref="wclWeDoHub"/>
        /// <seealso cref="wclWeDoIo"/>
        /// <seealso cref="wclWeDoIoDeviceType"/>
        public List <wclWeDoIo> GetIoDevices(wclWeDoHub Hub, wclWeDoIoDeviceType IoType)
        {
            if (Hub == null)
            {
                return(null);
            }

            List <wclWeDoIo> Devices = new List <wclWeDoIo>();

            foreach (wclWeDoIo Io in Hub.IoDevices)
            {
                if (Io.DeviceType == IoType)
                {
                    Devices.Add(Io);
                }
            }

            return(Devices);
        }
Beispiel #4
0
        /// <summary> Creates new IO device object. </summary>
        /// <param name="Hub"> The Hub object that owns the device. If this parameter is <c>null</c>
        ///   the <seealso cref="wclEInvalidArgument"/> exception raises. </param>
        /// <param name="ConnectionId"> The device's Connection ID. </param>
        /// <seealso cref="wclWeDoHub"/>
        /// <exception cref="wclEInvalidArgument"> The exception raises when the <c>Hub</c>
        ///   parameter is <c>null</c>. </exception>
        public wclWeDoIo(wclWeDoHub Hub, Byte ConnectionId)
        {
            if (Hub == null)
            {
                throw new wclEInvalidArgument("Hub parameter can not be null.");
            }

            FAttached           = true; // It is always attached on creation!
            FConnectionId       = ConnectionId;
            FDataFormats        = new List <wclWeDoDataFormat>();
            FDefaultInputFormat = null;
            FDeviceType         = wclWeDoIoDeviceType.iodUnknown;
            FFirmwareVersion    = new wclWeDoVersion();
            FHardwareVersion    = new wclWeDoVersion();
            FHub                  = Hub;
            FInputFormat          = null;
            FInternal             = true;
            FPortId               = 0;
            FNumbersFromValueData = new List <Byte[]>();
            FValidDataFormats     = new List <wclWeDoDataFormat>();
            FValue                = null;
        }