/// <summary> /// 2.2.8.1.2.2 /// </summary> /// <param name="input"></param> public void VerifyStructure(TS_FP_INPUT_EVENT input) { int code; int flag; code = input.eventHeader.eventFlagsAndCode>>5; flag = input.eventHeader.eventFlagsAndCode&0x1F; bool isR1730Satisfied = code == 0 || code == 1 || code == 2 || code == 3 || code == 4; site.CaptureRequirementIfIsTrue(isR1730Satisfied, 1730, @"In TS_FP_INPUT_EVENT structure, eventCode can be the following: FASTPATH_INPUT_EVENT_SCANCODE" + @" 0x0,FASTPATH_INPUT_EVENT_MOUSE 0x1, FASTPATH_INPUT_EVENT_MOUSEX 0x2, FASTPATH_INPUT_EVENT_SYNC" + @" 0x3, FASTPATH_INPUT_EVENT_UNICODE 0x4"); switch (code) { case 0: site.CaptureRequirementIfIsInstanceOfType(input.eventData, typeof(TS_FP_KEYBOARD_EVENT), 1739, @"In the eventHeader of the TS_FP_KEYBOARD_EVENT structure, the eventCode bit field (3 " + @"bits in size) MUST be set to FASTPATH_INPUT_EVENT_SCANCODE (0)."); break; case 1: site.CaptureRequirementIfIsInstanceOfType(input.eventData, typeof(TS_FP_POINTER_EVENT), 1750, @"In the eventHeader of the TS_FP_POINTER_EVENT structure, the eventCode bit field (3 " + @"bits in size) MUST be set to FASTPATH_INPUT_EVENT_MOUSE (1)."); site.CaptureRequirementIfAreEqual<int>(0, flag, 1751, @"In the eventHeader of the TS_FP_POINTER_EVENT structure, the eventFlags bit field (5" + @" bits in size) MUST be zeroed out."); break; case 2: site.CaptureRequirementIfIsInstanceOfType(input.eventData, typeof(TS_FP_POINTERX_EVENT), 1757, @"In the eventHeader of the TS_FP_POINTERX_EVENT structure, the eventCode bit field (3" + @" bits in size) MUST be set to FASTPATH_INPUT_EVENT_POINTERX (2)."); site.CaptureRequirementIfAreEqual<int>(0, flag, 1758, @"In the eventHeader of the TS_FP_POINTERX_EVENT structure, the eventFlags bit field (5" + @" bits in size) MUST be zeroed out."); break; case 3: site.CaptureRequirementIfIsTrue(input.eventData == null && code == 3, 1765, @"In the eventHeader of the TS_FP_SYNC_EVENT structure, the eventCode bit field (3 bits" + @" in size) MUST be set to FASTPATH_INPUT_EVENT_SYNC (3)."); break; case 4: site.CaptureRequirementIfIsInstanceOfType(input.eventData, typeof(TS_FP_UNICODE_KEYBOARD_EVENT), 1744, @"In the eventHeader of the TS_FP_UNICODE_KEYBOARD_EVENT structure, the eventCode bit field" + @" (3 bits in size) MUST be set to FASTPATH_INPUT_EVENT_UNICODE (4)."); site.CaptureRequirementIfAreEqual<int>(0, flag, 1745, @"In the eventHeader of the TS_FP_UNICODE_KEYBOARD_EVENT structure, the eventFlags bit field" + @" (5 bits in size) MUST be zeroed out."); break; } }
/// <summary> /// Parse TS_FP_UPDATE array /// (parser index is updated according to parsed length) /// </summary> /// <param name="data">data to be parsed</param> /// <param name="currentIndex">current parser index</param> /// <returns>parsed TS_FP_UPDATE array</returns> private Collection<TS_FP_INPUT_EVENT> ParseTsFpInputEvents(byte[] data, ref int currentIndex) { Collection<TS_FP_INPUT_EVENT> collectionEvents = new Collection<TS_FP_INPUT_EVENT>(); while (currentIndex < data.Length) { TS_FP_INPUT_EVENT inputEvent = new TS_FP_INPUT_EVENT(); byte eventHeader = ParseByte(data, ref currentIndex); byte eventFlags; eventCode_Values eventCode; GetFpEventHeaderInfo(eventHeader, out eventFlags, out eventCode); inputEvent.eventHeader.eventFlagsAndCode = eventHeader; switch(eventCode) { case eventCode_Values.FASTPATH_INPUT_EVENT_MOUSE: inputEvent.eventData = ParseTsFpInputMouse(data, ref currentIndex); break; case eventCode_Values.FASTPATH_INPUT_EVENT_MOUSEX: inputEvent.eventData = ParseTsFpInputMousex(data, ref currentIndex); break; case eventCode_Values.FASTPATH_INPUT_EVENT_SCANCODE: inputEvent.eventData = ParseTsFpInputScancode(data, ref currentIndex); break; case eventCode_Values.FASTPATH_INPUT_EVENT_SYNC: inputEvent.eventData = null; break; case eventCode_Values.FASTPATH_INPUT_EVENT_UNICODE: inputEvent.eventData = ParseTsFpInputUnicode(data, ref currentIndex); break; default: throw new FormatException(ConstValue.ERROR_MESSAGE_ENUM_UNRECOGNIZED); } collectionEvents.Add(inputEvent); } return collectionEvents; }