/// <summary> /// Return an instance of the selected device /// </summary> /// <returns> Instance de notre device </returns> public proto_IfaceIODevice_t CreateDevice(proto_iodev_devices_t type) { proto_IfaceIODevice_t ret; ret = protocomm.device_create(type); return(ret); }
/// <summary> /// This Handler will process hall GUI Picker Index Event. /// You must always use this handler when creating a Picker, and check the sender object /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Picker_SelectedIndexChanged(object sender, EventArgs e) { if (sender == PickerDllDevice) { _eConfDllDevice = (proto_iodev_devices_t)PickerDllDevice.SelectedIndex; } }
public static proto_IfaceIODevice_t device_create(proto_iodev_devices_t type) { global::System.IntPtr cPtr = protocommPINVOKE.device_create((int)type); proto_IfaceIODevice_t ret = (cPtr == global::System.IntPtr.Zero) ? null : new proto_IfaceIODevice_t(cPtr, false); return(ret); }
/// <summary> /// Performs de the connection first step : ask for permission /// </summary> /// <param name="szUsbDevName"></param> void Backend_connect(string szUsbDevName) { _szDevName = szUsbDevName; /* We call the underlying USB connection except for emulsave*/ if (_szDevName == _ilist_dllDev[(int)proto_iodev_devices_t.PROTO_DEV_EMULSLAVE]) { // So if we did not selected with the emulsave type selector we force it now _eConfDllDevice = proto_iodev_devices_t.PROTO_DEV_EMULSLAVE; proto_IfaceIODevice_t dev = _dll_if.CreateDevice(proto_iodev_devices_t.PROTO_DEV_EMULSLAVE); _IsConnected = (_dll_if.Open(dev, "") == 0); OnDeviceconnected(); } else { // Check we did not selected unappropriate device type if (_eConfDllDevice == proto_iodev_devices_t.PROTO_DEV_EMULSLAVE) { DisplayAlert("Erreur", "Device type incorrect, select another", "Annuler"); return; } // We assynchronously run the permission // everything else is a true USB device _iusbManager.RequestPermAsync(szUsbDevName); } }