public static UInt16 Get(BasicTypeDeSerializerContext context, UInt16 data) { data = Get(context); data <<= 8; data |= Get(context); return data; }
public static UInt16 Get(BasicTypeDeSerializerContext context, UInt16 data) { data = Get(context); data <<= 8; data |= Get(context); return(data); }
public static Int16 Get(BasicTypeDeSerializerContext context, Int16 data) { UInt16 temp; temp = Get(context); temp <<= 8; temp |= Get(context); return (Int16)temp; }
public void Get(BasicTypeDeSerializerContext context) { An = BasicTypeDeSerializer.Get(context, An); Bn = BasicTypeDeSerializer.Get(context, Bn); Cn = BasicTypeDeSerializer.Get(context, Cn); Dn = BasicTypeDeSerializer.Get(context, Dn); En = BasicTypeDeSerializer.Get(context, En); Fn = BasicTypeDeSerializer.Get(context, Fn); Divider = BasicTypeDeSerializer.Get(context, Divider); }
public static Int16 Get(BasicTypeDeSerializerContext context, Int16 data) { UInt16 temp; temp = Get(context); temp <<= 8; temp |= Get(context); return((Int16)temp); }
public static Int32 Get(BasicTypeDeSerializerContext context, Int32 data) { data = Get(context); data <<= 8; data |= Get(context); data <<= 8; data |= Get(context); data <<= 8; data |= Get(context); return(data); }
public static Int32 Get(BasicTypeDeSerializerContext context, Int32 data) { data = Get(context); data <<= 8; data |= Get(context); data <<= 8; data |= Get(context); data <<= 8; data |= Get(context); return data; }
public VirtualCanvas(TouchEventHandler touchEventHandler, WidgetClickedHandler widgetClickedHandler) { TrackOrientation(Orientation.Portrait); _spiRxBuffer = new byte[MaxSpiRxBufferSize]; SendContext = new BasicTypeSerializerContext(MaxSpiTxBufferSize, SpiTxBufferHighWatermark, OnCanvasBufferNearlyFull); ReceiveContext = new BasicTypeDeSerializerContext(); GoBusIrqEvent = new ManualResetEvent(false); RegisteredWidgets = new ArrayList(); if (widgetClickedHandler != null) { WidgetClicked += widgetClickedHandler; } if (touchEventHandler != null) { Touch += touchEventHandler; } }
public static byte[] Get(BasicTypeDeSerializerContext context, byte[] bytes) { ushort length = 0; length = Get(context, length); if (length != 0) { var buffer = new byte[length]; var index = 0; while (length-- != 0) { buffer[index++] = Get(context); } return(buffer); } return(null); }
public static unsafe float Get(BasicTypeDeSerializerContext context, float data) { var temp = new byte[4]; if (context.IsLittleEndian) { // Reverse the buffer going from Big Endian (network byte order) to Little Endian temp[3] = context.Retrieve(); temp[2] = context.Retrieve(); temp[1] = context.Retrieve(); temp[0] = context.Retrieve(); } else { // Already in Big Endian format temp[0] = context.Retrieve(); temp[1] = context.Retrieve(); temp[2] = context.Retrieve(); temp[3] = context.Retrieve(); } UInt32 value = Utility.ExtractValueFromArray(temp, 0, 4); return *((float*)&value); }
public static UInt64[] Get(BasicTypeDeSerializerContext context, UInt64[] array) { ushort length = 0; length = Get(context, length); if (length != 0) { var buffer = new UInt64[length]; var index = 0; UInt64 data = 0; while (length-- != 0) { buffer[index++] = Get(context, data); } return(buffer); } return(null); }
public static void CalibrateTouchscreen(NwazetGoImaging.VirtualCanvas canvas) { try { var sd = new NwazetGoSD.SDCardReader(); sd.Initialize(GoSockets.Socket8); var calibrationDataFilename = @"SD\TouchscreenCalibration.bin"; // If the touchscreen calibration data was previously retrieved from the display module and was stored to an SD card, // the calibration data can be sent to the display module instead of calling TouchscreenCalibration() before using // the touchscreen for the first time. if (File.Exists(calibrationDataFilename)) { using (var calibrationDataFile = new FileStream(calibrationDataFilename, FileMode.Open)) { var context = new NwazetGoHelpers.BasicTypeDeSerializerContext(calibrationDataFile); var matrix = new NwazetGoDisplayTouchScreen.CalibrationMatrix(); matrix.Get(context); canvas.SetTouchscreenCalibrationMatrix(matrix); } } else { // No pre-existing calibration data, create it... using (var calibrationDataFile = new FileStream(calibrationDataFilename, FileMode.Create)) { var matrix = canvas.GetTouchscreenCalibrationMatrix(); var context = new NwazetGoHelpers.BasicTypeSerializerContext(calibrationDataFile); matrix.Put(context); } } sd.Dispose(); } catch (Exception) { Debug.Print("SD Card or file I/O error: manual calibration required."); canvas.TouchscreenCalibration(); } }
public static unsafe float Get(BasicTypeDeSerializerContext context, float data) { var temp = new byte[4]; if (context.IsLittleEndian) { // Reverse the buffer going from Big Endian (network byte order) to Little Endian temp[3] = context.Retrieve(); temp[2] = context.Retrieve(); temp[1] = context.Retrieve(); temp[0] = context.Retrieve(); } else // Already in Big Endian format { temp[0] = context.Retrieve(); temp[1] = context.Retrieve(); temp[2] = context.Retrieve(); temp[3] = context.Retrieve(); } UInt32 value = Utility.ExtractValueFromArray(temp, 0, 4); return(*((float *)&value)); }
public static string Get(BasicTypeDeSerializerContext context, string text) { byte IsASCII = 0; IsASCII = Get(context); ushort length = 0; length = Get(context, length); if (length != 0) { if (IsASCII == 1) { var bytes = new byte[length]; var index = 0; while (length-- != 0) { bytes[index++] = Get(context); } Get(context); // Skip null byte terminator return(new string(Encoding.UTF8.GetChars(bytes))); } else { var unicodeChars = new char[length]; var index = 0; ushort unicodeChar = 0; while (length-- != 0) { unicodeChars[index++] = (char)Get(context, unicodeChar); } Get(context, unicodeChar); // Skip null character terminator return(new string(unicodeChars)); } } Get(context); // Skip null character terminator return(""); }
public static byte Get(BasicTypeDeSerializerContext context) { return context.Retrieve(); }
public static Int64 Get(BasicTypeDeSerializerContext context, Int64 data) { return((Int64)Get(context, (UInt64)data)); }
public static UInt64[] Get(BasicTypeDeSerializerContext context, UInt64[] array) { ushort length = 0; length = Get(context, length); if (length != 0) { var buffer = new UInt64[length]; var index = 0; UInt64 data = 0; while (length-- != 0) { buffer[index++] = Get(context, data); } return buffer; } return null; }
public static byte[] Get(BasicTypeDeSerializerContext context, byte[] bytes) { ushort length = 0; length = Get(context, length); if (length != 0) { var buffer = new byte[length]; var index = 0; while (length-- != 0) { buffer[index++] = Get(context); } return buffer; } return null; }
public static string Get(BasicTypeDeSerializerContext context, string text) { byte IsASCII = 0; IsASCII = Get(context); ushort length = 0; length = Get(context, length); if (length != 0) { if (IsASCII == 1) { var bytes = new byte[length]; var index = 0; while (length-- != 0) { bytes[index++] = Get(context); } Get(context); // Skip null byte terminator return new string(Encoding.UTF8.GetChars(bytes)); } else { var unicodeChars = new char[length]; var index = 0; ushort unicodeChar = 0; while (length-- != 0) { unicodeChars[index++] = (char)Get(context, unicodeChar); } Get(context, unicodeChar); // Skip null character terminator return new string(unicodeChars); } } Get(context); // Skip null character terminator return ""; }
public static Int64 Get(BasicTypeDeSerializerContext context, Int64 data) { return (Int64)Get(context, (UInt64)data); }
public static byte Get(BasicTypeDeSerializerContext context) { return(context.Retrieve()); }