private const byte SupportsCustomCommandsValue = 0x3; // Schedule v4 internal ScheduleSupportedCommandClass(byte commandClass, byte supported) { Class = (CommandClass)Enum.ToObject(typeof(CommandClass), commandClass); SupportsGet = supported == SupportsBothValue || supported == SupportsGetOnlyValue; SupportsSet = supported == SupportsBothValue || supported == SupportsSetOnlyValue; SupportsCustomCommands = supported == SupportsCustomCommandsValue; }
public override COMMUNICATERESULT SetData(CommandClass SetInfo) { int BytestoRec = 8; byte[] RecBytes; byte[] SendCommand; COMMUNICATERESULT ret; SendCommand = SetInfo.Command; if (!USBWrapper.USBConnectState()) { if (USBWrapper.connect() == COMMUNICATERESULT.OK) { ret = USBWrapper.SendAndReceive(SendCommand, BytestoRec, out RecBytes); } else { return(COMMUNICATERESULT.PortOpenFail); } } else { ret = USBWrapper.SendAndReceive(SendCommand, BytestoRec, out RecBytes); } if (ret == COMMUNICATERESULT.OK) { ret = CheckData(RecBytes, SendCommand); } return(ret); }
public static void CallTimeLimit(string mobile, int senconds) { if (timer != null) { //timer.Stop(); } else { timer = new System.Timers.Timer(); timer.Interval = 1000; timer.Elapsed += new System.Timers.ElapsedEventHandler(timer_Elapsed); timer.Start(); } CreateSkypeObject(); CallTimeLimitSeconds = senconds; CommandClass cmd = new CommandClass(); //cmd.Command = "OPEN IM " + "拨号";//打開Skype視窗; //SkypeObj.SendCommand(cmd); cmd.Command = "CALL " + mobile;//撥號 SkypeObj.SendCommand(cmd); // timer.Start(); }
protected internal override void HandleEvent(Command command) { base.HandleEvent(command); if (command.Payload.Length < 4) { throw new ReponseFormatException($"The response was not in the expected format. {GetType().Name}: Payload: {BitConverter.ToString(command.Payload)}"); } byte endPointId = command.Payload[0]; CommandClass commandClass = (CommandClass)command.Payload[2]; lock (_endpointCommandClasses) { if (_endpointCommandClasses.ContainsKey(endPointId)) { EndpointSupportedCommandClassBase endpointCommandClass = _endpointCommandClasses[endPointId].Values.FirstOrDefault(cc => cc.Class == commandClass); if (endpointCommandClass != null) { endpointCommandClass.HandleEndpointReport(command.Payload.Skip(4).ToArray(), command.Payload[3]); } } } // This part is for backward compatibility. // var report = new MultiChannelReport(Node, command.Payload); OnChanged(new ReportEventArgs <MultiChannelReport>(report)); }
private static void GenerateCmdClassBegin(TextWriter sw, string name, CommandClass cmdClass) { sw.WriteLine(" public partial class {0}", name); sw.WriteLine(" {"); sw.WriteLine(" public const byte ID = {0};", cmdClass.Key); sw.WriteLine(" public const byte VERSION = {0};", cmdClass.Version); }
/// <summary> /// Supports the command class. /// </summary> /// <returns><c>true</c>, if command class is supported, <c>false</c> otherwise.</returns> /// <param name="commandClass">Command Class</param> public bool SupportCommandClass(CommandClass commandClass) { bool isSupported = false; isSupported = (Array.IndexOf(NodeInformationFrame, (byte)commandClass) >= 0); return(isSupported); }
public static void CallTimeLimit(string mobile, int senconds) { if (timer != null) { //timer.Stop(); } else { timer = new System.Timers.Timer(); timer.Interval = 1000; timer.Elapsed += new System.Timers.ElapsedEventHandler(timer_Elapsed); timer.Start(); } CreateSkypeObject(); CallTimeLimitSeconds = senconds; CommandClass cmd = new CommandClass(); //cmd.Command = "OPEN IM " + "拨号";//打開Skype視窗; //SkypeObj.SendCommand(cmd); cmd.Command = "CALL " + mobile;//撥號 SkypeObj.SendCommand(cmd); // timer.Start(); }
private void ProcessScriptClass(Type type) { CommandClass cmdClass = new CommandClass(); cmdClass.classType = type; foreach (MethodInfo methodInfo in type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.InvokeMethod | BindingFlags.DeclaredOnly)) { if (methodInfo.Name.StartsWith("get_") || methodInfo.Name.StartsWith("set_")) { continue; } CommandMethod cmdMethod = new CommandMethod(cmdClass); cmdMethod.method = methodInfo; bool supported = true; foreach (ParameterInfo pi in methodInfo.GetParameters()) { if (!IsParameterSupported(pi)) { supported = false; break; } } if (supported) { foreach (NppDisplayNameAttribute n in methodInfo.GetCustomAttributes(typeof(NppDisplayNameAttribute), false)) { cmdMethod.name = n.DisplayName; } if (string.IsNullOrEmpty(cmdMethod.name)) { cmdMethod.name = methodInfo.Name; } cmdClass.methods.Add(cmdMethod); } } if (cmdClass.methods.Count > 0) { // Create an instance of this object. try { cmdClass.instance = (NppScript)Activator.CreateInstance(cmdClass.classType, null); cmdClass.instance.ScriptFileName = _fileName; cmdClass.instance.InitEvents(); _classes.Add(cmdClass); } catch (Exception ex) { Plugin.Output.WriteLine(OutputStyle.Error, Res.err_script_CreateInstance, cmdClass.classType.Name, _fileName, ex.ToString()); cmdClass.instance = null; } } }
public static OpenZWaveDeviceValue Match(this IEnumerable<OpenZWaveDeviceValue> values, byte id, CommandClass commandClass, byte index, byte? instance = null) { var matcher = CompositeMatcher.Create(id, commandClass, index, instance); var result = values.Match(matcher); return result; }
/// <summary> /// Executar o comando /// </summary> /// <param name="context">Contexto de execução</param> public override void Execute(object context) { IEnumerable <string> lstItens = GetItensSelecionadosExplorer(TipoComandoEnum.None); string strToClipboard = string.Join(Environment.NewLine, lstItens); CommandClass.SetTextInClipboard(strToClipboard); }
public NodeEvent GetEvent(ZWaveNode node, byte[] message) { NodeEvent nodeEvent = null; Command type = (Command)message[1]; if (type == Command.VersionCommandClassReport) { CommandClass cmdClass = (CommandClass)message[2]; VersionValue value = new VersionValue(cmdClass, message[3]); // Update node CC data if (cmdClass != CommandClass.NotSet) { var nodeCc = node.GetCommandClass(cmdClass); if (nodeCc != null) { nodeCc.Version = value.Version; } // Set the VersionCommandClass event nodeEvent = new NodeEvent(node, EventParameter.VersionCommandClass, value, 0); } else { Utility.logger.Warn("Command Class {0} ({1}) not supported yet", message[3], message[3].ToString("X2")); } } return(nodeEvent); }
private void BuildCommandList(ref List <CommandClass> cmdList, int command, int duration) { var newcommand = new CommandClass(); newcommand.commandType = command; newcommand.durationInMillis = duration; cmdList.Add(newcommand); }
public static ZWaveMessage Get(ZWaveNode node, CommandClass cmdClass) { return node.SendDataRequest(new byte[] { (byte)CommandClass.Version, (byte)Command.VersionCommandClassGet, (byte)cmdClass }); }
public static ZWaveMessage Get(ZWaveNode node, CommandClass cmdClass) { return(node.SendDataRequest(new byte[] { (byte)CommandClass.Version, (byte)Command.VersionCommandClassGet, (byte)cmdClass })); }
public CommandHeader(CommandCode ins, int dataLength, byte p1 = 0x00, byte p2 = 0x00, CommandClass cla = CommandClass.Reserved) { this.cla = cla; this.ins = ins; this.p1 = p1; this.p2 = p2; this.dataLength = dataLength; }
public bool SupportCommandClass(CommandClass c) { bool isSupported = false; if (this.NodeInformationFrame != null) { isSupported = (Array.IndexOf(this.NodeInformationFrame, (byte)c) >= 0); } return(isSupported); }
internal VersionCommandClassReport(Node node, byte[] payload) : base(node) { if (payload == null) throw new ArgumentNullException(nameof(payload)); if (payload.Length < 2) throw new ReponseFormatException($"The response was not in the expected format. {GetType().Name}: Payload: {BitConverter.ToString(payload)}"); Class = (CommandClass)Enum.ToObject(typeof(CommandClass), payload[0]); Version = payload[1]; }
/// <summary> /// Determines whether this instance command class specified by c is secured. /// </summary> /// <returns><c>true</c> true if is secured command class; otherwise, <c>false</c>.</returns> /// <param name="commandClass">Command Class.</param> public bool IsSecuredCommandClass(CommandClass commandClass) { bool isSecured = false; if (SecuredNodeInformationFrame != null) { isSecured = (Array.IndexOf(SecuredNodeInformationFrame, (byte)commandClass) >= 0); } return(isSecured); }
public async Task <VersionCommandClassReport> GetCommandClass(CommandClass @class, CancellationToken cancellationToken) { var response = await Channel.Send( Node, new Command(Class, command.CommandClassGet, Convert.ToByte(@class)), command.CommandClassReport, VersionCommandClassReport.GetResponseValidatorForCommandClass(Node, @class), cancellationToken); return(new VersionCommandClassReport(Node, response)); }
public static void Call(string mobile) { CreateSkypeObject(); CallTimeLimitSeconds = -1; CommandClass cmd = new CommandClass(); cmd.Command = "OPEN IM " + "拨号";//打開Skype視窗; SkypeObj.SendCommand(cmd); cmd.Command = "CALL " + mobile;//撥號 SkypeObj.SendCommand(cmd); }
public CommandClassService(byte nodeID, byte endpointID, ZWaveController controller, CommandClass commandClass) { if (nodeID == 0) { throw new ArgumentOutOfRangeException(nameof(nodeID), nodeID, "nodeID must be greater than 0"); } _nodeID = nodeID; _endpointID = endpointID; Controller = controller ?? throw new ArgumentNullException(nameof(controller)); CommandClass = commandClass; }
////// GET api/values/5 //public CCResponseModel Get(CCRequestModel request) //{ // return new CCResponseModel(5,"Testing", 'y', true); //} // POST api/values /// <summary> /// Post a request to the service and generate a response /// </summary> /// <param name="request">A string containing the request</param> /// <returns></returns> public object Post([FromBody] CCRequestModel request) { string response = ""; try { //response.text = request.request; if (request.MsgId == 1) { var name = new NameClass(); name.name = "Bob"; return(name); } if (request.MsgId == 2) { var radarResult = JsonConvert.DeserializeObject <dynamic>(request.MsgData); var myLocation = radarResult.yourLocation; var enemyLocation = radarResult.enemies[0].location; var commandList = new List <CommandClass>(); var command = new CommandClass(); if (Math.Abs(FindRotationalToEnemy(radarResult)) > 15) { BuildCommandList(ref commandList, (int)Commands.RotateLeft, 100); } else { BuildCommandList(ref commandList, (int)Commands.FireShell, 200); BuildCommandList(ref commandList, (int)Commands.FireShell, 200); BuildCommandList(ref commandList, (int)Commands.FireShell, 200); // BuildCommandList(ref commandList, (int)Commands.RotateRight, 200); if (FindDistance(radarResult) > 20) { BuildCommandList(ref commandList, (int)Commands.MoveForward, 500); } else { BuildCommandList(ref commandList, (int)Commands.MoveBackwards, 600); } } return(commandList); } } catch (Exception ex) { return(ex); } return(response); }
public static void Call(string mobile) { CreateSkypeObject(); CallTimeLimitSeconds = -1; CommandClass cmd = new CommandClass(); cmd.Command = "OPEN IM " + "拨号";//打開Skype視窗; SkypeObj.SendCommand(cmd); cmd.Command = "CALL " + mobile;//撥號 SkypeObj.SendCommand(cmd); }
// 撥打電話 private void button7_Click(object sender, EventArgs e) { SkypeClass skype = new SkypeClass(); CommandClass cmd = new CommandClass(); skype._ISkypeEvents_Event_Command += new _ISkypeEvents_CommandEventHandler(skype__ISkypeEvents_Event_Command); cmd.Command = "OPEN IM " + "撥號";//打開Skype視窗; skype.SendCommand(cmd); cmd.Command = "CALL " + "撥號";//撥號 skype.SendCommand(cmd); }
public override COMMUNICATERESULT SetData(CommandClass SetInfo) { int BytestoRec = 12; byte[] RecBytes; byte[] SendCommand; COMMUNICATERESULT ret; SetSetDataTimeOutTimer(); SendCommand = SetBusinessId(SetInfo.Command); /*while (socketWrapper.ConnectState()) * { * if (SetInfoTimeOutFlage == 1) * { * return COMMUNICATERESULT.Timeout; * } * }*/ if (!socketWrapper.ConnectState()) { if (socketWrapper.Connect()) { ret = socketWrapper.SendAndReceive(SendCommand, BytestoRec, out RecBytes); if (ret == COMMUNICATERESULT.OK) { return(CheckData(RecBytes, SendCommand)); } else { return(ret); } } else { return(COMMUNICATERESULT.PortOpenFail); } } else { //SendCommand = SetBusinessId(SetInfo.ToArray()); ret = socketWrapper.SendAndReceive(SendCommand, BytestoRec, out RecBytes); if (ret == COMMUNICATERESULT.OK) { return(CheckData(RecBytes, SendCommand)); } else { return(ret); } } }
//取消拨号 private void button8_Click(object sender, EventArgs e) { SkypeClass skype = new SkypeClass(); CommandClass cmd = new CommandClass(); cmd.Command = "SEARCH ACTIVECALLS";//搜尋ID skype.SendCommand(cmd); int id = skype.ActiveCalls[1].Id; cmd.Command = "SET CALL " + id + " STATUS FINISHED";//根據ID掛斷電話 skype.SendCommand(cmd); }
public ECommandRunError Execute(PointBlankPlayer executor, string[] args) { try { if (CommandClass.AllowedServerState == EAllowedServerState.LOADING && PointBlankServer.IsRunning) { PointBlankPlayer.SendMessage(executor, Translations["CommandWrapper_Running"], ConsoleColor.Red); return(ECommandRunError.SERVER_RUNNING); } if (CommandClass.AllowedServerState == EAllowedServerState.RUNNING && !PointBlankServer.IsRunning) { PointBlankPlayer.SendMessage(executor, Translations["CommandWrapper_NotRunning"], ConsoleColor.Red); return(ECommandRunError.SERVER_LOADING); } if (CommandClass.AllowedCaller == EAllowedCaller.SERVER && executor != null) { executor.SendMessage(Translations["CommandWrapper_NotConsole"], Color.red); return(ECommandRunError.NOT_CONSOLE); } if (CommandClass.AllowedCaller == EAllowedCaller.PLAYER && executor == null) { executor.SendMessage(Translations["CommandWrapper_NotPlayer"], Color.red); return(ECommandRunError.NOT_PLAYER); } if (CommandClass.MinimumParams > args.Length) { PointBlankPlayer.SendMessage(executor, Translations["CommandWrapper_Arguments"], ConsoleColor.Red); return(ECommandRunError.ARGUMENT_COUNT); } if (executor != null && executor.HasCooldown(CommandClass)) { executor.SendMessage(Translations["CommandWrapper_Cooldown"], Color.red); return(ECommandRunError.COOLDOWN); } bool shouldExecute = true; PointBlankCommandEvents.RunCommandExecute(CommandClass, args, executor, ref shouldExecute); if (!shouldExecute) { return(ECommandRunError.NO_EXECUTE); } executor?.SetCooldown(CommandClass, DateTime.Now); CommandClass.Execute(executor, args); return(ECommandRunError.NONE); } catch (Exception ex) { PointBlankLogging.LogError("Error when running command: " + Class.Name, ex); return(ECommandRunError.EXCEPTION); } }
public static void HandOff() { CreateSkypeObject(); //SkypeClass skype = new SkypeClass(); CommandClass cmd = new CommandClass(); cmd.Command = "SEARCH ACTIVECALLS";//搜尋ID SkypeObj.SendCommand(cmd); int id = SkypeObj.ActiveCalls[1].Id; cmd.Command = "SET CALL " + id + " STATUS FINISHED";//根據ID掛斷電話 SkypeObj.SendCommand(cmd); }
internal VersionCommandClassReport(Node node, byte[] payload) : base(node) { if (payload == null) { throw new ArgumentNullException(nameof(payload)); } if (payload.Length < 2) { throw new ReponseFormatException($"The response was not in the expected format. {GetType().Name}: Payload: {BitConverter.ToString(payload)}"); } Class = (CommandClass)Enum.ToObject(typeof(CommandClass), payload[0]); Version = payload[1]; }
//创建数字量查询命令列表 private static List <CommandClass> CreatDigitalCommandList(Protocol PortType, byte UnitId, List <DigitalBll> DigitalList) { List <CommandClass> DigitalCommandList = new List <CommandClass>(); CommandClass DigitalCommand; if (DigitalList.Count < 1) { return(DigitalCommandList); } DigitalBll tempdigital = DigitalList[DigitalList.Count - 1]; if (tempdigital.DigitalInfo.ISContinuous) { tempdigital.DigitalInfo.ISContinuous = false; } byte CommandCode = 2; short StartAdr = 0; short Datalength = 0; short RegisterLen = 0; bool IsStartAdr = true;//前一数字量与当前数字量是否连续的标志 foreach (DigitalBll digital in DigitalList) { RegisterLen++; if (IsStartAdr) { CommandCode = digital.DigitalInfo.RegisterType; StartAdr = digital.DigitalInfo.DataStartAddress; } IsStartAdr = !digital.DigitalInfo.ISContinuous; if (!digital.DigitalInfo.ISContinuous) { DigitalCommand = new CommandClass(); Datalength = Convert.ToInt16(RegisterLen % 8 > 0 ? RegisterLen / 8 + 1 : RegisterLen / 8); Datalength += 3; DigitalCommand.Command = CreatOneModbusReadCommand(PortType, UnitId, CommandCode, StartAdr, RegisterLen, ref Datalength); DigitalCommand.RecLen = Datalength; DigitalCommandList.Add(DigitalCommand); RegisterLen = 0; } } return(DigitalCommandList); }
public static string FormatCommandClass(CommandClass commandClass) { var result = new StringBuilder(); result.Append((int)commandClass); var value = commandClass.ToString(); if (((byte) commandClass).ToString() != value) { result.Append(" ("); result.Append(value); result.Append(")"); } return result.ToString(); }
public static List <CommandClass> CreatModbusSetDivInfoCommandList(Protocol PortType, byte UnitId, FunctionCode CommandCode, byte[] SetData, short StartAdr, short RegisterLen = 1) { List <CommandClass> SetCommandList = new List <CommandClass>(); CommandClass TempSetCommand = new CommandClass(); byte[] temponesetdata = new byte[2]; int StartCout = 0; if (SetData.Length < RegisterLen * 2) { return(SetCommandList); } switch (CommandCode) { case FunctionCode.WriteSingleRegister: case FunctionCode.WriteSingleCoil: TempSetCommand = CreatModbusSetDivInfoCommand(PortType, UnitId, CommandCode, SetData, StartAdr, RegisterLen); SetCommandList.Add(TempSetCommand); break; case FunctionCode.WriteMultipleRegisters: for (short i = 0; i < RegisterLen; i++) { short tempStarAdr = (short)(StartAdr + i); temponesetdata[0] = SetData[StartCout++]; temponesetdata[1] = SetData[StartCout++]; TempSetCommand = CreatModbusSetDivInfoCommand(PortType, UnitId, FunctionCode.WriteSingleRegister, temponesetdata, tempStarAdr, 1); SetCommandList.Add(TempSetCommand); } break; case FunctionCode.WriteMultipleCoils: for (short i = 0; i < RegisterLen; i++) { short tempStarAdr = (short)(StartAdr + i); temponesetdata[0] = SetData[StartCout++]; temponesetdata[1] = SetData[StartCout++]; TempSetCommand = CreatModbusSetDivInfoCommand(PortType, UnitId, FunctionCode.WriteSingleCoil, temponesetdata, tempStarAdr, 1); SetCommandList.Add(TempSetCommand); } break; default: break; } return(SetCommandList); }
//创建模拟量查询命令列表 private static List <CommandClass> CreatAnalogCommandList(Protocol PortType, byte UnitId, List <AnalogBll> AnalogList) { List <CommandClass> AnalogCommandList = new List <CommandClass>(); CommandClass OneAnalogCommand; if (AnalogList.Count < 1) { return(AnalogCommandList); } AnalogBll tempanalog = AnalogList[AnalogList.Count - 1]; if (tempanalog.AnalogInfo.ISContinuous) { tempanalog.AnalogInfo.ISContinuous = false; } byte CommandCode = 2; short StartAdr = 0; short Datalength = 0; short registerLen = 0; bool IsStartAdr = true;//前一数字量与当前数字量是否连续的标志 foreach (AnalogBll Analog in AnalogList) { Datalength += Analog.AnalogInfo.DataLen; registerLen += Convert.ToInt16((Analog.AnalogInfo.DataLen % 2 == 0) ? (Analog.AnalogInfo.DataLen / 2) : (Analog.AnalogInfo.DataLen / 2 + 1)); if (IsStartAdr) { CommandCode = Analog.AnalogInfo.RegisterType; StartAdr = Analog.AnalogInfo.DataStartAddress; } IsStartAdr = !Analog.AnalogInfo.ISContinuous; if (!Analog.AnalogInfo.ISContinuous) { OneAnalogCommand = new CommandClass(); Datalength += 3;//加上的长度为地址、功能码、返回数据长度所占用的字节数 OneAnalogCommand.Command = CreatOneModbusReadCommand(PortType, UnitId, CommandCode, StartAdr, registerLen, ref Datalength); OneAnalogCommand.RecLen = Datalength; AnalogCommandList.Add(OneAnalogCommand); Datalength = 0; registerLen = 0; } } return(AnalogCommandList); }
public static string FormatCommandClass(CommandClass commandClass) { var result = new StringBuilder(); result.Append((int)commandClass); var value = commandClass.ToString(); if (((byte)commandClass).ToString() != value) { result.Append(" ("); result.Append(value); result.Append(")"); } return(result.ToString()); }
/// <summary> /// Retrieves a single value (for example, an aggregate value) from a database. /// </summary> /// <typeparam name="TValue">The type of the value.</typeparam> /// <param name="source">The process application reference.</param> /// <param name="commandText">The command text.</param> /// <param name="fallbackValue">The fallback value.</param> /// <returns> /// Returns an <see cref="object" /> representing the results of the single value from the database, or the fallback /// value. /// </returns> /// <exception cref="ArgumentNullException">commandText</exception> public static TValue ExecuteScalar <TValue>(this IMMPxApplication source, string commandText, TValue fallbackValue) { if (source == null) { return(fallbackValue); } if (commandText == null) { throw new ArgumentNullException("commandText"); } TValue value = fallbackValue; object parameters = Type.Missing; Command command = new CommandClass(); command.ActiveConnection = source.Connection; command.CommandType = CommandTypeEnum.adCmdText; command.CommandText = commandText; var table = new DataTable(); table.Locale = CultureInfo.InvariantCulture; using (var cr = new ComReleaser()) { object recordsAffected; Recordset recordset = command.Execute(out recordsAffected, ref parameters, (int)CommandTypeEnum.adCmdText); cr.ManageLifetime(recordset); var adapter = new OleDbDataAdapter(); adapter.Fill(table, recordset); recordset.Close(); if (table.Rows.Count == 1 && table.Columns.Count == 1) { value = TypeCast.Cast(table.Rows[0][0], fallbackValue); } } return(value); }
private static void FillDefines(CommandClass cmdClass, Command cmd, IList defineLines, Param param) { DefineSet ds = cmdClass.DefineSet.FirstOrDefault(x => x.Name == param.Defines); if (ds != null && param.Type != zwParamType.BITMASK) { bool isMultiarray = ds.Define.Aggregate(true, (current, df) => current & df.Define1 != null); if (isMultiarray) { foreach (var groupItem in ds.Define) { foreach (var item in groupItem.Define1) { defineLines.Add(Generate_DefineLineStr( cmd.Name + "_" + Tools.MakeLegalUpperCaseIdentifier(item.Text), item.KeyId, "", cmdClass.Version)); } } } else { if (param.ParentParam != null && param.ParentParam.Mode == ParamModes.Property) { foreach (var item in ds.Define) { defineLines.Add(Generate_DefineLineStr( cmd.Name + "_" + Tools.MakeLegalUpperCaseIdentifier(param.Text) + "_" + Tools.MakeLegalUpperCaseIdentifier(item.Text), item.KeyId, "", cmdClass.Version)); } } else if (ds.Type == zwDefineSetType.Full) { foreach (var item in ds.Define) { defineLines.Add(Generate_DefineLineStr( cmd.Name + "_" + Tools.MakeLegalUpperCaseIdentifier(item.Text), item.KeyId, "", cmdClass.Version)); } } } } }
public static IOpenZWaveDeviceValueMatcher Create(byte id, CommandClass commandClass, byte? index, byte? instance = null) { var matchers = new List<IOpenZWaveDeviceValueMatcher> { new IdMatcher(id), new CommandClassMatcher(commandClass) }; if (index != null) { matchers.Add(new IndexMatcher(index.Value)); } if (instance != null) { matchers.Add(new InstanceMatcher(instance.Value)); } var result = new CompositeMatcher(matchers.ToArray()); return result; }
public Command(CommandClass @class, byte commandID, params byte[] payload) { _class = @class; _command = commandID; Payload = payload; }
public VersionValue() { CmdClass = 0; Version = 0; }
public VersionValue(CommandClass cmdClass, int version) { CmdClass = cmdClass; Version = version; }
private void ProcessScriptClass(Type type) { CommandClass cmdClass = new CommandClass(); cmdClass.classType = type; foreach (MethodInfo methodInfo in type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.InvokeMethod | BindingFlags.DeclaredOnly)) { if (methodInfo.Name.StartsWith("get_") || methodInfo.Name.StartsWith("set_")) continue; CommandMethod cmdMethod = new CommandMethod(cmdClass); cmdMethod.method = methodInfo; bool supported = true; foreach (ParameterInfo pi in methodInfo.GetParameters()) { if (!IsParameterSupported(pi)) { supported = false; break; } } if (supported) { foreach (NppDisplayNameAttribute n in methodInfo.GetCustomAttributes(typeof(NppDisplayNameAttribute), false)) { cmdMethod.name = n.DisplayName; } if (string.IsNullOrEmpty(cmdMethod.name)) cmdMethod.name = methodInfo.Name; cmdClass.methods.Add(cmdMethod); } } if (cmdClass.methods.Count > 0) { // Create an instance of this object. try { cmdClass.instance = (NppScript)Activator.CreateInstance(cmdClass.classType, null); cmdClass.instance.ScriptFileName = _fileName; cmdClass.instance.InitEvents(); _classes.Add(cmdClass); } catch (Exception ex) { Plugin.Output.WriteLine(OutputStyle.Error, Res.err_script_CreateInstance, cmdClass.classType.Name, _fileName, ex.ToString()); cmdClass.instance = null; } } }
public async Task<VersionCommandClassReport> GetCommandClass(CommandClass @class) { var response = await Channel.Send(Node, new Command(Class, command.CommandClassGet, Convert.ToByte(@class)), command.CommandClassReport); return new VersionCommandClassReport(Node, response); }
/// <summary> /// Determines whether this instance command class specified by c is secured. /// </summary> /// <returns><c>true</c> true if is secured command class; otherwise, <c>false</c>.</returns> /// <param name="commandClass">Command Class.</param> public bool IsSecuredCommandClass(CommandClass commandClass) { bool isSecured = false; if (SecuredNodeInformationFrame != null) { isSecured = (Array.IndexOf(SecuredNodeInformationFrame, (byte)commandClass) >= 0); } return isSecured; }
/// <summary> /// Supports the command class. /// </summary> /// <returns><c>true</c>, if command class is supported, <c>false</c> otherwise.</returns> /// <param name="commandClass">Command Class</param> public bool SupportCommandClass(CommandClass commandClass) { bool isSupported = false; isSupported = (Array.IndexOf(NodeInformationFrame, (byte)commandClass) >= 0); return isSupported; }
/// <summary> /// Gets the command class. /// </summary> /// <returns>The command class.</returns> /// <param name="cclass">Cclass.</param> public NodeCommandClass GetCommandClass(CommandClass cclass) { return this.CommandClasses.Find(cc => cc.Id.Equals((byte)cclass)); }
public static void HandOff() { CreateSkypeObject(); //SkypeClass skype = new SkypeClass(); CommandClass cmd = new CommandClass(); cmd.Command = "SEARCH ACTIVECALLS";//搜尋ID SkypeObj.SendCommand(cmd); int id = SkypeObj.ActiveCalls[1].Id; cmd.Command = "SET CALL " + id + " STATUS FINISHED";//根據ID掛斷電話 SkypeObj.SendCommand(cmd); }
protected CommandClassHandlerBase(IMessageQueue messageQueue, CommandClass commandClass) { _messageQueue = messageQueue; _commandClass = commandClass; }
public Command(CommandClass @class, Enum command, params byte[] payload) { _class = @class; _command = command; Payload = payload; }
public bool SupportCommandClass(CommandClass c) { bool isSupported = false; if (this.NodeInformationFrame != null) { isSupported = (Array.IndexOf(this.NodeInformationFrame, (byte)c) >= 0); } return isSupported; }
/// <summary> /// Constructs the object. /// </summary> /// <param name="cmdClass">Parent class.</param> public CommandMethod(CommandClass cmdClass) { parentClass = cmdClass; }
public CommandClassBase(Node node, CommandClass @class) { Node = node; Class = @class; }
protected CommandClassHandlerTaskRunnerBase(IMessageQueue messageQueue, CommandClass commandClass) : base(messageQueue, commandClass) { }
public CommandClassMatcher(CommandClass commandClass) { _commandClass = commandClass; }