victordiaz / PHONK

PHONK is a coding playground for new and old Android devices
https://phonk.app
GNU General Public License v3.0
456 stars 27 forks source link

Util.parseBytes only supports chars #46

Closed txf- closed 3 years ago

txf- commented 4 years ago
    public Object parseBytes(byte[] bytes, String type) {
        BluetoothBytesParser parser = new BluetoothBytesParser(bytes);

        switch (type) {
            case "uint8":
                return parser.getIntValue(BluetoothBytesParser.FORMAT_UINT8);
            case "string":
                return parser.getStringValue(0);
            default:
                return null;
        }
    }

Ideally this section in PUtil.java should support more datatypes than just 8 bit values. Presumably BluetoothBytesParser supports more data types?

victordiaz commented 4 years ago

@txf- It seems to support float, int and longs as far as a I can see. I will include them and release it in the next version. Thanks for commenting on this

victordiaz commented 4 years ago

I included some more data types although I only managed to test uint8 and strings. For some reason float does not work for me but maybe I'm just sending wrongly the data from my ESP

victordiaz commented 4 years ago

Hi @txf- The new version is online with the changes. Let me know if that works as intented

Thanks

victordiaz commented 3 years ago

I close the issue since I think a previous commit improved the situation :)