Exemplo n.º 1
0
 private void FunctionTestFormFormClosing(object sender, FormClosingEventArgs e)
 {
     //关闭所有线程
     DeviceAdapter.Close();
     //保存变量最后值
     _iVariableDesignRepository.ExitWithSaving();
 }
Exemplo n.º 2
0
 private void 停止同步数据ToolStripMenuItemClick(object sender, EventArgs e)
 {
     DeviceAdapter.Stop();
     步数据ToolStripMenuItem.Enabled    = true;
     停止同步数据ToolStripMenuItem.Enabled = false;
     timer1.Enabled = false;
 }
Exemplo n.º 3
0
        public MinicapAdapter(DeviceAdapter device, MinicapClient client)
        {
            Device = device;

            Client = client;

            _Rotation = SurfaceRotation.Rotation0;

            _ExecutableDirectory = AppDomain.CurrentDomain.BaseDirectory;
        }
Exemplo n.º 4
0
        protected override void OnStart(string[] args)
        {
            var config = ConfigurationHelper.CreateConfiguration();

            device = new Rld.DeviceSystem.DeviceAdapter.ZDC2911.DeviceAdapter();
            if (!device.Start(config))
            {
                throw new Exception("device starts fails");
            }
        }
        public void AdapterTest()
        {
            IDevice device = new DeviceAdapter();

            device.Start();

            Assert.IsTrue(device.IsRunning);

            device.Stop();
            Assert.IsFalse(device.IsRunning);
        }
Exemplo n.º 6
0
 private void 取消关联设备ToolStripMenuItemClick(object sender, EventArgs e)
 {
     if (dataGridView_Avaiable.SelectedRows.Count <= 0)
     {
         MessageBox.Show("关联变量必须选中变量");
         return;
     }
     DeviceAdapter.RemoveMap(
         _iVariableDesignRepository.FindVariableByPath(
             dataGridView_Avaiable.SelectedRows[0].Cells[1].Value.ToString()));
 }
Exemplo n.º 7
0
        public static IServiceCollection CreateSingletonForEachAdapter(this IServiceCollection services, string postgresConfig)
        {
            accountAdapter    = new AccountAdapter(postgresConfig);
            contractAdapter   = new ContractAdapter(postgresConfig);
            deviceAdapter     = new DeviceAdapter(postgresConfig);
            subscriberAdapter = new SubscriberAdapter(postgresConfig);

            return(services?
                   .AddSingleton(accountAdapter)
                   .AddSingleton(contractAdapter)
                   .AddSingleton(deviceAdapter)
                   .AddSingleton(subscriberAdapter));
        }
Exemplo n.º 8
0
        internal DeviceCommands(DeviceAdapter adapter)
        {
            Forward = new ReadOnlyCollection <IDeviceCommand>(new List <IDeviceCommand>()
            {
                new ConnectDeviceCommand(),
                new StartRecordingDeviceCommand()
            });

            Backward = new ReadOnlyCollection <IDeviceCommand>(new List <IDeviceCommand>()
            {
                new StopRecordingDeviceCommand(),
                new DisconnectDeviceCommand()
            });
        }
Exemplo n.º 9
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            UserDialogs.Init(this);
            deviceManager = DeviceManager.GetDeviceManager();
            deviceManager.DeviceDiscovered += DeviceDiscovered;
            // Create your application here
            SetContentView(Resource.Layout.activity_find_device);
            var scanButton = FindViewById <Button>(Resource.Id.device_scan);

            scanButton.Click += ScanButton_Click;

            deviceListView         = FindViewById <ListView>(Resource.Id.deivce_listview);
            deviceAdapter          = new DeviceAdapter(this, deviceManager.Devices);
            deviceListView.Adapter = deviceAdapter;
            //deviceAdapter.NotifyDataSetChanged;
        }
        protected override void OnResume()
        {
            base.OnResume();

            ble = new BluetoothScanner(this, this, this);
            ble.ScanResultEvent += Ble_ScanResultEvent;

            mListView            = FindViewById <ListView>(Resource.Id.listView1);
            adapterList          = new DeviceAdapter(this, ble.mLeDevices);
            mListView.Adapter    = adapterList;
            mListView.ItemClick += MListView_ItemClick;

            if (ble.mBluetoothAdapter != null)
            {
                if (!ble.mBluetoothAdapter.IsEnabled)
                {
                    if (flag_connessioneBLE)
                    {
                        Intent enableBtIntent = new Intent(BluetoothAdapter.ActionRequestEnable);
                        StartActivityForResult(enableBtIntent, 2);
                    }
                }
                else
                {
                    ble.Scanner();
                }
            }
            else
            {
                Handler mHandler = new Handler();
                mHandler.PostDelayed(new Action(delegate {
                    Finish();
                }), 2500);
                Toast.MakeText(this, "BLE Not Supported!", ToastLength.Short).Show();
            }
        }
