# Decoding message

Source: [https://docs.qualcomm.com/doc/80-PK177-134/topic/decoding_message.html](https://docs.qualcomm.com/doc/80-PK177-134/topic/decoding_message.html)

This method, which was registered as an event callback, gets triggered by the QESDK
    sensor manager when events are available with protobuf encoded byte array.

    void onValues(byte[] bytes, int size, int sensor_session_id)Copy to clipboard

This byte array event data can be converted to Protobuf Client event message using `parseFrom()`, Protobuf generated API.

    sns_client_event_msg decode_request_msg=sns_client_event_msg.parseFrom(proto_message);
    //proto_message is byte arrayCopy to clipboard

The event can be `Activity_Recognition` or `SUID` event. The event is recognized by the event ID.

## SUID event message

    sns_suid_msgid.SNS_SUID_MSGID_SNS_SUID_EVENT_VALUECopy to clipboard

In case of SUID event, SUID data is nested in the main event message. To get the actual SUID data, you must parse nested, SUID submessage.

    SnsStdType.sns_std_suid suid_event = null;
    suid_event=SnsSuid.sns_suid_event.parseFrom(decode_request_msg.getEvents(i).getPayload()).getSuid(0)Copy to clipboard

## AR event message

    sns_activity_recognition_msgid.SNS_ACTIVITY_RECOGNITION_MSGID_SNS_AR_EVENT_VALUECopy to clipboard

In case of `Activity_Recognition`, AR event data is nested in the main event message. To get the actual AR data, you must parse nested AR submessage.

    sns_ar_event  ar_event = null;
    ar_event=SnsActivityRecognition.sns_ar_event.parseFrom(decode_request_msg.getEvents(i).getPayload());Copy to clipboard

**Parent Topic:** [Encoding and decoding protobuf messages](https://docs.qualcomm.com/doc/80-PK177-134/topic/encoding_and_decoding_protobuf_messages.html)

Last Published: Nov 14, 2024

[Previous Topic
Requesting message](https://docs.qualcomm.com/bundle/publicresource/80-PK177-134/topics/requesting_message.md) [Next Topic
Example code](https://docs.qualcomm.com/bundle/publicresource/80-PK177-134/topics/example_code_QC_4.md)