internal static void ExecuteShutterCommand(byte shutterAddr, ProtocolCommands cmd) { Switch.bus = new BusInterface(); bus.CreateHeader(DeviceCategories.DEV_CAT_MASTER, 0, DeviceCategories.DEV_CAT_SHUTTER, shutterAddr); bus.AppendPayload((byte)cmd); bus.SendPacket(); }
public static string BCacheRemove(string cacheId) { if (!String.IsNullOrWhiteSpace(cacheId)) { ProtocolCommands.RemoveCache(cacheId); return("Cache: " + cacheId + " removed."); } return("Error: bad cache name."); }
public static string BCacheDump(string cacheId, string fileName) { BabelMessageDataCache d = ProtocolCommands.GetCache(cacheId); if (d != null) { string header = ""; //TODO: generate header. return(d.DumpToFile(fileName, true, header)); } return("Error: unable to get cache."); }
public BabelMessageDataCache(String exchangeName, int messageId, bool useThread = true, bool hasTimeData = true, int cacheSize = 10000) : base(exchangeName, useThread, hasTimeData, true, cacheSize) { init(); ExchangeName = exchangeName; MessageId = messageId; ProtocolCommands.AddCache(this); if (Task != null) { Task.Start(); } }
private RequestProtocol FillProtocol(ProtocolCommands cmd, UInt16 registerNumber, UInt16 registersToRead, UInt32 dataToWrite) { RequestProtocol protocol = new RequestProtocol(); protocol.DeviceNumber = m_DeviceNumber; protocol.CMD = (Byte)cmd; protocol.RegisterNumber = registerNumber; protocol.RegistersToRead = registersToRead; protocol.DataToWrite = dataToWrite; CalcCrc8(ref protocol); return(protocol); }
public BabelMessageDataCache(XmlNode node) : base(node) { init(); XmlNode c = Project.GetChildNode(node, "datacache"); if (c != null) { ExchangeName = Project.GetNodeAttributeValue(c, "exchangename", ""); MessageId = Convert.ToInt32(Project.GetNodeAttributeValue(c, "messageid", "1")); } ProtocolCommands.AddCache(this); if (Task != null) { Task.Start(); } }
public override void Close() { ProtocolCommands.RemoveCache(GetCacheId()); base.Close(); }
protected override bool CloseProject() { ProtocolCommands.CloseProject(); return(false); }
protected override bool StartProject() { ProtocolCommands.StartProject(); return(false); }
public Byte[] GetCommand(ProtocolCommands cmd) { return(SerealizeProtocol(FillProtocol(cmd, 0, 0, 0))); }