示例#1
0
 public static IEnumerable <byte> GetParcel_SetAddress(int addr, bool forCommonAddr, bool answerEn = true)
 {
     return(GetParcel((byte)OwnAddress, forCommonAddr ? BroadcastAddr : DefaultAddr, (byte)RepeatQuantity, answerEn, TbCommands.SetAddress((byte)addr)));
 }
示例#2
0
 public static IEnumerable <byte> GetParcel_SetClock(DateTime dt, bool answerEn = true)
 {
     return(GetParcel((byte)OwnAddress, BroadcastAddr, (byte)RepeatQuantity, answerEn, TbCommands.SetClock(dt)));
 }
示例#3
0
 public static IEnumerable <byte> GetParcel_SetClock(int dayOfWeek, int hours, int minutes, bool answerEn = true)
 {
     return(GetParcel((byte)OwnAddress, BroadcastAddr, (byte)RepeatQuantity, answerEn, TbCommands.SetClock(dayOfWeek, hours, minutes)));
 }
示例#4
0
 public static IEnumerable <byte> GetParcel_GetAddress()
 {
     return(GetParcel((byte)OwnAddress, BroadcastAddr, (byte)RepeatQuantity, true, TbCommands.GetAddress()));
 }
示例#5
0
 public static IEnumerable <byte> GetParcel_GetSensors(int addr)
 {
     return(GetParcel((byte)OwnAddress, (byte)addr, (byte)RepeatQuantity, true, TbCommands.GetSensors()));
 }
示例#6
0
 public static IEnumerable <byte> GetParcel_ChangeOut(int addr, int number, int value, bool answerEn = true)
 {
     return(GetParcel((byte)OwnAddress, (byte)addr, (byte)RepeatQuantity, answerEn, TbCommands.ChangeOutput((byte)number, (byte)value)));
 }
示例#7
0
 public static IEnumerable <byte> GetParcel_ChangeRepeater(int addr, bool isSetRepeater, bool answerEn = true)
 {
     return(GetParcel((byte)OwnAddress, (byte)addr, (byte)RepeatQuantity, answerEn, TbCommands.ChangeRepeater((byte)(isSetRepeater ? 1 : 0))));
 }
示例#8
0
 public static void TestCrc(Action <byte, IEnumerable <byte> > afterGetCrc)
 {
     for (byte fromAddr = 1; fromAddr < 5; ++fromAddr)
     {
         for (byte toAddr = 1; toAddr < 50; ++toAddr)
         {
             for (byte repeatCount = 0; repeatCount < 10; ++repeatCount)
             {
                 for (byte answerEn = 0; answerEn < 2; ++answerEn)
                 {
                     for (byte setAddr = 0; setAddr < 100; ++setAddr)
                     {
                         Test_GetCrc(afterGetCrc, fromAddr, toAddr, repeatCount, answerEn, TbCommands.SetAddress(setAddr));
                     }
                     for (byte setOut = 1; setOut < 30; ++setOut)
                     {
                         for (byte outputValue = 0; outputValue < 100; ++outputValue)
                         {
                             Test_GetCrc(afterGetCrc, fromAddr, toAddr, repeatCount, answerEn, TbCommands.ChangeOutput(setOut, outputValue));
                         }
                     }
                     for (byte setD = 1; setD < 8; ++setD)
                     {
                         for (byte setHour = 0; setHour < 24; ++setHour)
                         {
                             for (byte setMin = 0; setMin < 60; ++setMin)
                             {
                                 Test_GetCrc(afterGetCrc, fromAddr, toAddr, repeatCount, answerEn, TbCommands.SetClock(setD, setHour, setMin));
                             }
                         }
                     }
                 }
             }
         }
     }
 }