public void sendMeasurement(Lib.SiteWhere.Model.Types.DeviceMeasurements measurement, String originator) { string values = ""; foreach (var m in measurement.Measurement) { values += " '" + m.MeasurementId + "':'" + m.MeasurementValue + "', "; } var json = @"{ 'hardwareId': '" + measurement.HardwareId + @"', 'type': 'DeviceMeasurements', 'request': { 'measurements': { " + values.Trim().TrimEnd(',') + @" }, 'updateState': true } }"; sendMessage(json.Replace("'", "\""), "measurement"); }
/* * (non-Javadoc) * * @see * com.sitewhere.agent.ISiteWhereEventDispatcher#sendMeasurement(com.sitewhere * .device.communication.protobuf.proto.Sitewhere.Model.DeviceMeasurements, * java.lang.String) */ public void sendMeasurement(Lib.SiteWhere.Model.Types.DeviceMeasurements measurement, String originator) { sendMessage(Lib.SiteWhere.SiteWhere.Types.Command.SendDeviceMeasurements, measurement, originator, "measurement"); }