/*
 * Copyright (C) 2020-2020 ikonke
 */

#ifndef _KK_COM_API_H_
#define _KK_COM_API_H_

#if defined(__cplusplus)
extern "C" {
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "ev.h"
#include "nn.h"
#include "pair.h"



//=====kk======================
typedef enum {
    IPC_APP2MID = 0,
    IPC_MID2APP,
    IPC_MID2PLAT,
    IPC_PLAT2MID,
    IPC_UNDEF
} ipc_type;
	
typedef enum{
	/******MIDDWARE TO APP**************/
	MSG_REGISTER = 0,
	MSG_UNREGISTER,
	MSG_TOPOADD,
	MSG_TOPODELETE,
	MSG_TOPOGET,
	MSG_LISTFOUND,
	MSG_LOGIN,
	MSG_LOGOUT,
	MSG_PROPERTYPOST,
	MSG_EVENTPOST,
	MSG_SERVICERESPONSE,
	MSG_SETREPLY,
	MSG_OTA_PROCESS,
	/*******APP TO  MIDDWARE**************/
 	MSG_REGISTER_REPLY,
 	MSG_TOPOADD_REPLY,
 	MSG_OFFLINE_REPLY,
 	MSG_LOGIN_REPLY,
 	MSG_PROPERTYSET,
 	MSG_OTA_UPGRADE,
 	MSG_INVALID,
 	
}kk_msg_type_t;

#define MSG_TYPE_STR              "msgtype"
#define MSG_PRODUCT_TYPE_STR      "product_type"
#define MSG_DEVICE_NAME_STR       "device_name"
#define MSG_PAYLOAD_STR           "payload"
#define MSG_INFO_STR              "info"
#define MSG_INDENTIFIER_STR              "identifier"

typedef void ipc_cb(void* data, int len);
int kk_ipc_init(ipc_type type, ipc_cb cb);
int kk_ipc_dinit();
int kk_ipc_send(ipc_type type, void* data, int len);

#if defined(__cplusplus)
}
#endif
#endif
