|
@@ -7,6 +7,8 @@ using System.Threading.Tasks;
|
|
|
|
|
|
using uint16_t = System.UInt16;
|
|
using uint16_t = System.UInt16;
|
|
using uint8_t = System.Byte;
|
|
using uint8_t = System.Byte;
|
|
|
|
+using int16_t = System.Int16;
|
|
|
|
+using int8_t = System.SByte;
|
|
|
|
|
|
namespace WpfTest1.ComAgent
|
|
namespace WpfTest1.ComAgent
|
|
{
|
|
{
|
|
@@ -118,10 +120,22 @@ namespace WpfTest1.ComAgent
|
|
|
|
|
|
public static byte[] buff(this int i) => BitConverter.GetBytes(i);
|
|
public static byte[] buff(this int i) => BitConverter.GetBytes(i);
|
|
public static byte[] buff(this uint i) => BitConverter.GetBytes(i);
|
|
public static byte[] buff(this uint i) => BitConverter.GetBytes(i);
|
|
- public static byte[] buff(this uint16_t i) => BitConverter.GetBytes(i);
|
|
|
|
- public static byte[] buff(this short i) => BitConverter.GetBytes(i);
|
|
|
|
public static byte[] buff(this uint8_t i) => i.pack();
|
|
public static byte[] buff(this uint8_t i) => i.pack();
|
|
|
|
|
|
|
|
+ public static byte[] buff(this uint16_t i)
|
|
|
|
+ {
|
|
|
|
+ byte[] buff = BitConverter.GetBytes(i);
|
|
|
|
+ Array.Reverse(buff);
|
|
|
|
+ return buff;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public static byte[] buff(this int16_t i)
|
|
|
|
+ {
|
|
|
|
+ byte[] buff = BitConverter.GetBytes(i);
|
|
|
|
+ Array.Reverse(buff);
|
|
|
|
+ return buff;
|
|
|
|
+ }
|
|
|
|
+
|
|
public static uint8_t[] packData(this uint8_t[] inputData)
|
|
public static uint8_t[] packData(this uint8_t[] inputData)
|
|
{
|
|
{
|
|
uint8_t[] data = pack0x10(inputData);
|
|
uint8_t[] data = pack0x10(inputData);
|