public void StartListening() { TrezorDevice?.Close(); DeviceListener.DeviceDisconnected += DevicePoller_DeviceDisconnected; DeviceListener.DeviceInitialized += DevicePoller_DeviceInitialized; DeviceListener.Start(); }
public void StartListening() { TrezorDevice?.Dispose(); DeviceListener = new DeviceListener(_deviceDefinitions, 3000); DeviceListener.DeviceDisconnected += DevicePoller_DeviceDisconnected; DeviceListener.DeviceInitialized += DevicePoller_DeviceInitialized; }
public void Dispose() { DeviceListener.DeviceDisconnected -= DevicePoller_DeviceDisconnected; DeviceListener.DeviceInitialized -= DevicePoller_DeviceInitialized; DeviceListener.Dispose(); TrezorDevice?.Dispose(); }
public async Task InitializeTrezorAsync() { //Get the first available device and connect to it var devices = await DeviceManager.Current.GetDevicesAsync(_DeviceDefinitions); TrezorDevice = devices.FirstOrDefault(); await TrezorDevice.InitializeAsync(); }
public void StartListening() { TrezorDevice?.Dispose(); DeviceListener = new DeviceListener(_DeviceDefinitions, PollMilliseconds); DeviceListener.DeviceDisconnected += DevicePoller_DeviceDisconnected; DeviceListener.DeviceInitialized += DevicePoller_DeviceInitialized; DeviceListener.Start(); }
public async Task <byte[]> WriteToIncrementAsync(byte[] writeBuffer) { //GPIO-1 Chip Select (should become low) Strain Gage //Create a buffer with 3 bytes (initialize) //Write the data to the device return(await TrezorDevice.WriteAndReadAsync(writeBuffer)); }
public async Task <byte[]> WriteAndReadFromDeviceAsync() { //Create a buffer with 3 bytes (initialize) var writeBuffer = new byte[64]; writeBuffer[0] = 0x3f; writeBuffer[1] = 0x23; writeBuffer[2] = 0x23; //Write the data to the device return(await TrezorDevice.WriteAndReadAsync(writeBuffer).ConfigureAwait(false)); }
public async Task InitializeTrezorAsync() { //Get the first available device and connect to it var devices = await DeviceManager.Current.GetDevicesAsync(_DeviceDefinitions); TrezorDevice = devices.FirstOrDefault(); if (TrezorDevice == null) { throw new Exception("There were no devices found"); } await TrezorDevice.InitializeAsync(); }
public async Task InitializeTrezorAsync() { //Get the first available device and connect to it var devices = await DeviceListener.DeviceFactory.GetConnectedDeviceDefinitionsAsync().ConfigureAwait(false); var firstConnectedDeviceDefinition = devices.FirstOrDefault(); TrezorDevice = await DeviceListener.DeviceFactory.GetDeviceAsync(firstConnectedDeviceDefinition).ConfigureAwait(false); if (TrezorDevice == null) { throw new Exception("There were no devices found"); } await TrezorDevice.InitializeAsync().ConfigureAwait(false); }
public void Dispose() { TrezorDevice?.Dispose(); }