1 /* 2 * Copyright (c) 2024 Alexandre Bailon 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #ifndef COAP_LED_H 8 #define COAP_LED_H 9 10 #include <zephyr/data/json.h> 11 12 #define LED_URI "led" 13 14 #define LED_MSG_STATE_OFF 0 15 #define LED_MSG_STATE_ON 1 16 #define LED_MSG_STATE_TOGGLE 2 17 18 #define JSON_MAX_LED 4 19 20 struct json_led_state { 21 int led_id; 22 int state; 23 }; 24 25 struct json_led_get { 26 const char *device_id; 27 struct json_led_state leds[JSON_MAX_LED]; 28 int count; 29 }; 30 31 int coap_led_set_state(const char *addr, int led_id, int state); 32 int coap_led_get_state(const char *addr, int led_id, int *state); 33 34 #ifdef CONFIG_OT_COAP_SAMPLE_SERVER 35 void coap_led_reg_rsc(void); 36 #endif /* CONFIG_OT_COAP_SAMPLE_SERVER */ 37 38 #endif /* COAP_LED_H */ 39