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

Commit 3cedf3d5 authored by Matthew Xie's avatar Matthew Xie
Browse files

Fix rssi handling as one of property change event

The rssi is encoded in one byte as int8_t in the stack.
JNI code copied in high byte without proper masking.
The converting is not needed. I am removing the uncessary converting.
bug 9110215

Change-Id: I50628b3a3c0bcf4a33775c6b62e9febd35bdc78d
parent 0eea1282
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;
                    }
                }