コード例 #1
0
 /// <summary>
 /// Constructs an encoded command frame.
 /// </summary>
 /// <param name="commandCode">
 /// Command code. See <see cref="CommandCodes"/>.
 /// </param>
 /// <returns>
 /// Constructed and encoded command frame.
 /// </returns>
 public static byte[] ConstructCommandFrame(CommandCodes commandCode)
 {
     byte[] decodedFrame = new byte[12] {
         (byte)FrameStart.Sart1, (byte)FrameStart.Start2, (byte)commandCode, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, (byte)FrameStop.Stop1, (byte)FrameStop.Stop2
     };
     decodedFrame = InsertChecksum(decodedFrame);
     return(FrameEncoding.EncodeFrame(decodedFrame));
 }
コード例 #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="configData"></param>
 /// <returns></returns>
 public static byte[] ConstructWriteConfigDataFrame(FrameConfigDataModel configData)
 {
     byte[] decodedFrame = new byte[12] {
         (byte)FrameStart.Sart1, (byte)FrameStart.Start2, (byte)configData.Address, 0x04, (byte)(configData.Data1_2 >> 8), (byte)(configData.Data1_2 & 0x00FF), (byte)(configData.Data3_4 >> 8), (byte)(configData.Data3_4 & 0x00FF), 0x00, 0x00, (byte)FrameStop.Stop1, (byte)FrameStop.Stop2
     };
     // TODO : ajouter dans la trame l'id et les datas
     decodedFrame = InsertChecksum(decodedFrame);
     return(FrameEncoding.EncodeFrame(decodedFrame));
 }
コード例 #3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="exerciceData"></param>
 /// <returns></returns>
 public static byte[] ConstructWriteExerciceDataFrame(FrameExerciceDataModel exerciceData)
 {
     byte[] decodedFrame = new byte[12] {
         (byte)FrameStart.Sart1, (byte)FrameStart.Start2, (byte)exerciceData.Address, 0x04, exerciceData.Data1, exerciceData.Data2, exerciceData.Data3, exerciceData.Data4, 0x00, 0x00, (byte)FrameStop.Stop1, (byte)FrameStop.Stop2
     };
     // TODO : ajouter dans la trame l'id et les datas
     decodedFrame = InsertChecksum(decodedFrame);
     return(FrameEncoding.EncodeFrame(decodedFrame));
 }