MPPT 751 15 通过 VE.Direct 连接到 Raspberry Pi 3(Android of Things)但数据不可读

MPPT 751 15 connect via VE.Direct to Raspberry Pi 3 (Android of Things) but data is unreadable

在缓冲区中我得到了无法转换为文本或十六进制的值,[98 63 65 -128 3 0 -94 ....]

有人知道一些 Java/Android 阅读示例或结果转换为文本的方法吗?

提前致谢。

while ((count = uart.read(buffer, buffer.length)) > 0) {
    Log.d(TAG, "Read " + count + " bytes from peripheral");
    byte[] lectura=new byte[count];

    for(int i=0;i<count;i++){
        lectura[i]= (buffer[i]);
        Log.w(TAG,lectura[i] + " | " + buffer[i]);
    }

您不仅需要从 Raspberry UART 读取原始数据,还需要实施 VE.Direct 协议(接收和解析整个消息)link1 link2 (both links from Solar Controller Hacks and Arduino Integration article). Also check this official documentation, FAQ and examples like that. Actually you need to convert something like SerialRead.ino 到 Android 事物 Java。

更新:Here also is a good example (you need to convert VEDirect.cpp 文件到 java).