Example #1
0
 public static byte[] SetCanMode(int bus, CanMode mode)
 {
     if (bus < 1 || bus > MAX_BUS)
     {
         throw new Exception("Invalid Bus");
     }
     return(new byte[] { CMD_SYSTEM, 0x0A, (byte)bus, (byte)mode });
 }
        public async Task SetCanMode(int bus, CanMode mode)
        {
            var res = await Serial.JsonCommand(CBTCommand.SetCanMode(bus, mode));

            if (!res.ContainsKey("mode") || res["mode"] != Enum.GetName(typeof(CanMode), mode))
            {
                throw new Exception("Error changing CAN mode.");
            }
        }
Example #3
0
 public static byte[] SetCanMode(int bus, CanMode mode)
 {
     if (bus < 1 || bus > MAX_BUS) throw new Exception("Invalid Bus");
     return new byte[] { CMD_SYSTEM, 0x0A, (byte)bus, (byte)mode };
 }
 public async Task SetCanMode(int bus, CanMode mode)
 {
     var res = await Serial.JsonCommand(CBTCommand.SetCanMode(bus, mode));
     if (!res.ContainsKey("mode") || res["mode"] != Enum.GetName(typeof(CanMode), mode))
         throw new Exception("Error changing CAN mode.");
 }