static void Main(string[] args)
        {
            Console.WriteLine("Transportation Demo- Simulated Gate/Reader. Ctrl-C to exit.\n");

            // setup the items used by the simulated device
            TransportationDeviceClient myClient    = new TransportationDeviceClient(ConfigurationHandler.getConfig("AppSettings", "IoTConnectionString"));
            EventScheduler             myScheduler = new EventScheduler();

            // get device configuration details from JSON file
            GateReaderDeviceConfig deviceConfig = JsonConvert.DeserializeObject <GateReaderDeviceConfig>(ConfigurationHandler.GetDeviceRuntimeSettings("deviceConfig"));

            // create our simulated device
            myGateReader = new GateReaderDevice(deviceConfig, myClient, myScheduler);
            // initialize the device, setting up initial connections
            myGateReader.InitializeAsync().Wait();

            // start the device running
            myGateReader.StartAllEvents();

            // put the host into a loop
            while (true)
            {
                //do stuff
                Thread.Sleep(30000);
            }

            myGateReader.StopAllEvents();

            Console.ReadLine();
        }
Esempio n. 2
0
        private static void Main(string[] args)
        {
            Console.WriteLine("Transportation Demo- Simulated device. Ctrl-C to exit.\n");

            // Connect to the IoT hub using the MQTT protocol
            connectionString = getConfig("AppSettings", "IoTConnectionString");
            deviceClient     = new TransportationDeviceClient(connectionString);
            RegisterDirectMethods();
            SendDeviceToCloudMessagesAsync();
            Console.ReadLine();
        }
Esempio n. 3
0
        private static void Main(string[] args)
        {
            Console.WriteLine("Transportation Demo- Simulated device. Ctrl-C to exit.\n");

            // Connect to the IoT hub using the MQTT protocol
            _connectionString = ConfigurationHandler.getConfig("AppSettings", "IoTConnectionString");
            _deviceClient     = new TransportationDeviceClient(connectionString);

            RegisterDirectMethods();
            while (true)
            {
                SendPurchaseTicketMessageToCloudAsync();

                Thread.Sleep(30000);
            }
        }
        static void Main(string[] args)
        {
            Console.WriteLine("Transportation Demo- Simulated Gate/Reader. Ctrl-C to exit.\n");

            // Connect to the IoT hub using the MQTT protocol
            connectionString = ConfigurationHandler.getConfig("AppSettings", "IoTConnectionString");
            deviceClient     = new TransportationDeviceClient(connectionString);

            while (true)
            {
                //do stuff

                Thread.Sleep(30000);
            }

            Console.ReadLine();
        }
        private static void Main(string[] args)
        {
            Console.WriteLine("Transportation Demo- Simulated device. Ctrl-C to exit.\n");

            // setup the items used by the simulated device
            TransportationDeviceClient myClient    = new TransportationDeviceClient(ConfigurationHandler.getConfig("AppSettings", "IoTConnectionString"));
            EventScheduler             myScheduler = new EventScheduler();

            // get device configuration details from JSON file
            KioskDeviceConfig deviceConfig = JsonConvert.DeserializeObject <KioskDeviceConfig>(ConfigurationHandler.GetDeviceRuntimeSettings("deviceConfig"));

            // create our simulated device
            myKiosk = new KioskDevice(deviceConfig, myClient, myScheduler);
            myKiosk.InitializeAsync().Wait();

            // start the device running
            myKiosk.StartAllEvents();

            while (true)
            {
                Thread.Sleep(30000);
            }
        }