public static void Run(device_command_que cmd)
 {
     using (zvsEntities2 db = new zvsEntities2(zvsEntityControl.GetzvsConnectionString))
     {
         db.device_command_que.AddObject(cmd);
         db.SaveChanges();
         DeviceCommandAddedToQue(cmd.id);
     }
 }
Exemple #2
0
        void device_command_que_DeviceCommandRunCompleteEvent(device_command_que cmd, bool withErrors, string txtError)
        {
            if (cmd.id == CmdWaitingForProcessingQueID)
            {
                Waiting = false;

                if (withErrors)
                    errorCount++;
            }
        }
 public override bool ProcessDeviceCommand(device_command_que cmd)
 {
     return true;
 }
 void device_command_que_DeviceCommandRunCompleteEvent(device_command_que cmd, bool withErrors, string txtError)
 {
     if (withErrors)
         BroadcastMessage("ERR~" + txtError + Environment.NewLine);
 }
        public override bool ProcessDeviceCommand(device_command_que cmd)
        {
            if (cmd.device_commands.name.Contains("DYNAMIC_CMD_"))
            {
                //Get more info from this Node from OpenZWave
                Node node = GetNode(m_homeId, (byte)cmd.device.node_id);

                switch ((Data_Types)cmd.device_commands.arg_data_type)
                {
                    case Data_Types.BYTE:
                        {
                            byte b = 0;
                            byte.TryParse(cmd.arg, out b);

                            foreach (Value v in node.Values)
                                if (m_manager.GetValueLabel(v.ValueID).Equals(cmd.device_commands.custom_data1))
                                    m_manager.SetValue(v.ValueID, b);
                            return true;
                        }
                    case Data_Types.BOOL:
                        {
                            bool b = true;
                            bool.TryParse(cmd.arg, out b);

                            foreach (Value v in node.Values)
                                if (m_manager.GetValueLabel(v.ValueID).Equals(cmd.device_commands.custom_data1))
                                    m_manager.SetValue(v.ValueID, b);
                            return true;
                        }
                    case Data_Types.DECIMAL:
                        {
                            float f = Convert.ToSingle(cmd.arg);

                            foreach (Value v in node.Values)
                                if (m_manager.GetValueLabel(v.ValueID).Equals(cmd.device_commands.custom_data1))
                                    m_manager.SetValue(v.ValueID, f);
                            return true;
                        }
                    case Data_Types.LIST:
                    case Data_Types.STRING:
                        {
                            foreach (Value v in node.Values)
                                if (m_manager.GetValueLabel(v.ValueID).Equals(cmd.device_commands.custom_data1))
                                    m_manager.SetValue(v.ValueID, cmd.arg);
                            return true;
                        }
                    case Data_Types.INTEGER:
                        {
                            int i = 0;
                            int.TryParse(cmd.arg, out i);

                            foreach (Value v in node.Values)
                                if (m_manager.GetValueLabel(v.ValueID).Equals(cmd.device_commands.custom_data1))
                                    m_manager.SetValue(v.ValueID, i);
                            return true;
                        }
                }
            }
            return false;
        }
 void device_command_que_DeviceCommandRunCompleteEvent(device_command_que cmd, bool withErrors, string txtError)
 {
 }
Exemple #7
0
 void device_command_que_DeviceCommandRunCompleteEvent(device_command_que cmd, bool withErrors, string txtError)
 {
     if (this.InvokeRequired)
         this.Invoke(new device_command_que.DeviceCommandRunCompleteEventHandler(device_command_que_DeviceCommandRunCompleteEvent), new object[] { cmd, withErrors, txtError });
     else
     {
         if (withErrors)
             Logger.WriteToLog(Urgency.INFO, "Qued device command #'" + cmd.id + "' has completed with errors.", "EVENT");
     }
 }
Exemple #8
0
 public abstract bool ProcessDeviceCommand(device_command_que cmd);
 void device_command_que_DeviceCommandRunCompleteEvent(device_command_que cmd, bool withErrors, string txtError)
 {
     this.BroadcastEvent("DeviceCommandRunComplete", cmd.id.ToString());
 }
 public static void DeviceCommandRunComplete(device_command_que cmd, bool withErrors, string txtError)
 {
     if (DeviceCommandRunCompleteEvent != null)
         DeviceCommandRunCompleteEvent(cmd, withErrors, txtError);
 }
 public void Run(string argument = "")
 {
     device_command_que cmd = new device_command_que { device_command_id = this.id, arg = argument, device_id = this.device.id };
     cmd.Run();
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the device_command_que EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTodevice_command_que(device_command_que device_command_que)
 {
     base.AddObject("device_command_que", device_command_que);
 }
 /// <summary>
 /// Create a new device_command_que object.
 /// </summary>
 /// <param name="id">Initial value of the id property.</param>
 /// <param name="device_id">Initial value of the device_id property.</param>
 /// <param name="device_command_id">Initial value of the device_command_id property.</param>
 /// <param name="arg">Initial value of the arg property.</param>
 public static device_command_que Createdevice_command_que(global::System.Int64 id, global::System.Int64 device_id, global::System.Int64 device_command_id, global::System.String arg)
 {
     device_command_que device_command_que = new device_command_que();
     device_command_que.id = id;
     device_command_que.device_id = device_id;
     device_command_que.device_command_id = device_command_id;
     device_command_que.arg = arg;
     return device_command_que;
 }