diff --git a/projects/IoT/IoTServices/FBeeService/Application/Domain/Entities/DeviceId.cs b/projects/IoT/IoTServices/FBeeService/Application/Domain/Entities/DeviceId.cs index 9aadfa9d..c06be3fa 100644 --- a/projects/IoT/IoTServices/FBeeService/Application/Domain/Entities/DeviceId.cs +++ b/projects/IoT/IoTServices/FBeeService/Application/Domain/Entities/DeviceId.cs @@ -16,7 +16,7 @@ namespace Application.Domain.Entities List.Add(new DeviceId { RawDeviceId = 0x0163, Name = "红外转发器", CategoryName = "电器", CategoryNumber = "20", Icon = "control", RawCategory = "wtf", EName = "IR Control" }); List.Add(new DeviceId { RawDeviceId = 0x0202, Name = "窗帘", CategoryName = "电器", CategoryNumber = "20", Icon = "curtain", RawCategory = "Closures", EName = "Window Covering Device" }); List.Add(new DeviceId { RawDeviceId = 0x0220, Name = "调色灯", CategoryName = "照明", CategoryNumber = "30", Icon = "curtain", RawCategory = "Closures", EName = "Color Temperature Light" }); - List.Add(new DeviceId { RawDeviceId = 0x0309, Name = "粉尘检测器", CategoryName = "监测", CategoryNumber = "40", Icon = "dust", RawCategory = "HVAC", EName = "PM2.5 Sensor" }); + List.Add(new DeviceId { RawDeviceId = 0x0309, Name = "粉尘检测器", CategoryName = "监测", CategoryNumber = "40", Icon = "pm25", RawCategory = "HVAC", EName = "PM2.5 Sensor" }); List.Add(new DeviceId { RawDeviceId = 0x0402, Name = "报警器", CategoryName = "安防", CategoryNumber = "10", Icon = "alarm", RawCategory = "Intruder Alarm Systems", EName = "IAS Zone" }); } diff --git a/projects/IoT/IoTServices/FBeeService/Infrastructure/DeviceService.cs b/projects/IoT/IoTServices/FBeeService/Infrastructure/DeviceService.cs index 9449f328..1a916448 100644 --- a/projects/IoT/IoTServices/FBeeService/Infrastructure/DeviceService.cs +++ b/projects/IoT/IoTServices/FBeeService/Infrastructure/DeviceService.cs @@ -308,6 +308,10 @@ namespace FBeeService { this.X70(sn, data); } + else if (responseType == ResponseType.x72) + { + this.X70(sn, data); + } else { Console.WriteLine($"{responseType} hasn't handle"); @@ -1138,18 +1142,19 @@ namespace FBeeService } else if (clusterId == ClusterId.light) { - device.AddorUpdateData(Keys.Light, BitConverter.ToInt16(props[0x0000]), DeviceDataType.Int, "光照"); + device.AddorUpdateData(Keys.Light, BitConverter.ToInt16(props[0x0000]), DeviceDataType.Int, "光照度", "lux"); } else if (clusterId == ClusterId.alarm) { - device.AddorUpdateData(Keys.Warning, BitConverter.ToInt16(props[0x0080]), DeviceDataType.Int, "警报"); + var state = BitConverter.ToInt16(props[0x0080]); + device.AddorUpdateData(Keys.Warning, state == 1 ? "报警" : "正常", DeviceDataType.String, "状态"); device.AddorUpdateData(Keys.UnderVoltage, new BitArray(props[0x0080])[3], DeviceDataType.Int, "低电量"); } else if (clusterId == ClusterId.pm25) { - device.AddorUpdateData(Keys.PM25, BitConverter.ToInt16(props[0x0000]), DeviceDataType.Int, "PM2.5"); - device.AddorUpdateData(Keys.PM100, BitConverter.ToInt16(props[0x0002]), DeviceDataType.Int, "PM10"); - device.AddorUpdateData(Keys.PM10, BitConverter.ToInt16(props[0x0001]), DeviceDataType.Int, "PM1.0"); + device.AddorUpdateData(Keys.PM25, BitConverter.ToInt16(props[0x0000]), DeviceDataType.Int, "PM2.5", "μg/m³"); + device.AddorUpdateData(Keys.PM100, BitConverter.ToInt16(props[0x0002]), DeviceDataType.Int, "PM10", "μg/m³"); + device.AddorUpdateData(Keys.PM10, BitConverter.ToInt16(props[0x0001]), DeviceDataType.Int, "PM1.0", "μg/m³"); } else if (clusterId == ClusterId.temperature) { @@ -1205,7 +1210,6 @@ namespace FBeeService } } - //0x72 //0xb1 //0xb2 //0xc2 @@ -1265,22 +1269,22 @@ namespace FBeeService public void SendDevice(Device device) { - //Console.WriteLine("send device to server"); - //using (var scope = _applicationServices.CreateScope()) - //{ - // var clientService = scope.ServiceProvider.GetService(); - // clientService.SendDevice(device); - //} + Console.WriteLine("send device to server"); + using (var scope = _applicationServices.CreateScope()) + { + var clientService = scope.ServiceProvider.GetService(); + clientService.SendDevice(device); + } } public void SendDeviceInfo(DeviceInfo deviceInfo) { - //Console.WriteLine("send device to server"); - //using (var scope = _applicationServices.CreateScope()) - //{ - // var clientService = scope.ServiceProvider.GetService(); - // clientService.SendDeviceInfo(deviceInfo); - //}; + Console.WriteLine("send device to server"); + using (var scope = _applicationServices.CreateScope()) + { + var clientService = scope.ServiceProvider.GetService(); + clientService.SendDeviceInfo(deviceInfo); + }; } } } \ No newline at end of file diff --git a/projects/IoTClient/Assets/StreamingAssets/wwwroot/index.html b/projects/IoTClient/Assets/StreamingAssets/wwwroot/index.html index cec5e2da..114b14e2 100644 --- a/projects/IoTClient/Assets/StreamingAssets/wwwroot/index.html +++ b/projects/IoTClient/Assets/StreamingAssets/wwwroot/index.html @@ -2,7 +2,7 @@ - + @@ -24,15 +24,12 @@ +