public static int decodeYPRUpdate(byte[] buffer, int offset, int length, YPRUpdate u) { if (length < YPR_UPDATE_MESSAGE_LENGTH) { return(0); } if ((buffer[offset + 0] == '!') && (buffer[offset + 1] == 'y')) { if (!verifyChecksum(buffer, offset, YPR_UPDATE_CHECKSUM_INDEX)) { return(0); } u.yaw = decodeProtocolFloat(buffer, offset + YPR_UPDATE_YAW_VALUE_INDEX); u.pitch = decodeProtocolFloat(buffer, offset + YPR_UPDATE_PITCH_VALUE_INDEX); u.roll = decodeProtocolFloat(buffer, offset + YPR_UPDATE_ROLL_VALUE_INDEX); u.compass_heading = decodeProtocolFloat(buffer, offset + YPR_UPDATE_COMPASS_VALUE_INDEX); return(YPR_UPDATE_MESSAGE_LENGTH); } return(0); }
public static int decodeYPRUpdate(byte[] buffer, int offset, int length, YPRUpdate u) { if (length < YPR_UPDATE_MESSAGE_LENGTH) { return 0; } if ((buffer[offset + 0] == '!') && (buffer[offset + 1] == 'y')) { if (!verifyChecksum(buffer, offset, YPR_UPDATE_CHECKSUM_INDEX)) { return 0; } u.yaw = decodeProtocolFloat(buffer, offset + YPR_UPDATE_YAW_VALUE_INDEX); u.pitch = decodeProtocolFloat(buffer, offset + YPR_UPDATE_PITCH_VALUE_INDEX); u.roll = decodeProtocolFloat(buffer, offset + YPR_UPDATE_ROLL_VALUE_INDEX); u.compass_heading = decodeProtocolFloat(buffer, offset + YPR_UPDATE_COMPASS_VALUE_INDEX); return YPR_UPDATE_MESSAGE_LENGTH; } return 0; }