Ejemplo n.º 1
0
        private static void RunFirmwareDownload()
        {
            try
            {
                _fwdl = InternalLib.Request.FirmwareDownload(1004, 1101);

                //_fwdl.Enter.Execute();
                //_fwdl.Enter.Execute(_internalCallback);
                InternalAPICallbackItem item = _fwdl.Enter.Execute(TimeSpan.FromSeconds(10));
                if (null == item)
                {
                    _fwdl.Enter.Cancel();
                }

                item = _fwdl.Download.Execute(TimeSpan.FromSeconds(10));
                if (null == item)
                {
                    _fwdl.Download.Cancel();
                }

                //Transfer only makes sense if firmware type is third party over zigbee.
                //item = _fwdl.Transfer.Execute(_internalCallback, TimeSpan.FromMinutes(3), TimeSpan.FromSeconds(15));
                //if (null == item)
                //    _fwdl.Transfer.Cancel();

                item = _fwdl.Activate.Execute(TimeSpan.FromSeconds(10));
                if (null == item)
                {
                    _fwdl.Activate.Cancel();
                }

                item = _fwdl.Exit.Execute(TimeSpan.FromSeconds(10));
                if (null == item)
                {
                    _fwdl.Exit.Cancel();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("RunFirmwareDownload: " + ex.Message);
            }
        }
Ejemplo n.º 2
0
        private static void RunInteractiveRead()
        {
            try
            {
                _read1 = InternalLib.Request.InteractiveRead("2.16.840.1.114416.0.57513008",
                                                             false,
                                                             new DateTime(DateTime.UtcNow.AddHours(-8).Ticks),
                                                             new DateTime(DateTime.UtcNow.Ticks),
                                                             false, false, true, false, false, true, false, false, false, false, false, false, false);

                //Sync call that will return after job completion or waiting Timespan. Callback when completed will occur.
                InternalAPICallbackItem item = _read1.Execute(TimeSpan.FromSeconds(10));
                if (null == item)
                {
                    //Running longer than wanted.  Cancel it.
                    _read1.Cancel();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("RunInteractiveRead: " + ex.Message);
            }
        }
Ejemplo n.º 3
0
 private static void InternalCallbackOccured(object sender, SubscriberDataEventArgs <InternalAPICallbackItem> e)
 {
     //Capture the item and do with it what you will.
     _internalCallbackItem = e.DataList[0];
 }