diff --git a/.vs/IoTGateway/DesignTimeBuild/.dtbcache.v2 b/.vs/IoTGateway/DesignTimeBuild/.dtbcache.v2 index 7cae306..e5f9916 100644 Binary files a/.vs/IoTGateway/DesignTimeBuild/.dtbcache.v2 and b/.vs/IoTGateway/DesignTimeBuild/.dtbcache.v2 differ diff --git a/.vs/IoTGateway/project-colors.json b/.vs/IoTGateway/project-colors.json index 1d4e3a9..8ead5b4 100644 --- a/.vs/IoTGateway/project-colors.json +++ b/.vs/IoTGateway/project-colors.json @@ -125,7 +125,12 @@ "ProjectGuid": "8e2d91dc-dee4-4843-8d09-6fc06651527e", "DisplayName": "DriverModbusMaster", "ColorIndex": 7 + }, + "7752ad8c-04bf-4bd2-9272-cda4f78fa954": { + "ProjectGuid": "7752ad8c-04bf-4bd2-9272-cda4f78fa954", + "DisplayName": "PluginInterface", + "ColorIndex": 8 } }, - "NextColorIndex": 8 + "NextColorIndex": 9 } \ No newline at end of file diff --git a/.vs/IoTGateway/v17/.suo b/.vs/IoTGateway/v17/.suo index 4c023e7..78b6469 100644 Binary files a/.vs/IoTGateway/v17/.suo and b/.vs/IoTGateway/v17/.suo differ diff --git a/Plugins/Plugin/DeviceThread.cs b/Plugins/Plugin/DeviceThread.cs index 8b559ff..76e6cb6 100644 --- a/Plugins/Plugin/DeviceThread.cs +++ b/Plugins/Plugin/DeviceThread.cs @@ -104,14 +104,19 @@ namespace Plugin //变化了才推送到mqttserver,用于前端展示 if (DeviceValues[item.ID].StatusType != ret.StatusType || DeviceValues[item.ID].Value?.ToString() != ret.Value?.ToString() || DeviceValues[item.ID].CookedValue?.ToString() != ret.CookedValue?.ToString()) + { + //这是设备变量列表要用的 mqttServer.PublishAsync($"internal/v1/gateway/telemetry/{Device.DeviceName}/{item.Name}", JsonConvert.SerializeObject(ret)); + //这是在线组态要用的 + mqttServer.PublishAsync($"v1/gateway/telemetry/{Device.DeviceName}/{item.Name}", JsonConvert.SerializeObject(ret.CookedValue)); + } DeviceValues[item.ID] = ret; } payLoad.TS = (long)(DateTime.Now - TsStartDt).TotalMilliseconds; - if (DeviceValues.Any(x => x.Value.StatusType != VaribaleStatusTypeEnum.Good)) + if (DeviceValues.Any(x => x.Value.Value ==null)) { payLoad.Values = null; payLoad.DeviceStatus = DeviceStatusTypeEnum.Bad; diff --git a/Plugins/PluginInterface/DriverReturnValueModel.cs b/Plugins/PluginInterface/DriverReturnValueModel.cs index fad546a..c8a6bf2 100644 --- a/Plugins/PluginInterface/DriverReturnValueModel.cs +++ b/Plugins/PluginInterface/DriverReturnValueModel.cs @@ -14,7 +14,7 @@ namespace PluginInterface public object CookedValue { get; set; } public string Message { get; set; } [JsonConverter(typeof(StringEnumConverter))] - public VaribaleStatusTypeEnum StatusType { get; set; } + public VaribaleStatusTypeEnum StatusType { get; set; } = VaribaleStatusTypeEnum.UnKnow; public Guid VarId { get; set; } } }