コード例 #1
0
        /// <summary>
        /// Force the sensor's Car Presence to say occcupied
        /// </summary>
        private static async Task ForceOccupied(string sensorId)
        {
            Console.WriteLine("Test /api/sensor/force-occupied");
            Console.WriteLine("Force car presence to occupied (y/n)?");
            string input = Console.ReadLine();

            if (input == "y" || input == "Y")
            {
                // Sample JSON to send
                JObject json = new JObject {
                    ["sensorId"] = sensorId
                };

                try {
                    Console.WriteLine("Sending Force Occupied...");

                    await SensorApi.ForceOccupied(json.ToString());

                    Console.WriteLine("Force Occupied Sent" + "\n");
                } catch (Exception ex) {
                    Console.WriteLine("Method Error: " + ex.Message + "\n");
                }
            }
        }