Example #1
0
 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();
 }
Example #2
0
 public static string BCacheRemove(string cacheId)
 {
     if (!String.IsNullOrWhiteSpace(cacheId))
     {
         ProtocolCommands.RemoveCache(cacheId);
         return("Cache: " + cacheId + " removed.");
     }
     return("Error: bad cache name.");
 }
Example #3
0
        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.");
        }
Example #4
0
 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);
        }
Example #6
0
        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();
            }
        }
Example #7
0
 public override void Close()
 {
     ProtocolCommands.RemoveCache(GetCacheId());
     base.Close();
 }
Example #8
0
 protected override bool CloseProject()
 {
     ProtocolCommands.CloseProject();
     return(false);
 }
Example #9
0
 protected override bool StartProject()
 {
     ProtocolCommands.StartProject();
     return(false);
 }
 public Byte[] GetCommand(ProtocolCommands cmd)
 {
     return(SerealizeProtocol(FillProtocol(cmd, 0, 0, 0)));
 }