/// <summary> /// 数据解析传输 /// </summary> public void SolveByteToData(byte[] data) { byte[] angleByte = new byte[] { data[ANGLE_HIGH_BYTE_POS], data[ANGLE_LOW_BYTE_POS] }; int angleData = ByteArrayToInt16(angleByte); byte[] angVleByte = new byte[] { data[ANGVLE_HIGH_BYTE_POS], data[ANGVLE_LOW_BYTE_POS] }; int angVelData = ByteArrayToInt16(angVleByte); //角度、角速度解析为float型 赋予model 传输数据 AngleDataModel model = new AngleDataModel(); model.angle = SolveAngleData(angleData); model.angle_velocity = SolveAngVelData(angVelData); Debug.Log("角度:" + model.angle); Debug.Log("角速度:" + model.angle_velocity); NotificationController.Instance.SendNotification(NotificationConst.ANGLE_AND_ANGLEVEL, model); }
private void Rotation(Notification noti) { angleDataModel = (AngleDataModel)noti.param[0]; updateAngle = true; }