2021-07-14 18:31:10 +02:00
|
|
|
"use strict";
|
|
|
|
const p7PacketType = {
|
|
|
|
'command': 0x01,
|
|
|
|
'data': 0x02,
|
|
|
|
'roleswap': 0x03,
|
|
|
|
'check': 0x05,
|
|
|
|
'ack': 0x06,
|
|
|
|
'screenCast': 0x0B, /* Not supported yet */
|
|
|
|
'error': 0x15,
|
|
|
|
'terminate': 0x18
|
|
|
|
};
|
|
|
|
|
|
|
|
const sysCommandSubtype = {
|
|
|
|
/* System commands */
|
|
|
|
'restartReset': 0x00,
|
|
|
|
'getDeviceInfo': 0x01,
|
|
|
|
'setLinkSettings': 0x02, /* Probably unavailable since we are using USB */
|
|
|
|
};
|
|
|
|
|
2021-08-06 13:06:21 +02:00
|
|
|
const ramCommandSubtype = {
|
|
|
|
/* RAM filesystem commands */
|
2021-07-14 18:31:10 +02:00
|
|
|
'createDirectory': 0x20,
|
|
|
|
'deleteDirectory': 0x21,
|
|
|
|
'renameDirectory': 0x22,
|
|
|
|
'changeWorkingDirectory': 0x23,
|
|
|
|
'fileTransferRequest': 0x24,
|
|
|
|
'fileTransfer': 0x25,
|
|
|
|
'deleteFile': 0x26,
|
|
|
|
'renameFile': 0x27,
|
|
|
|
'copyFile': 0x28,
|
|
|
|
'fileTransferAllRequest': 0x29,
|
2021-08-06 13:06:21 +02:00
|
|
|
'reset': 0x2A, /* TODO: TEST */
|
2021-07-14 18:31:10 +02:00
|
|
|
'capacityTransmitRequest': 0x2B,
|
|
|
|
'capacityTransmit': 0x2C,
|
|
|
|
'fileInfoTransferAllRequest': 0x2D,
|
|
|
|
'fileInfoTransfer': 0x2E,
|
|
|
|
'ramImageTransferRequest': 0x2F,
|
|
|
|
'ramImageTransfer': 0x30,
|
|
|
|
'setupEntryTransferRequest': 0x31,
|
|
|
|
'setupEntryTransfer': 0x32,
|
|
|
|
'setupEntryTransferAllRequest': 0x33,
|
|
|
|
};
|
|
|
|
|
|
|
|
const flashCommandSubtype = {
|
2021-08-06 13:06:21 +02:00
|
|
|
/* Flash memory filesystem commands */
|
2021-07-14 18:31:10 +02:00
|
|
|
'createDirectory': 0x40,
|
|
|
|
'deleteDirectory': 0x41,
|
|
|
|
'renameDirectory': 0x42,
|
|
|
|
'changeDirectory': 0x43,
|
|
|
|
'fileTransferRequest': 0x44,
|
|
|
|
'fileTransfer': 0x45,
|
|
|
|
'deleteFile': 0x46,
|
|
|
|
'renameFile': 0x47,
|
|
|
|
'copyFile': 0x48,
|
|
|
|
'fileTransferAllRequest': 0x49,
|
2021-07-25 21:43:43 +02:00
|
|
|
'resetFlash': 0x4A,
|
2021-07-14 18:31:10 +02:00
|
|
|
'capacityTransmitRequest': 0x4B,
|
|
|
|
'capacityTransmit': 0x4C,
|
|
|
|
'fileInfoTransferAllRequest': 0x4D,
|
|
|
|
'fileInfoTransfer': 0x4E,
|
|
|
|
'flashImageTransferRequest': 0x4F,
|
|
|
|
'flashImageTransfer': 0x50,
|
2021-07-22 18:25:57 +02:00
|
|
|
'optimizeFileSystem': 0x51
|
2021-07-14 18:31:10 +02:00
|
|
|
// 'osUpdateRelated': [0x52 --> 0x57] ?
|
|
|
|
};
|
|
|
|
|
|
|
|
const dataSubtype = {}; /* Theorically always the same as the command packet it succeeds to */
|
|
|
|
|
|
|
|
const roleswapSubtype = {
|
|
|
|
'default': 0x00
|
|
|
|
};
|
|
|
|
|
|
|
|
const checkSubtype = {
|
|
|
|
'initialization': 0x00,
|
|
|
|
'default': 0x01
|
|
|
|
};
|
|
|
|
|
|
|
|
const ackSubtype = {
|
|
|
|
'default': 0x00,
|
|
|
|
'overwriteYes': 0x01,
|
|
|
|
'extendedAck': 0x02
|
|
|
|
};
|
|
|
|
|
|
|
|
const errorSubtype = {
|
|
|
|
'default': 0x00,
|
|
|
|
'resendRequest': 0x01,
|
|
|
|
'overwriteRequest': 0x02,
|
|
|
|
'overwriteNo': 0x03,
|
|
|
|
'overwriteImpossible': 0x04,
|
|
|
|
'memoryFull': 0x05
|
|
|
|
};
|
|
|
|
|
|
|
|
const terminateSubtype = {
|
|
|
|
'default': 0x00,
|
|
|
|
'userRequest': 0x01,
|
|
|
|
'timeouts': 0x02,
|
|
|
|
'overwriteRequest': 0x03
|
|
|
|
};
|