Beispiel #1
0
 internal void AssertAvailable(AmpsCommand command)
 {
     if (map[(int)command] == null)
     {
         throw new NotImplementedException(command.ToString());
     }
 }
Beispiel #2
0
        public void WriteHeader(AmpsCommand command)
        {
            var commandBytes = CommandMap.Default.GetBytes(command);

            if (commandBytes == null)
            {
                throw new NotImplementedException();
            }

            lock (sync)
            {
                foreach (var commandByte in commandBytes)
                {
                    serialPort.BaseStream.WriteByte(commandByte);
                }
            }
        }
        public void WriteHeader(AmpsCommand command)
        {
            var commandBytes = CommandMap.Default.GetBytes(command);

            if (commandBytes == null)
            {
                throw new NotImplementedException();
            }

            lock (sync)
            {
                uint bytesWritten = 0;
                while (bytesWritten < commandBytes.Length)
                {
                    ftdi.Write(commandBytes, commandBytes.Length, ref bytesWritten);
                }
            }
        }
Beispiel #4
0
 internal bool IsAvailable(AmpsCommand command)
 {
     return(map[(int)command] != null);
 }
Beispiel #5
0
 internal byte[] GetBytes(AmpsCommand command)
 {
     return(map[(int)command]);
 }
Beispiel #6
0
 public CommandMessage(AmpsCommand command) : base(command)
 {
 }
Beispiel #7
0
 public CommandBase(AmpsCommand command) : base(command)
 {
 }
Beispiel #8
0
 public static Message Create(AmpsCommand command, int value, int value2)
 {
     return(new CommandValueValueMessage(command, value, value2));
 }
Beispiel #9
0
 public CommandValueMessage(AmpsCommand command, double value) : base(command)
 {
     this.value = Encoding.ASCII.GetBytes(value.ToString());
 }
Beispiel #10
0
 public static Message Create(AmpsCommand command, double value)
 {
     return(new CommandValueMessage(command, value));
 }
Beispiel #11
0
 public static Message Create(AmpsCommand command)
 {
     return(new CommandMessage(command));
 }
Beispiel #12
0
 public static Message Create(AmpsCommand command, AmpsSignalTable table)
 {
     return(new CommandSignalTableMessage(command, table));
 }
Beispiel #13
0
 public CommandSignalTableMessage(AmpsCommand command, AmpsSignalTable signalTable) : base(command)
 {
     this.value = Encoding.ASCII.GetBytes(signalTable.RetrieveTableAsEncodedString());
 }
Beispiel #14
0
 protected Message(AmpsCommand command)
 {
     this.command     = command;
     createdDateTime  = DateTime.UtcNow;
     createdTimestamp = System.Diagnostics.Stopwatch.GetTimestamp();
 }
Beispiel #15
0
 public CommandValueMessage(AmpsCommand command, string value) : base(command)
 {
     this.value = Encoding.ASCII.GetBytes(value);
 }
Beispiel #16
0
 public static Message Create(AmpsCommand command, string value1, string value2)
 {
     return(new CommandValueValueMessage(command, value1, value2));
 }
Beispiel #17
0
 public CommandValueValueMessage(AmpsCommand command, string value1, string value2) : base(command)
 {
     this.value1 = Encoding.ASCII.GetBytes(value1.ToString());
     this.value2 = Encoding.ASCII.GetBytes(value2.ToString());
 }