private string GetDeviceInfo() { dynamic device = DeviceSchemaHelper.BuildDeviceStructure(Constants.DeviceId); device.DeviceProperties = DeviceSchemaHelper.GetDeviceProperties(device); device.DeviceProperties.Latitude = this.wayPointNavigator.CurrentGpsPosition?.Latitude; device.DeviceProperties.Longitude = this.wayPointNavigator.CurrentGpsPosition?.Longitude; device.Commands = CommandSchemaHelper.GetSupportedCommands(device); device.Telemetry = CommandSchemaHelper.GetTelemetrySchema(device); device.Version = Constants.VERSION_2_0; device.ObjectType = Constants.OBJECT_TYPE_DEVICE_INFO; // Remove the system properties from a device, to better emulate the behavior of real devices when sending device info messages. DeviceSchemaHelper.RemoveSystemPropertiesForSimulatedDeviceInfo(device); return(JsonConvert.SerializeObject(device)); }
private static void AssignTelemetry(dynamic device) { dynamic telemetry = CommandSchemaHelper.CreateNewTelemetry("Temperature", "Temperature", "double"); CommandSchemaHelper.AddTelemetryToDevice(device, telemetry); telemetry = CommandSchemaHelper.CreateNewTelemetry("Speed", "Speed", "double"); CommandSchemaHelper.AddTelemetryToDevice(device, telemetry); telemetry = CommandSchemaHelper.CreateNewTelemetry("CameraStatus", "CameraStatus", "bool"); CommandSchemaHelper.AddTelemetryToDevice(device, telemetry); telemetry = CommandSchemaHelper.CreateNewTelemetry("DeviceIp", "DeviceIp", "string"); CommandSchemaHelper.AddTelemetryToDevice(device, telemetry); telemetry = CommandSchemaHelper.CreateNewTelemetry("IsObstacleDetected", "IsObstacleDetected", "bool"); CommandSchemaHelper.AddTelemetryToDevice(device, telemetry); }
private static void AssignCommands(dynamic device) { dynamic command = CommandSchemaHelper.CreateNewCommand("PingDevice"); CommandSchemaHelper.AddCommandToDevice(device, command); command = CommandSchemaHelper.CreateNewCommand("SendBuzzer"); CommandSchemaHelper.AddCommandToDevice(device, command); command = CommandSchemaHelper.CreateNewCommand("SendWaypoints"); CommandSchemaHelper.DefineNewParameterOnCommand(command, "data", "string"); CommandSchemaHelper.AddCommandToDevice(device, command); command = CommandSchemaHelper.CreateNewCommand("EmergencyStop"); CommandSchemaHelper.AddCommandToDevice(device, command); command = CommandSchemaHelper.CreateNewCommand("SetLights"); CommandSchemaHelper.DefineNewParameterOnCommand(command, "data", "boolean"); CommandSchemaHelper.AddCommandToDevice(device, command); command = CommandSchemaHelper.CreateNewCommand("SetCamera"); CommandSchemaHelper.DefineNewParameterOnCommand(command, "data", "boolean"); CommandSchemaHelper.AddCommandToDevice(device, command); command = CommandSchemaHelper.CreateNewCommand("StartTelemetry"); CommandSchemaHelper.AddCommandToDevice(device, command); command = CommandSchemaHelper.CreateNewCommand("StopTelemetry"); CommandSchemaHelper.AddCommandToDevice(device, command); command = CommandSchemaHelper.CreateNewCommand("DemoRun"); CommandSchemaHelper.DefineNewParameterOnCommand(command, "data", "int"); CommandSchemaHelper.AddCommandToDevice(device, command); command = CommandSchemaHelper.CreateNewCommand("MoveVehicle"); CommandSchemaHelper.DefineNewParameterOnCommand(command, "data", "string"); CommandSchemaHelper.AddCommandToDevice(device, command); command = CommandSchemaHelper.CreateNewCommand("MoveCamera"); CommandSchemaHelper.DefineNewParameterOnCommand(command, "data", "string"); CommandSchemaHelper.AddCommandToDevice(device, command); }