Пример #1
0
        public DeviceDataRecord CreateDeviceRepresentation(ModelDevice device)
        {
            if (device == null)
            {
                return(null);
            }
            DeviceDataRecord raw = new DeviceDataRecord(device.ParentId);

            if (device is ModelDevice)
            {
                AddCommonDevicePropertiesAsNVPairs(device, raw);
                raw.AddProperty(AgentKeys.AgentName, AgentId);    // mark it as mine

                var specificDevice = device as ModelDeviceSample;
                if (specificDevice != null)
                {
                    AddInfoToDevice(raw, specificDevice);
                }
            }
            return(raw);
        }
Пример #2
0
 private static void AddInfoToDevice(DeviceDataRecord raw, ModelDeviceSample specificDevice)
 {
     raw.AddProperty(Consts.IPADDRESS_KEY, specificDevice.IPAddress);
     raw.AddProperty(Consts.DEVICENAME_KEY, specificDevice.DeviceName);
 }
Пример #3
0
 private static void AddInfoToDevice(DeviceDataRecord raw, ModelDeviceSample specificDevice)
 {
     raw.AddProperty(Consts.IPADDRESS_KEY, specificDevice.IPAddress);
     raw.AddProperty(Consts.DEVICENAME_KEY, specificDevice.DeviceName);
 }
Пример #4
0
        public DeviceDataRecord CreateDeviceRepresentation(ModelDevice device)
        {
            if (device == null) return null;
            DeviceDataRecord raw = new DeviceDataRecord(device.ParentId);
            if (device is ModelDevice)
            {
                AddCommonDevicePropertiesAsNVPairs(device, raw);
                raw.AddProperty(AgentKeys.AgentName, AgentId);    // mark it as mine

                var specificDevice = device as ModelDeviceSample;
                if (specificDevice != null)
                {
                    AddInfoToDevice(raw, specificDevice);
                }
            }
            return raw;
        }