Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef BRICKLET_DUAL_BUTTON_H
00012 #define BRICKLET_DUAL_BUTTON_H
00013
00014 #include "ip_connection.h"
00015
00016 #ifdef __cplusplus
00017 extern "C" {
00018 #endif
00019
00029 typedef Device DualButton;
00030
00034 #define DUAL_BUTTON_FUNCTION_SET_LED_STATE 1
00035
00039 #define DUAL_BUTTON_FUNCTION_GET_LED_STATE 2
00040
00044 #define DUAL_BUTTON_FUNCTION_GET_BUTTON_STATE 3
00045
00049 #define DUAL_BUTTON_FUNCTION_SET_SELECTED_LED_STATE 5
00050
00054 #define DUAL_BUTTON_FUNCTION_GET_IDENTITY 255
00055
00075 #define DUAL_BUTTON_CALLBACK_STATE_CHANGED 4
00076
00077
00081 #define DUAL_BUTTON_LED_STATE_AUTO_TOGGLE_ON 0
00082
00086 #define DUAL_BUTTON_LED_STATE_AUTO_TOGGLE_OFF 1
00087
00091 #define DUAL_BUTTON_LED_STATE_ON 2
00092
00096 #define DUAL_BUTTON_LED_STATE_OFF 3
00097
00101 #define DUAL_BUTTON_BUTTON_STATE_PRESSED 0
00102
00106 #define DUAL_BUTTON_BUTTON_STATE_RELEASED 1
00107
00111 #define DUAL_BUTTON_LED_LEFT 0
00112
00116 #define DUAL_BUTTON_LED_RIGHT 1
00117
00127 #define DUAL_BUTTON_DEVICE_IDENTIFIER 230
00128
00135 void dual_button_create(DualButton *dual_button, const char *uid, IPConnection *ipcon);
00136
00143 void dual_button_destroy(DualButton *dual_button);
00144
00164 int dual_button_get_response_expected(DualButton *dual_button, uint8_t function_id, bool *ret_response_expected);
00165
00181 int dual_button_set_response_expected(DualButton *dual_button, uint8_t function_id, bool response_expected);
00182
00189 int dual_button_set_response_expected_all(DualButton *dual_button, bool response_expected);
00190
00197 void dual_button_register_callback(DualButton *dual_button, uint8_t id, void *callback, void *user_data);
00198
00205 int dual_button_get_api_version(DualButton *dual_button, uint8_t ret_api_version[3]);
00206
00225 int dual_button_set_led_state(DualButton *dual_button, uint8_t led_l, uint8_t led_r);
00226
00232 int dual_button_get_led_state(DualButton *dual_button, uint8_t *ret_led_l, uint8_t *ret_led_r);
00233
00242 int dual_button_get_button_state(DualButton *dual_button, uint8_t *ret_button_l, uint8_t *ret_button_r);
00243
00251 int dual_button_set_selected_led_state(DualButton *dual_button, uint8_t led, uint8_t state);
00252
00265 int dual_button_get_identity(DualButton *dual_button, char ret_uid[8], char ret_connected_uid[8], char *ret_position, uint8_t ret_hardware_version[3], uint8_t ret_firmware_version[3], uint16_t *ret_device_identifier);
00266
00267 #ifdef __cplusplus
00268 }
00269 #endif
00270
00271 #endif