86 lines
3.5 KiB
C
86 lines
3.5 KiB
C
/****************************************************************************
|
|
* This file is part of the project AqHome.
|
|
* AqHome (c) by 2025 Martin Preuss, all rights reserved.
|
|
*
|
|
* The license for this file can be found in the file COPYING which you
|
|
* should have received along with this file.
|
|
****************************************************************************/
|
|
|
|
#ifndef AQH_M_IPC_H
|
|
#define AQH_M_IPC_H
|
|
|
|
|
|
#include <aqhome/api.h>
|
|
#include <aqhome/ipc2/message.h>
|
|
|
|
|
|
#define AQH_IPCMSG_OFFS_SIZE 0 /* 4 bytes: number of all bytes including size, protoid, protover and code */
|
|
#define AQH_IPCMSG_OFFS_PROTOID 4 /* 1 byte: protocol id (free to use) */
|
|
#define AQH_IPCMSG_OFFS_PROTOVER 5 /* 1 byte: protocol version (free to use) */
|
|
#define AQH_IPCMSG_OFFS_CODE 6 /* 2 bytes msg code (meaning depends on protocol) */
|
|
#define AQH_IPCMSG_OFFS_ID 8 /* 4 bytes msg id */
|
|
#define AQH_IPCMSG_OFFS_REFID 12 /* 4 bytes reference msg id */
|
|
#define AQH_IPCMSG_OFFS_PAYLOAD 16 /* begin of payload for a given message */
|
|
|
|
|
|
|
|
#define AQH_IPC_PROTOCOL_DATA_ID 2
|
|
#define AQH_IPC_PROTOCOL_DATA_VERSION 1
|
|
|
|
|
|
|
|
#define AQH_MSGTYPE_IPC_DATA_RESULT 0x0001 /* AQH_ResultIpcMsg */
|
|
|
|
#define AQH_MSGTYPE_IPC_DATA_CONNECT_REQ 0x0010 /* serviceName, userName, password */
|
|
|
|
#define AQH_MSGTYPE_IPC_DATA_UPDATEDATA 0x0100 /* AQH_MultiDataDataIpcMsg */
|
|
#define AQH_MSGTYPE_IPC_DATA_DATACHANGED 0x0200 /* AQH_MultiDataDataIpcMsg */
|
|
|
|
#define AQH_MSGTYPE_IPC_DATA_SETDATA 0x0300 /* AQH_SetDataIpcMsg */
|
|
|
|
#define AQH_MSGTYPE_IPC_DATA_ADDVALUE 0x0400 /* AQH_AddValueDataIpcMsg */
|
|
|
|
#define AQH_MSGTYPE_IPC_DATA_GETDATA_REQ 0x0500 /* AQH_GetDataDataIpcMsg */
|
|
#define AQH_MSGTYPE_IPC_DATA_GETDATA_RSP 0x0600 /* AQH_MultiDataDataIpcMsg */
|
|
|
|
#define AQH_MSGTYPE_IPC_DATA_GETLASTDATA_REQ 0x0700 /* AQH_GetDataDataIpcMsg */
|
|
#define AQH_MSGTYPE_IPC_DATA_GETLASTDATA_RSP 0x0800 /* AQH_MultiDataDataIpcMsg */
|
|
|
|
#define AQH_MSGTYPE_IPC_DATA_GETVALUES_REQ 0x0900 /* GWEN_IpcMsg */
|
|
#define AQH_MSGTYPE_IPC_DATA_GETVALUES_RSP 0x0a00 /* AQH_ValuesDataIpcMsg */
|
|
|
|
#define AQH_MSGTYPE_IPC_DATA_GETDEVICES_REQ 0x0b00 /* GWEN_IpcMsg */
|
|
#define AQH_MSGTYPE_IPC_DATA_GETDEVICES_RSP 0x0c00 /* AQH_DevicesDataIpcMsg */
|
|
|
|
#define AQH_MSGTYPE_IPC_DATA_MODDEVICE_REQ 0x0d00 /* AQH_DevicesDataIpcMsg */
|
|
|
|
#define AQH_MSGTYPE_IPC_DATA_ANNOUNCEVALUE 0x0e00 /* AQH_ValuesDataIpcMsg */
|
|
|
|
|
|
|
|
AQHOME_API AQH_MESSAGE *AQH_IpcMessage_new(uint8_t protoId, uint8_t protoVer, uint16_t code,
|
|
uint32_t msgId, uint32_t refMsgId,
|
|
uint32_t payloadLen, const uint8_t *payload);
|
|
AQHOME_API AQH_MESSAGE *AQH_IpcMessage_fromBuffer(const uint8_t *ptr, uint32_t len);
|
|
|
|
AQHOME_API void AQH_IpcMessage_AdjustMsgSize(AQH_MESSAGE *msg);
|
|
|
|
AQHOME_API uint32_t AQH_IpcMessage_GetMsgSize(const AQH_MESSAGE *msg);
|
|
AQHOME_API uint8_t AQH_IpcMessage_GetProtoId(const AQH_MESSAGE *msg);
|
|
AQHOME_API uint8_t AQH_IpcMessage_GetProtoVersion(const AQH_MESSAGE *msg);
|
|
AQHOME_API uint16_t AQH_IpcMessage_GetCode(const AQH_MESSAGE *msg);
|
|
AQHOME_API uint32_t AQH_IpcMessage_GetMsgId(const AQH_MESSAGE *msg);
|
|
AQHOME_API uint32_t AQH_IpcMessage_GetRefMsgId(const AQH_MESSAGE *msg);
|
|
|
|
AQHOME_API uint32_t AQH_IpcMessage_GetPayloadLength(const AQH_MESSAGE *msg);
|
|
AQHOME_API uint8_t *AQH_IpcMessage_GetPayloadPointer(const AQH_MESSAGE *msg);
|
|
|
|
|
|
AQHOME_API const char *AQH_IpcMessage_MsgTypeToChar(uint16_t i);
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|