Huawei: Little cleanups in P2P service

This commit is contained in:
Me7c7 2024-12-01 17:57:27 +02:00
parent ed49f6d323
commit 609a673dae
3 changed files with 2 additions and 5 deletions

View File

@ -302,7 +302,7 @@ public class HuaweiP2PCalendarService extends HuaweiBaseP2PService {
byte[] dataBytes = data.getBytes(StandardCharsets.UTF_8);
ByteBuffer sendData = ByteBuffer.allocate(dataBytes.length + 8); // 8 is data header
// NOTE: minor version is short in response but in this case it writes as integer
//NOTE: minor version is short in response but in this case it writes as integer
sendData.putInt(minorVersion);
sendData.putInt(dataBytes.length);
sendData.put(dataBytes);
@ -487,6 +487,5 @@ public class HuaweiP2PCalendarService extends HuaweiBaseP2PService {
} catch (HuaweiPacket.MissingTagException e) {
LOG.error("P2P handle packet: tag is missing");
}
}
}

View File

@ -274,8 +274,6 @@ public class HuaweiP2PDataDictionarySyncService extends HuaweiBaseP2PService {
for (HuaweiTLV l1 : l.getObjects(0x87)) {
for (HuaweiTLV ll : l1.getObjects(0x88)) {
int type = ll.getInteger(0x9);
// 10 - Double - data
// 11 - String - metadata
if (ll.contains(0xa))
dataValues.add(new DictData.DictDataValue(type, (byte) 0xa, ll.getBytes(0xa)));
if (ll.contains(0xb))

View File

@ -75,7 +75,7 @@ public class HuaweiP2PTrackService extends HuaweiBaseP2PService {
header.putInt(counter.getNext()); // message id
header.flip();
ByteBuffer packet = ByteBuffer.allocate(36 + data.length);
ByteBuffer packet = ByteBuffer.allocate(HEADER_LENGTH + data.length);
packet.put(header.array());
packet.put(data);
packet.flip();