Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 32007d95 authored by Matthew Xie's avatar Matthew Xie Committed by Android Git Automerger
Browse files

am a1a13fc8: Fix rssi handling as one of property change event

* commit 'a1a13fc8':
  Fix rssi handling as one of property change event
parents 016c696d a1a13fc8
Loading
Loading
Loading
Loading
+0 −11
Original line number Diff line number Diff line
@@ -91,17 +91,6 @@ static int get_properties(int num_properties, bt_property_t *properties, jintArr
                        jobjectArray *props) {
    jbyteArray propVal;
    for (int i = 0; i < num_properties; i++) {

        /* The higher layers expect rssi as a short int value, while the value is sent as a byte
         * to jni. Converting rssi value to the expected format.*/
        if (properties[i].type == BT_PROPERTY_REMOTE_RSSI)
        {
            jbyte rssi = *((jbyte *) properties[i].val);
            short rssiValue = rssi;
            properties[i].len = sizeof(rssiValue);
            properties[i].val = &rssiValue;
        }

        propVal = callbackEnv->NewByteArray(properties[i].len);
        if (propVal == NULL) goto Fail;

+2 −1
Original line number Diff line number Diff line
@@ -294,7 +294,8 @@ final class RemoteDevices {
                            device.mDeviceType = Utils.byteArrayToInt(val);
                            break;
                        case AbstractionLayer.BT_PROPERTY_REMOTE_RSSI:
                            device.mRssi = Utils.byteArrayToShort(val);
                            // RSSI from hal is in one byte
                            device.mRssi = val[0];
                            break;
                    }
                }