More protocols

This commit is contained in:
2026-02-17 23:30:49 +01:00
parent 62a90a468d
commit 74a517a22a
15 changed files with 2268 additions and 21 deletions

View File

@@ -0,0 +1,124 @@
package meshcore
const (
companionErrCodeUnsupported byte = 1 + iota
companionErrCodeNotFound
companionErrCodeTableFull
companionErrCodeBadState
companionErrCodeFileIOError
companionErrCodeIllegalArgument
)
// companion command bytes
const (
companionAppStart byte = 1 + iota //
companionSendTextMessage //
companionSendChannelTextMessage //
companionGetContacts // with optional 'since' (for efficient sync)
companionGetDeviceTime //
companionSetDeviceTime //
companionSendSelfAdvert //
companionSetAdvertName //
companionAddUpdateContact //
companionSyncMessages //
companionSetRadioParams //
companionSetRadioTXPower //
companionResetPath //
companionSetAdvertLatLon //
companionRemoveContact //
companionShareContact //
companionExportContact //
companionImportContact //
companionReboot //
companionGetBatteryAndStorage // was CMD_GetBATTERY_VOLTAGE
companionSetTuningParams //
companionDeviceQuery //
companionExportPrivateKey //
companionImportPrivateKey //
companionSendRawData //
companionSendLogin //
companionSendStatusRequest //
companionHasConnection //
companionLogout // 'Disconnect'
companionGetContactByKey //
companionGetChannel //
companionSetChannel //
companionSignStart //
companionSignData //
companionSignFinish //
companionSendTracePath //
companionSetDevicePIN //
companionSetOtherParams //
companionSendTelemetryRequest //
companionGetCustomVars //
companionSetCustomVar //
companionGetAdvertPath //
companionGetTuningParams //
_ // parked
_ // parked
_ // parked
_ // parked
_ // parked
_ // parked
companionSendBinaryRequest //
companionFactoryReset //
companionSendPathDiscoveryRequest //
_ // parked
companionSetFloodScope // v8+
companionSendControlData // v8+
companionGetStats // v8+, second byte is stats type
companionSendAnonymousRequest //
companionSetAutoAddConfig //
companionGetAutoAddConfig //
)
// companion response bytes
const (
companionResponseOK byte = iota
companionResponseError
companionResponseContactsStart // first reply to CMD_GetCONTACTS
companionResponseContact // multiple of these (after CMD_GetCONTACTS)
companionResponseEndOfContacts // last reply to CMD_GetCONTACTS
companionResponseSelfInfo // reply to CMD_APP_START
companionResponseSent // reply to CMD_SEND_TXT_MSG
companionResponseContactMessageReceived // a reply to CMD_SYNC_NEXT_MESSAGE (ver < 3)
companionResponseChannelMessageReceived // a reply to CMD_SYNC_NEXT_MESSAGE (ver < 3)
companionResponseCurrentTime // a reply to CMD_GetDEVICE_TIME
companionResponseNoMoreMessages // a reply to CMD_SYNC_NEXT_MESSAGE
companionResponseExportContact //
companionResponseBatteryAndStorage // a reply to a CMD_GetBATT_AND_STORAGE
companionResponseDeviceInfo // a reply to CMD_DEVICE_QEURY
companionResponsePrivateKey // a reply to CMD_EXPORT_PRIVATE_KEY
companionResponseDisabled //
companionResponseContactMessageReceivedV3 // a reply to CMD_SYNC_NEXT_MESSAGE (ver >= 3)
companionResponseChannelMessageReceivedV3 // a reply to CMD_SYNC_NEXT_MESSAGE (ver >= 3)
companionResponseChannelInfo // a reply to CMD_GetCHANNEL
companionResponseSignatureStart //
companionResponseSignature //
companionResponseCustomVars //
companionResponseAdvertPath //
companionResponseTuningParams //
companionResponseStats // v8+, second byte is stats type
companionResponseAutoAddConfig //
)
// companion push code bytes
const (
companionPushAdvert byte = 0x80 + iota
companionPushPathUpdated
companionPushSendConfirmed
companionPushMessageWaiting
companionPushRawData
companionPushLoginSuccess
companionPushLoginFailure
companionPushStatusResponse
companionPushLogRXData
companionPushTraceData
companionPushNewAdvert
companionPushTelemetryResponse
companionPushBinaryResponse
companionPushPathDiscoveryResponse
companionPushControlData
companionPushContactDeleted
companionPushContactsFull
)