Skip to content

API reference

guojie edited this page Aug 2, 2019 · 6 revisions

ZigBee related API

Struct for setting up ZigBee receive message callback functions

typedef struct stDevMsgCb {
	int (*rpt_dev_added)(char *mac, char *ModelStr, char *model, int type, int  
	battery);
	int (*rpt_dev_deled)(char *mac);
	int (*rpt_dev_online)(char *mac, int online);

	int (*rpt_dev_battery)(char *mac, int battery);
	int (*rpt_dev_lowpower)(char *mac, char *ModelStr, char *model, int type, int 
	lowpowerlr);

	/**> temphumidity sensor */
	int (*rpt_temp)(char *mac, float temp);
	int (*rpt_humi)(char *mac, float humi);
	/**> door contact sensor */
	int (*rpt_door)(char *mac, int door);

	/**> PIR sensor */
	int (*rpt_pir) (char *mac, int pir);
	/**> leakage sensor */
	int (*rpt_leak)(char *mac, int pir);

	/**> lock */
	int (*ret_lock_password_add)(char *mac, int op_ret, int passid);
	int (*ret_lock_password_del)(char *mac, int op_ret, int passid);
	int (*ret_lock_password_mod)(char *mac, int op_ret, int passid);
	int (*ret_lock_password_clr)(char *mac, int op_ret);
	int (*ret_lock_dynamic_seed)(char *mac, int op_ret);
	int (*rpt_lock_checkrecord)(char *mac);
	int (*rpt_lock_system_locked)(char *mac, char *ModelStr, char *model, int type,  
	int locked);

	/**> smoke sensor */
	int (*rpt_smoke)(char *mac, char *ModelStr, char *model, int type, int smoke);

	/**> light sensor*/
	int (*rpt_light_onoff)(char *mac, int onoff);

	/**> window sensor */
	int (*rpt_winctr_status)(char *mac, int status);
	int (*rpt_winctr_percent)(char *mac, int percent);

	/**> air conditionning control sensor */
	int (*rpt_air_temp)(char *mac, int mode, int value, int unit);
	int (*rpt_air_fan)(char *mac, int fan);
	int (*rpt_air_mode)(char *mac, int mode);

	/**> rpt zcl command for customized cluster*/
	int (*rpt_cmd)(char *mac, int ep, int cluster, int cmd, char *buf, int len);
	/**> rpt attribute for customized cluster*/
	int (*rpt_attr)(char *mac, int ep, int cluster, int attr, char *buf, int len);
} stDevMsgCb_t;

Functions for ZigBee operations

/*Function to initialize the SDK. */

int rbsdk_init(void *unused, int (*msgcb)(char *src, char *dest, char *msg));

/*Function to get the SDK version. */

int rbsdk_vers(char *version);

/*A General Call Functions. */

int rbsdk_call(char *mac, char *attr, int setOrget, void *jvalue);

/*Function to Set the Message Callback. */

int rbsdk_dev_msgcb_set(stDevMsgCb_t *dmc);

/*Function to Get Device list. */

int rbsdk_list_dev();

/*Function to Send adding device Request. */

int rbsdk_add_dev(char *mac, char *type);

/*Function to Send Deleting Device Request. */

int rbsdk_del_dev(char *mac);

/*Function to Send Add Lock Password Request. */

int rbsdk_dev_lock_add_pass(char *mac, int type, int id, int passVal1, int passVal2, int startTime, int endTime, int suspend);

/*Function to Send Delete Lock Password Request. */

int rbsdk_dev_lock_del_pass(char *mac, int type, int id);

/*Function to Send Modify Lock Password Request. */

int rbsdk_dev_lock_mod_pass(char *mac, int type, int id, int passVal1, int passVal2, int startTime, int endTime, int suspend);

/*Function to Send Clear Lock Password Request. */

int rbsdk_dev_lock_clr_pass(char *mac, int type);

/*Function to Send Set Dynamic Password Seed Request. */

int rbsdk_dev_lock_set_seed(char *mac, int id, int seed, int interval, int startTime, int endTime);

/*Function To Send Light OnOff Request. */

int rbsdk_dev_light_onoff(char *mac, int onoff);

/*Function to Send Window Controller's Open Request. */

int rbsdk_dev_winctr_open(char *mac);

/*Function to Send Window Controller's Stop Request. */

int rbsdk_dev_winctr_stop(char *mac);

/*Function to Send Window Controller's Close Request. */

int rbsdk_dev_winctr_close(char *mac);

/*Function to Send Air conditioner Onoff Request. */

int rbsdk_dev_air_onoff(char *mac, int onoff);

/*Function to Send Air conditioner Mode Request. */

int rbsdk_dev_air_mode(char *mac, int mode);

/*Function to Send Air conditioner Fan Request. */

int rbsdk_dev_air_fan(char *mac, int fan);

/*Function to Send Air conditioner temp Request. */

int rbsdk_dev_air_temp(char *mac, int temp_mode, int dir, int temp_delt);

/*A callback function for pushing the sensor command data reported by the sensor using a customized cluster to the application. */

int (*rpt_cmd)(char *mac, int ep, int cluster, int cmd, char *buf, int len);

/*A callback function for pushing the sensor attribute data reported by the sensor using a customized cluster to the application. */

int (*rpt_attr)(char *mac, int ep, int cluster, int attr, char *buf, int len);

Z-Wave related API

struct for setting Z-Wave receive message callback functions

typedef struct stZwMsgCb {
	/**> new zwave device add */
	int (*rpt_zwdev_added)(char *mac, const char *skeleton);

	/**> device delete or leaved */
	int (*rpt_zwdev_deled)(char *mac);

	/**> device online status changed */
	int (*rpt_zwdev_online)(char *mac, int online);

	/**> devcie has data */
	int (*rpt_zwdev_cmd)(char *mac, int ep, int class, int cmd, char *buf, int len);

	/**> zwave net info */
	int (*rpt_zw_netinfo)(int homeid, int nodeid, const char *version);
} stZwMsgCb_t;

Functions for Z-Wave operations

/*Function to initialize the SDK. */

int rbsdk_init(void *unused, int (*msgcb)(char *src, char *dest, char *msg));

/*Function to get the SDK version. */

int rbsdk_vers(char *version);

/*Function to request gateway to allow pairing new device. */

int rbsdk_zw_include();

/*Function to request gateway to unpair device. */

int rbsdk_zw_exclude();

/*Function to request Z-Wave device list. */

int rbsdk_zw_devlist();

/*Function to request Z-Wave netinfo. */

int rbsdk_zw_netinfo();

/*Function to request Z-Wave to delete a node. */

int rbsdk_zw_del_node(char *mac);

/*Function to request Z-Wave gateway to send class command to device. */

int rbsdk_zw_class_cmd(char *mac, int ep, int class, int cmd, char *data, int len);

/*Function to set the Z-wave message callback. */

int rbsdk_zw_msgcb_set(stZwMsgCb_t *zmc);