Add get history message
continuous-integration/drone/push Build is running
Details
continuous-integration/drone/push Build is running
Details
This commit is contained in:
parent
3a163df991
commit
386e8c3ed1
|
@ -8,5 +8,5 @@ export enum MessageTypes {
|
|||
UserDataRequest = 0x0002,
|
||||
UserDataResponse = 0x0003,
|
||||
Keepalive = 0x0005,
|
||||
Unsubscribe = 0xFFFF
|
||||
GetHistory = 0xfffe,
|
||||
}
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
import { packSubscribeMessage } from './messages/subscribe'
|
||||
import { packBasicMessage, unpackBasicMessage } from './messages/basic'
|
||||
import { packUserDataRequestMessage, unpackUserDataRequestMessage } from './messages/userDataRequest'
|
||||
import { packUserDataResponseMessage, unpackUserDataResponseMessage } from './messages/userDataResponse'
|
||||
import { packKeepaliveMessage } from './messages/keepalive'
|
||||
import { packUnsubscribeMessage } from './messages/unsubscribe'
|
||||
import { packGetHistoryMessage } from "./messages/history";
|
||||
|
||||
export const packers = {
|
||||
0x0000: packSubscribeMessage,
|
||||
|
@ -11,8 +6,8 @@ export const packers = {
|
|||
0x0002: packUserDataRequestMessage,
|
||||
0x0003: packUserDataResponseMessage,
|
||||
0x0005: packKeepaliveMessage,
|
||||
0xffff: packUnsubscribeMessage
|
||||
}
|
||||
0xfffe: packGetHistoryMessage,
|
||||
0xffff: packUnsubscribeMessage,
|
||||
|
||||
export const unpackers = {
|
||||
0x0001: unpackBasicMessage,
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
import { MessageTypes } from "../common";
|
||||
import { numberToUint16BE } from "../utilities/number";
|
||||
import { packOutgoingPacket } from "./packet";
|
||||
|
||||
const MESSAGE_TYPE = numberToUint16BE(MessageTypes.Keepalive);
|
||||
|
||||
/**
|
||||
* Create an outgoing keepalive (0x0005) packet.
|
||||
* @returns An outgoing keepalive (0x0005) packet.
|
||||
*/
|
||||
export function packGetHistoryMessage(): Uint8Array {
|
||||
return packOutgoingPacket({
|
||||
messageType: MESSAGE_TYPE,
|
||||
data: new Uint8Array(0),
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue