public static void Put(BasicTypeSerializerContext context, UInt32 data) { Put(context, (byte)(data >> 24)); Put(context, (byte)(data >> 16)); Put(context, (byte)(data >> 8)); Put(context, (byte)data); }
public static void Put(BasicTypeSerializerContext context, UInt64[] array) { Put(context, (ushort)array.Length); foreach (var e in array) { Put(context, e); } }
public static void Put(BasicTypeSerializerContext context, byte[] bytes) { Put(context, (ushort)bytes.Length); foreach (var b in bytes) { Put(context, b); } }
public void Put(BasicTypeSerializerContext context) { BasicTypeSerializer.Put(context, (Int32)An); BasicTypeSerializer.Put(context, (Int32)Bn); BasicTypeSerializer.Put(context, (Int32)Cn); BasicTypeSerializer.Put(context, (Int32)Dn); BasicTypeSerializer.Put(context, (Int32)En); BasicTypeSerializer.Put(context, (Int32)Fn); BasicTypeSerializer.Put(context, (Int32)Divider); }
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 void Put(BasicTypeSerializerContext context, string text, bool ConvertToASCII = false) { Put(context, (byte)(ConvertToASCII ? 1 : 0)); if (ConvertToASCII) { Put(context, Encoding.UTF8.GetBytes(text)); Put(context, (byte) 0); // terminate the string with a null byte } else { Put(context, (ushort)text.Length); foreach (var c in text) { Put(context, c); } Put(context, (ushort)0); // terminate the unicode string with a null short } }
public static void Put(BasicTypeSerializerContext context, string text, bool ConvertToASCII = false) { Put(context, (byte)(ConvertToASCII ? 1 : 0)); if (ConvertToASCII) { Put(context, Encoding.UTF8.GetBytes(text)); Put(context, (byte)0); // terminate the string with a null byte } else { Put(context, (ushort)text.Length); foreach (var c in text) { Put(context, c); } Put(context, (ushort)0); // terminate the unicode string with a null short } }
public static unsafe void Put(BasicTypeSerializerContext context, float data) { var temp = new byte[4]; Utility.InsertValueIntoArray(temp, 0, 4, *((uint*)&data)); if (context.IsLittleEndian) { // Store the float in network byte order (Big Endian) Put(context, temp[3]); Put(context, temp[2]); Put(context, temp[1]); Put(context, temp[0]); } else { // Already in network byte order Put(context, temp[0]); Put(context, temp[1]); Put(context, temp[2]); Put(context, temp[3]); } }
public static unsafe void Put(BasicTypeSerializerContext context, float data) { var temp = new byte[4]; Utility.InsertValueIntoArray(temp, 0, 4, *((uint *)&data)); if (context.IsLittleEndian) { // Store the float in network byte order (Big Endian) Put(context, temp[3]); Put(context, temp[2]); Put(context, temp[1]); Put(context, temp[0]); } else { // Already in network byte order Put(context, temp[0]); Put(context, temp[1]); Put(context, temp[2]); Put(context, temp[3]); } }
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 void Put(BasicTypeSerializerContext context, byte[] bytes, ushort offset, ushort count) { Put(context, (ushort)count); context.Store(bytes, offset, count); }
public static void Put(BasicTypeSerializerContext context, Int64 data) { Put(context, (UInt64)data); }
public static void Put(BasicTypeSerializerContext context, Int16 data) { Put(context, (byte)(data >> 8)); Put(context, (byte)data); }
public static void Put(BasicTypeSerializerContext context, UInt16 data) { Put(context, (Int16) data); }
public static void Put(BasicTypeSerializerContext context, byte data) { context.Store(data); }
public static void Put(BasicTypeSerializerContext context, UInt16 data) { Put(context, (Int16)data); }