Soletta™ Framework
|
#include <errno.h>
#include <fcntl.h>
#include <linux/kd.h>
#include <netinet/in.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <unistd.h>
#include "sol-log.h"
#include "sol-mainloop.h"
#include "sol-network.h"
#include "sol-str-slice.h"
#include "sol-vector.h"
#include "sol-coap.h"
Data Structures | |
struct | light_context |
Macros | |
#define | DEFAULT_UDP_PORT 5683 |
#define | OC_CORE_ELEM_JSON_END "}}]}" |
#define | OC_CORE_ELEM_JSON_START "{\"oc\":[{\"href\":\"%s\",\"rep\":{" |
#define | OC_CORE_JSON_SEPARATOR "," |
#define | OC_CORE_PROP_JSON_BOOLEAN "\"%s\":%s" |
#define | OC_CORE_PROP_JSON_NUMBER "\"%s\":%d" |
#define | OC_CORE_PROP_JSON_STRING "\"%s\":\"%s\"" |
Functions | |
static bool | get_scrolllock_led (void) |
static int | light_method_get (void *data, struct sol_coap_server *server, const struct sol_coap_resource *resource, struct sol_coap_packet *req, const struct sol_network_link_addr *cliaddr) |
static int | light_method_put (void *data, struct sol_coap_server *server, const struct sol_coap_resource *resource, struct sol_coap_packet *req, const struct sol_network_link_addr *cliaddr) |
static int | light_resource_to_rep (const struct sol_coap_resource *resource, bool state, struct sol_buffer *buf) |
int | main (int argc, char *argv[]) |
static void | set_scrolllock_led (bool on) |
static bool | update_light (void *data) |
Variables | |
static int | console_fd |
static struct sol_coap_resource | light |
#define DEFAULT_UDP_PORT 5683 |
Referenced by main().
#define OC_CORE_ELEM_JSON_END "}}]}" |
Referenced by light_resource_to_rep().
#define OC_CORE_ELEM_JSON_START "{\"oc\":[{\"href\":\"%s\",\"rep\":{" |
Referenced by light_resource_to_rep().
#define OC_CORE_JSON_SEPARATOR "," |
Referenced by light_resource_to_rep().
#define OC_CORE_PROP_JSON_BOOLEAN "\"%s\":%s" |
Referenced by light_resource_to_rep().
#define OC_CORE_PROP_JSON_NUMBER "\"%s\":%d" |
Referenced by light_resource_to_rep().
#define OC_CORE_PROP_JSON_STRING "\"%s\":\"%s\"" |
Referenced by light_resource_to_rep().
|
static |
References console_fd, and value.
Referenced by light_method_get(), and update_light().
|
static |
References get_scrolllock_led(), light_resource_to_rep(), sol_coap_header_set_code(), sol_coap_header_set_type(), SOL_COAP_MESSAGE_TYPE_ACK, sol_coap_packet_get_payload(), sol_coap_packet_new(), sol_coap_packet_unref(), SOL_COAP_RESPONSE_CODE_CONTENT, sol_coap_send_packet(), SOL_INT_CHECK_GOTO, and SOL_WRN.
|
static |
References set_scrolllock_led(), sol_buffer_at(), sol_coap_header_set_code(), sol_coap_header_set_type(), SOL_COAP_MESSAGE_TYPE_ACK, sol_coap_packet_get_payload(), sol_coap_packet_new(), sol_coap_packet_unref(), SOL_COAP_RESPONSE_CODE_BAD_REQUEST, SOL_COAP_RESPONSE_CODE_CONTENT, sol_coap_send_packet(), SOL_INF, SOL_INT_CHECK_GOTO, SOL_WRN, and value.
|
static |
References OC_CORE_ELEM_JSON_END, OC_CORE_ELEM_JSON_START, OC_CORE_JSON_SEPARATOR, OC_CORE_PROP_JSON_BOOLEAN, OC_CORE_PROP_JSON_NUMBER, OC_CORE_PROP_JSON_STRING, sol_coap_resource::path, sol_buffer_append_printf(), SOL_BUFFER_DECLARE_STATIC, sol_buffer_steal(), sol_coap_path_to_buffer(), and SOL_INT_CHECK.
Referenced by light_method_get(), and update_light().
int main | ( | int | argc, |
char * | argv[] | ||
) |
References console_fd, DEFAULT_UDP_PORT, sol_network_link_addr::family, light_context::resource, light_context::server, server, sol_coap_server_new(), sol_coap_server_register_resource(), sol_coap_server_unref(), sol_init(), SOL_NETWORK_FAMILY_INET6, sol_run(), sol_timeout_add(), and update_light().
|
static |
References console_fd.
Referenced by light_method_put().
|
static |
References get_scrolllock_led(), light_resource_to_rep(), light_context::resource, light_context::server, server, sol_coap_header_set_code(), sol_coap_notify(), sol_coap_packet_get_payload(), sol_coap_packet_new_notification(), sol_coap_packet_unref(), SOL_COAP_RESPONSE_CODE_CONTENT, SOL_INF, SOL_INT_CHECK_GOTO, and SOL_NULL_CHECK.
Referenced by main().
|
static |
Referenced by get_scrolllock_led(), main(), and set_scrolllock_led().
|
static |