public unsafe void GestureDataParser(byte[] bufferArray, POIRealtimeMsgCB cb) { fixed (byte* bytePointer = bufferArray) { byte* gestureData = bytePointer; GestureType* dataType = (GestureType*)gestureData; if (*dataType == GestureType.SWIPE) { //Console.Write("Swipe\n"); gestureData += sizeof(GestureType); SwipeGestureData* swipeData = (SwipeGestureData*)gestureData; cb.Handle_Swipe(ref *swipeData); } else if (*dataType == GestureType.PINCH) { //Console.Write("Pinch\n"); gestureData += sizeof(GestureType); PinchGestureData* pinchData = (PinchGestureData*)gestureData; cb.Handle_Scale(ref *pinchData); } else if (*dataType == GestureType.ROTATION) { //Console.Write("Rotation\n"); gestureData += sizeof(GestureType); RotationGestureData* rotationData = (RotationGestureData*)gestureData; cb.Handle_Rotate(ref *rotationData); } else if (*dataType == GestureType.SCROLLING) { //Console.Write("Scrolling\n"); gestureData += sizeof(GestureType); ScrollingGestureData* scrollingData = (ScrollingGestureData*)gestureData; //ScrollngParser(scrollingData); } } }
public unsafe void TouchDataParser(byte[] bufferArray,POIRealtimeMsgCB cb) { fixed (byte* bytePointer = bufferArray) { byte* touchData = bytePointer; TouchPhase* touchPhase = (TouchPhase*)touchData; if (*touchPhase == TouchPhase.TOUCH_BEGIN) { //Console.Write("Begin\n"); touchData += sizeof(TouchPhase); //TouchBeginParser(touchData); cb.Handle_TouchBegin(touchData); } else if (*touchPhase == TouchPhase.TOUCH_MOVE) { //Console.Write("Move\n"); touchData += sizeof(TouchPhase); //TouchMoveParser(touchData); cb.Handle_TouchMove(touchData); } else if (*touchPhase == TouchPhase.TOUCH_END) { //Console.Write("End\n"); touchData += sizeof(TouchPhase); //TouchEndParser(touchData); cb.Handle_TouchEnd(touchData); } } }