public async Task ConnectIoTC(string deviceId, string scopeId, string symKey)
        {
            DeviceClient = new IoTCClient(deviceId, scopeId, IoTCConnect.SYMM_KEY, symKey);
            await DeviceClient.Connect();

            MessagingCenter.Send(new ResultMessage <IoTCConnectionState>(IoTCConnectionState.CONNECTION_OK), Constants.IOTC_DEVICE_CLIENT_CONNECTED);
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            IoTCClient client = new IoTCClient("testcsharp", "0ne00052362", iotc_csharp_device_client.enums.IoTCConnect.SYMM_KEY, "68p6zEjwVNB6L/Dz8Wkz4VhaTrYqkndPrB0uJbWr2Hc/AmB+Qxz/eJJ9MIhLZFJ6hC0RmHMgfaYBkNTq84OCNQ==");

            client.SetLogging(iotc_csharp_device_client.enums.IoTCLogging.FULL);
            client.Connect().Wait();
            Random random = new Random();
            int    temperature, pressure;

            for (int i = 0; i < 30; i++)
            {
                temperature = random.Next(0, 100);
                pressure    = random.Next(300, 1000);
                client.SendTelemetry($"{{\"temp\":{temperature},\"pressure\":{pressure}}}", null).Wait();
            }
        }
 public SasAuthentication(IoTCClient client) => Client = client;
Exemplo n.º 4
0
 public CertAuthentication(IoTCClient client) => Client = client;