Explicitly check for each sensor type before processing sensor data (since some newer devices may not support ROTATION_VECTOR sensor).  Refactor sensor processing code from IF-THEN to SWITCH statement.