Initial target repo setup to move to master (v3.10)
This commit is contained in:
@ -154,7 +154,8 @@ namespace pxsim.radio {
|
||||
board().radioState.bus.datagram.send({
|
||||
type: PacketPayloadType.STRING,
|
||||
groupId: board().radioState.groupId,
|
||||
bufferData: data
|
||||
// TODO: (microbit master)
|
||||
//bufferData: data
|
||||
});
|
||||
}
|
||||
|
||||
@ -211,9 +212,10 @@ namespace pxsim.radio {
|
||||
return initString(board().radioState.bus.datagram.lastReceived.payload.stringData || "");
|
||||
}
|
||||
|
||||
export function receivedBuffer(): RefBuffer {
|
||||
return new RefBuffer(board().radioState.bus.datagram.lastReceived.payload.bufferData || new Uint8Array(0))
|
||||
}
|
||||
// TODO: (microbit master)
|
||||
// export function receivedBuffer(): RefBuffer {
|
||||
// return new RefBuffer(board().radioState.bus.datagram.lastReceived.payload.bufferData || new Uint8Array(0))
|
||||
// }
|
||||
|
||||
export function receivedTime(): number {
|
||||
return board().radioState.bus.datagram.lastReceived.time;
|
||||
@ -230,12 +232,13 @@ namespace pxsim.radio {
|
||||
case PacketPayloadType.STRING:
|
||||
b.writeSerial(`{"t":${p.time},"s":${p.serial},"n":"${p.payload.stringData}"}\r\n`)
|
||||
break;
|
||||
case PacketPayloadType.BUFFER:
|
||||
const buf = new Uint8Array(p.payload.bufferData.buffer);
|
||||
let res = "";
|
||||
for (let i = 0; i < buf.length; ++i)
|
||||
res += String.fromCharCode(buf[i]);
|
||||
b.writeSerial(`{"t":${p.time},"s":${p.serial},"b":"${res}"}\r\n`)
|
||||
// TODO: (microbit master)
|
||||
// case PacketPayloadType.BUFFER:
|
||||
// const buf = new Uint8Array(p.payload.bufferData.buffer);
|
||||
// let res = "";
|
||||
// for (let i = 0; i < buf.length; ++i)
|
||||
// res += String.fromCharCode(buf[i]);
|
||||
// b.writeSerial(`{"t":${p.time},"s":${p.serial},"b":"${res}"}\r\n`)
|
||||
default:
|
||||
// unknown type
|
||||
break;
|
||||
|
Reference in New Issue
Block a user