Пример #1
0
        private void SendSubscribe(string publishToken, TesiraAttributeCode attributeCode)
        {
            var message = Tesira.FormatBaseMessage(InstanceTag, TesiraCommand.Subscribe, attributeCode) + " \"" +
                          publishToken + "\" " + 200;

            Device.Send(message);
        }
Пример #2
0
 protected TesiraBlockBase(Tesira device, string instanceTag)
 {
     _device = device;
     _device.DeviceCommunicatingChange += OnDeviceCommunicatingChange;
     _device.ReceivedData          += OnReceivedData;
     _instanceTag                   = instanceTag;
     _device.Controls[_instanceTag] = this;
 }
Пример #3
0
 public JToken TryParseResponse()
 {
     try
     {
         if (string.IsNullOrEmpty(_messageWithFix))
         {
             _messageWithFix = Tesira.FixJsonData(_message);
         }
         return(JToken.Parse(_messageWithFix));
     }
     catch (Exception e)
     {
         return(null);
     }
 }
Пример #4
0
        protected void Unsubscribe(string publishToken)
        {
            if (Subscriptions.ContainsKey(publishToken))
            {
                if (Device.DeviceCommunicating)
                {
                    var message =
                        Tesira.FormatBaseMessage(InstanceTag, TesiraCommand.Unsubscribe, Subscriptions[publishToken]) +
                        " \"" + publishToken + "\"";
                    Device.Send(message);
                }

                Subscriptions.Remove(publishToken);
            }
        }
Пример #5
0
 protected MultiChannelBlockBase(Tesira device, string instanceTag)
     : base(device, instanceTag)
 {
 }