Пример #1
0
        protected override Task <TrezorManager> ConnectAsync()
        {
            UWPUsbDeviceFactory.Register(new DebugLogger(), new DebugTracer());
            UWPHidDeviceFactory.Register(new DebugLogger(), new DebugTracer());

            return(base.ConnectAsync());
        }
Пример #2
0
        public MainPage()
        {
            InitializeComponent();

            UWPUsbDeviceFactory.Register(new DebugLogger(), new DebugTracer());
            UWPHidDeviceFactory.Register(new DebugLogger(), new DebugTracer());

            LoadApplication(new app());
        }
Пример #3
0
        public MainPage()
        {
            InitializeComponent();
            _DeviceConnectionExample.TrezorInitialized  += _DeviceConnectionExample_TrezorInitialized;
            _DeviceConnectionExample.TrezorDisconnected += _DeviceConnectionExample_TrezorDisconnected;

            //Register the factory for creating Usb devices. This only needs to be done once.
            UWPUsbDeviceFactory.Register();

            //Register the factory for creating Usb devices. This only needs to be done once.
            UWPHidDeviceFactory.Register();
        }
Пример #4
0
        private static async Task InitializeTrezor()
        {
            //Register the factory for creating Usb devices. This only needs to be done once.
            UWPUsbDeviceFactory.Register();

            //Register the factory for creating Usb devices. This only needs to be done once.
            UWPHidDeviceFactory.Register();

            //Note: other custom device types could be added here

            //Define the types of devices to search for. This particular device can be connected to via USB, or Hid
            var deviceDefinitions = new List <DeviceDefinition>
            {
                new DeviceDefinition {
                    DeviceType = DeviceType.Hid, VendorId = 0x534C, ProductId = 0x0001, Label = "Trezor One Firmware 1.6.x"
                },
                new DeviceDefinition {
                    DeviceType = DeviceType.Usb, VendorId = 0x1209, ProductId = 0x53C1, ReadBufferSize = 64, WriteBufferSize = 64, Label = "Trezor One Firmware 1.7.x"
                },
                new DeviceDefinition {
                    DeviceType = DeviceType.Usb, VendorId = 0x1209, ProductId = 0x53C0, ReadBufferSize = 64, WriteBufferSize = 64, Label = "Model T"
                }
            };

            //Get the first available device and connect to it
            var devices = await DeviceManager.Current.GetDevices(deviceDefinitions);

            var trezorDevice = devices.FirstOrDefault();
            await trezorDevice.InitializeAsync();

            //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
            var readBuffer = await trezorDevice.WriteAndReadAsync(writeBuffer);
        }
Пример #5
0
 private Task GetLedger()
 {
     UWPHidDeviceFactory.Register();
     return(GetLedgerBase());
 }
 public void Initialize()
 {
     UWPHidDeviceFactory.Register(new DebugLogger(), new DebugTracer());
     StartBroker(null, new LedgerManagerFactory());
 }