Exemplo n.º 11
0
 public Device GetDevice()
 {
     return(DeviceAdapter.Create(_client.getDevice()));
 }
Exemplo n.º 12
0
        public static void Main(string[] args)
        {
            Console.WriteLine("Target devices");
            Console.WriteLine("-------------------\r\n");

            TargetDevice targetDeviceBox = new DeviceAdapter(DeviceTypeEnum.Box);

            targetDeviceBox.Display();

            TargetDevice targetDeviceScanner = new DeviceAdapter(DeviceTypeEnum.Scanner);

            targetDeviceScanner.Display();

            Console.WriteLine("Create devices");
            Console.WriteLine("-------------------\r\n");

            CreatorDevice[] devices = new CreatorDevice[2];

            devices[0] = new CreatorScannerA();
            devices[1] = new CreatorScannerB();

            foreach (CreatorDevice device in devices)
            {
                Console.WriteLine("{0}\r\n", device.GetType().Name);
            }

            Console.WriteLine("Process states and commands");
            Console.WriteLine("---------------------------\r\n");

            Process process = new Process();
            Originator <ProcessStateEnum> originator = new Originator <ProcessStateEnum>();

            Console.WriteLine("Current State = " + process.CurrentState);
            ProcessStateEnum processStateStart = process.MoveNext(CommandEnum.Start);

            Console.WriteLine("Command Start: Current State = " + processStateStart);

            originator.SetState(processStateStart);
            Caretaker <ProcessStateEnum> .SaveState(originator);

            originator.ShowState();

            var processStatePause = process.MoveNext(CommandEnum.Pause);

            Console.WriteLine("Command Pause: Current State = " + processStatePause);
            originator.SetState(processStatePause);
            Caretaker <ProcessStateEnum> .SaveState(originator);

            originator.ShowState();

            var processStateEnd = process.MoveNext(CommandEnum.End);

            Console.WriteLine("Command End: Current State = " + processStateEnd);
            originator.SetState(processStateEnd);
            Caretaker <ProcessStateEnum> .SaveState(originator);

            originator.ShowState();

            var processStateExit = process.MoveNext(CommandEnum.Exit);

            Console.WriteLine("Command Exit: Current State = " + processStateExit);
            originator.SetState(processStateEnd);
            Caretaker <ProcessStateEnum> .SaveState(originator);

            originator.ShowState();

            Caretaker <ProcessStateEnum> .RestoreState(originator, 0);

            originator.ShowState();

            Console.ReadLine();
        }
Exemplo n.º 13
0
 public static async Task <int> GetId(IResolverContext context, [Parent] SubscriberDevice device, [Service] DeviceAdapter data)
 => device.Id = device.Id == default
         ? await context.BatchDataLoader <long, int>("getContractsIds", data.GetIds).LoadAsync(device.Id)
         : device.Id;
Exemplo n.º 14
0
 public static async Task <long> GetAccountNumber(IResolverContext context, [Parent] SubscriberDevice device, [Service] DeviceAdapter data)
 => device.Id != default
         ? await context.BatchDataLoader <int, long>("getAccountNumbersByIds", data.GetAccountNumbersByIds).LoadAsync(device.Id)
         : await context.BatchDataLoader <long, long>("getAccountNumbersByNums", data.GetAccountNumbersByNums).LoadAsync(device.Number);
Exemplo n.º 15
0
 public static async Task <DateTime> GetCreationDate(IResolverContext context, [Parent] SubscriberDevice device, [Service] DeviceAdapter data)
 => device.Id != default
         ? await context.BatchDataLoader <int, DateTime>("getDevicesDatesByIds", data.GetDatesByIds).LoadAsync(device.Id)
         : await context.BatchDataLoader <long, DateTime>("getDevicesDatesByNums", data.GetDatesByNums).LoadAsync(device.Number);
Exemplo n.º 16
0
 public static async Task <long> GetNumber(IResolverContext context, [Parent] SubscriberDevice device, [Service] DeviceAdapter data)
 => device.Number = device.Number = device.Number == default
         ? await context.BatchDataLoader <int, long>("getDevicesNumbers", data.GetNumbers).LoadAsync(device.Id)
         : device.Number;