Пример #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 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));
                             }
                         }
                     }
                 }
             }
         }
     }
 }