コード例 #1
0
        internal async Task InitializeAsync()
        {
            _rtkGps = await SerialDeviceHelper.GetSerialDevice("AI041RYG", 57600, new TimeSpan(0, 0, 0, 0, 12), new TimeSpan(0, 0, 0, 0, 12)); //5hz rate is 12ms

            if (_rtkGps != null)
            {
                _dataReader = new DataReader(_rtkGps.InputStream)
                {
                    InputStreamOptions = InputStreamOptions.Partial
                }
            }
            ;                                                                                                        //send whatever we
            else
            {
                await _display.WriteAsync("GPS not found");

                return;
            }

            try
            {
                _listener.ConnectionReceived += async(s, e) => { await ProcessRequestAsync(e.Socket, _cancellationTokenSource.Token); };

                await _listener.BindServiceNameAsync(_port.ToString());
            }
            catch (Exception)
            {
                await _display.WriteAsync($"failed {_port}");
            }
        }
コード例 #2
0
ファイル: IotClient.cs プロジェクト: cuulee/RtkGpsBaseStation
        internal async Task InitializeAsync()
        {
            try
            {
                _deviceClient = DeviceClient.CreateFromConnectionString(_connectionString, TransportType.Amqp); //add connection string

                await _deviceClient.OpenAsync();
            }
            catch (Exception)
            {
                await _display.WriteAsync("IoT failed");
            }
        }