made progress in arduino example

This commit is contained in:
strawmanbobi
2026-01-01 20:34:23 +08:00
parent 37f5889586
commit 258e2ea19f
7 changed files with 262 additions and 9 deletions

View File

@@ -297,7 +297,7 @@ public class ControlFragment extends Fragment implements View.OnClickListener {
byte []binContent = FileUtils.getByteArrayFromFile(binFileName);
sendBinToEmitter(binContent);
} else {
emitterConnected = EMITTER_CONNECTED;
emitterConnected = EMITTER_BIN_RECEIVED;
}
}
@@ -342,8 +342,14 @@ public class ControlFragment extends Fragment implements View.OnClickListener {
}
private void sendBinToEmitter(byte[] binContent) {
if (null == binContent) {
Log.e(TAG, "binary bytes is null");
return;
}
int categoryId = mCurrentRemoteControl.getCategoryId();
int subCate = mCurrentRemoteControl.getSubCategory();
String binBase64 = Base64.getEncoder().encodeToString(binContent);
String binStr = A_REQUEST_BIN + "," + binBase64.length() + "," + binBase64;
String binStr = A_REQUEST_BIN + "," + categoryId + "," + subCate + "," + binBase64.length() + "," + binBase64;
Log.d(TAG, "sending bin in base64: " + binStr);
new Thread(() -> {
try {