private void OnBufferReceived(WS4000Buffer theBuffer) { if (BufferReceived != null) { BufferReceived(this, new BufferReceivedEventArgs(theBuffer)); } }
/// <summary> /// Copy Constructort /// </summary> /// <param name="from">The buffer to copy</param> public WS4000Buffer(WS4000Buffer from) : this(from.Offset, from.Size) { for (int i = 0; i < from.Size; i++) { Buffer[i] = from.Buffer[i]; } }
/// <summary> /// Copy Constructort /// </summary> /// <param name="from">The buffer to copy</param> public WS4000Buffer(WS4000Buffer from) : this(from.Offset, from.Size) { for (int i = 0; i < from.Size; i++) { Buffer[i] = from.Buffer[i]; } }
/// <summary> /// Start the reading of a 32 byte part of the WS4000 memory starting /// at address offset /// </summary> /// <param name="offset"></param> public void getMemory(int offset, int length = 0x20) { if (Buffer != null) { throw new HIDDeviceException("Reading memory is in progress"); } Buffer = new WS4000Buffer(offset, length); RequestBuffer request = new RequestBuffer(this); request.Offset = offset; request.Send(); }
/// <summary> /// Handle the received global data /// </summary> /// <param name="sender"></param> /// <param name="args"></param> void GlobalBufferRead(object sender, BufferReceivedEventArgs args) { this.BufferReceived -= GlobalBufferRead; byte[] globalBuffer = args.Data.Buffer; Count = ToUShort(globalBuffer, DATA_COUNT) - 1; // The active buffer is also in Count SnapshotDate = toDateTime(globalBuffer, DATE_TIME); ushort pos = ToUShort(globalBuffer, CURRENT_POS); CurrentPos = new BufferPos(pos); CurrentBuffer = null; this.BufferReceived += ActiveSnapshotRead; GetBlock(CurrentPos); }
void handleInputReport(object sender, DataReceivedEventArgs args) { if (Buffer != null) { Buffer.add(args.data.Buffer); if (Buffer.Full) { WS4000Buffer buffer = Buffer; Buffer = null; OnBufferReceived(buffer); } else if (Buffer.Cursor % 0x20 == 0) { RequestBuffer request = new RequestBuffer(this); request.Offset = Buffer.Cursor; request.Send(); } } }
public BufferReceivedEventArgs(WS4000Buffer data) { this.data = data; }
void HandleBufferReceived(object sender, BufferReceivedEventArgs args) { CurrentBuffer = WS4000Buffer.Clone(args.Data); OnBufferReceived(CurrentBuffer); }
void handleInputReport(object sender, DataReceivedEventArgs args) { if (Buffer != null) { Buffer.add(args.data.Buffer); if (Buffer.Full) { WS4000Buffer buffer = Buffer; Buffer = null; OnBufferReceived(buffer); } else if (Buffer.Cursor % 0x20 == 0) { RequestBuffer request = new RequestBuffer(this); request.Offset = Buffer.Cursor; request.Send(); } } }
/// <summary> /// Start the reading of a 32 byte part of the WS4000 memory starting /// at address offset /// </summary> /// <param name="offset"></param> public void getMemory(int offset, int length = 0x20) { if (Buffer != null) { throw new HIDDeviceException("Reading memory is in progress"); } Buffer = new WS4000Buffer(offset, length); RequestBuffer request = new RequestBuffer(this); request.Offset = offset; request.Send(); }
public BufferReceivedEventArgs(WS4000Buffer data) { this.data = data; }
private void OnBufferReceived(WS4000Buffer theBuffer) { if (BufferReceived != null) { BufferReceived(this, new BufferReceivedEventArgs(theBuffer)); } }
public static WS4000Buffer Clone(WS4000Buffer from) { return new WS4000Buffer(from); }
public static WS4000Buffer Clone(WS4000Buffer from) { return(new WS4000Buffer(from)); }