#ifndef API_H
#define API_H

#include "common.h"

//=========================== defines =========================================

//==== mote states
#define MOTE_STATE_INIT					       0x00  
#define MOTE_STATE_IDLE                0x01
#define MOTE_STATE_SEARCHING           0x02
#define MOTE_STATE_NEGOTIATING         0x03
#define MOTE_STATE_CONNECTED           0x04
#define MOTE_STATE_OPERATIONAL         0x05
#define MOTE_STATE_DISCONNECTED        0x06 
#define MOTE_STATE_RADIO_TEST          0x07 
#define MOTE_STATE_LISTEN              0x08 
#define MOTE_STATE_SUSPENDED           0x09 

//==== mote response codes; API guide p.109
#define MOTE_RC_OK                      0 // success
#define MOTE_RC_BUSY                    3 // resource unavailible
#define MOTE_RC_INVALID_LEN             4 // invalid length
#define MOTE_RC_INVALID_STATE           5 // invalid state
#define MOTE_RC_UNSUPPORTED             6 // command or operation not supported
#define MOTE_RC_UNKNOWN_PARAM           7 // unknown parameter
#define MOTE_RC_UNKNOWN_CMD             8 // unknown command
#define MOTE_RC_WRITE_FAIL              9 // write did not complete
#define MOTE_RC_READ_FAIL              10 // read did not complete
#define MOTE_RC_LOW_VOLTAGE            11 // voltage check fail
#define MOTE_RC_NO_RESOURCES           12 // no resources availible to complete command
#define MOTE_RC_INCOMPLETE_JOIN_INFO   13 // incomplete join info
#define MOTE_RC_NOT_FOUND              14 // resource not found
#define MOTE_RC_INVALID_VALUE          15 // invalid value
#define MOTE_RC_ACCESS_DENIED          16 // access to this command/variable denied
#define MOTE_RC_OPEN_FAIL              18 // open operation failed
#define MOTE_RC_ERASE_FAIL             19 // erase operation failed

//=========================== typedef =========================================

//=========================== prototypes ======================================

//==== admin
void api_init(void);

//==== api
//void api_response_timeout(void);
void api_getMacAddress(void);
void api_getMoteStatus(void);
void api_setJoinDutyCycle(void);
void api_setNetworkID(void);
void api_setJoinKey(void);
void api_setHartDeviceInfo(void);
void api_setHartDeviceStatus(void);
void api_setHartCompliantMode(void);
void api_setMacAddress(void);
void api_setBatteryLife(void);
void api_join(void);
void api_getService(void);
void api_setService(void);
void api_sendHartResponse(void);
void api_sendHartBurst(void);
void api_hartPayload(void);
void api_disconnect(void);
void api_reset(void);


#endif
