Soletta™ Framework
|
#include <stdio.h>
#include <arpa/inet.h>
#include "sol-log.h"
#include "sol-buffer.h"
#include "sol-coap.h"
#include "sol-mainloop.h"
#include "sol-oic-client.h"
Data Structures | |
struct | Context |
Macros | |
#define | DEVICE_ID_LEN (16) |
#define | POST_REQUEST_POWER (13) |
#define | PUT_REQUEST_POWER (7) |
#define | streq(a, b) (strcmp((a), (b)) == 0) |
Enumerations | |
enum | test_number_codes { TEST_DISCOVERY = 1, TEST_NON_CONFIRMABLE_GET = 2, TEST_NON_CONFIRMABLE_PUT = 4, TEST_NON_CONFIRMABLE_POST = 5, TEST_NON_CONFIRMABLE_DELETE = 6, TEST_NON_CONFIRMABLE_OBSERVE = 7, TEST_NON_CONFIRMABLE_INVALID_GET = 8, TEST_CONFIRMABLE_GET = 9, TEST_CONFIRMABLE_POST = 10, TEST_CONFIRMABLE_DELETE = 11, TEST_CONFIRMABLE_OBSERVE = 12, TEST_DISCOVER_PLATFORM = 19, TEST_DISCOVER_DEVICES = 20 } |
Functions | |
static void | check_delete_request (void *data, enum sol_coap_response_code response_code, struct sol_oic_client *cli, const struct sol_network_link_addr *cliaddr, const struct sol_oic_map_reader *map_reader) |
static void | check_post_request (void *data, enum sol_coap_response_code response_code, struct sol_oic_client *cli, const struct sol_network_link_addr *cliaddr, const struct sol_oic_map_reader *map_reader) |
static void | check_put_request (void *data, enum sol_coap_response_code response_code, struct sol_oic_client *cli, const struct sol_network_link_addr *cliaddr, const struct sol_oic_map_reader *map_reader) |
static bool | check_response_code (enum sol_coap_response_code response_code, int test_number) |
static void | device_id_decode (const char *device_id_encoded, char *device_id) |
static void | dump_byte_string (struct sol_buffer *buf, const struct sol_str_slice bytes) |
static void | fill_info (const struct sol_oic_map_reader *map_reader, bool *state, int32_t *power) |
static bool | found_resource (void *data, struct sol_oic_client *cli, struct sol_oic_resource *res) |
static bool | found_resource_print (void *data, struct sol_oic_client *cli, struct sol_oic_resource *res) |
int | main (int argc, char *argv[]) |
static void | platform_info_cb (void *data, struct sol_oic_client *cli, const struct sol_oic_platform_info *info) |
static int | post_fill_repr_map (struct sol_oic_map_writer *repr_map) |
static void | print_response (void *data, enum sol_coap_response_code response_code, struct sol_oic_client *cli, const struct sol_network_link_addr *cliaddr, const struct sol_oic_map_reader *map_reader) |
static int | put_fill_repr_map (struct sol_oic_map_writer *repr_map) |
static void | resource_notify (void *data, enum sol_coap_response_code response_code, struct sol_oic_client *cli, const struct sol_network_link_addr *cliaddr, const struct sol_oic_map_reader *map_reader) |
static void | server_info_cb (void *data, struct sol_oic_client *cli, const struct sol_oic_device_info *info) |
static void | usage (void) |
#define DEVICE_ID_LEN (16) |
Referenced by device_id_decode(), found_resource_print(), and server_info_cb().
#define POST_REQUEST_POWER (13) |
Referenced by check_post_request(), and post_fill_repr_map().
#define PUT_REQUEST_POWER (7) |
Referenced by check_put_request(), and put_fill_repr_map().
#define streq | ( | a, | |
b | |||
) | (strcmp((a), (b)) == 0) |
Referenced by fill_info().
enum test_number_codes |
|
static |
References SOL_COAP_RESPONSE_CODE_NOT_FOUND, sol_quit(), and sol_quit_with_code().
Referenced by print_response().
|
static |
References fill_info(), POST_REQUEST_POWER, SOL_COAP_RESPONSE_CODE_BAD_REQUEST, sol_quit(), and sol_quit_with_code().
Referenced by print_response().
|
static |
References fill_info(), PUT_REQUEST_POWER, SOL_COAP_RESPONSE_CODE_BAD_REQUEST, sol_quit(), and sol_quit_with_code().
Referenced by print_response().
|
static |
References SOL_COAP_RESPONSE_CODE_CHANGED, SOL_COAP_RESPONSE_CODE_CONTENT, SOL_COAP_RESPONSE_CODE_DELETED, SOL_COAP_RESPONSE_CODE_NOT_FOUND, SOL_COAP_RESPONSE_CODE_OK, TEST_CONFIRMABLE_DELETE, TEST_CONFIRMABLE_GET, TEST_CONFIRMABLE_OBSERVE, TEST_CONFIRMABLE_POST, TEST_NON_CONFIRMABLE_DELETE, TEST_NON_CONFIRMABLE_GET, TEST_NON_CONFIRMABLE_INVALID_GET, TEST_NON_CONFIRMABLE_OBSERVE, TEST_NON_CONFIRMABLE_POST, and TEST_NON_CONFIRMABLE_PUT.
Referenced by print_response(), and resource_notify().
|
static |
References DEVICE_ID_LEN.
Referenced by found_resource_print(), and server_info_cb().
|
static |
References sol_str_slice::data, sol_str_slice::len, sol_buffer_append_printf(), and sol_buffer::used.
Referenced by print_response().
|
static |
References sol_oic_repr_field::key, SOL_OIC_MAP_LOOP, SOL_OIC_REPR_TYPE_BOOL, SOL_OIC_REPR_TYPE_INT, SOL_OIC_REPR_TYPE_SIMPLE, SOL_OIC_REPR_TYPE_UINT, streq, sol_oic_repr_field::type, sol_oic_repr_field::v_boolean, sol_oic_repr_field::v_int, sol_oic_repr_field::v_simple, and sol_oic_repr_field::v_uint.
Referenced by check_post_request(), and check_put_request().
|
static |
References found_resource_print(), sol_oic_resource::path, post_fill_repr_map(), print_response(), put_fill_repr_map(), Context::res, resource_notify(), SOL_COAP_METHOD_DELETE, SOL_COAP_METHOD_GET, SOL_COAP_METHOD_POST, SOL_COAP_METHOD_PUT, sol_oic_client_non_confirmable_request_new(), sol_oic_client_request(), sol_oic_client_request_get_writer(), sol_oic_client_request_new(), sol_oic_client_resource_set_observable(), sol_oic_client_resource_set_observable_non_confirmable(), sol_oic_resource_ref(), sol_oic_resource_unref(), sol_quit_with_code(), sol_str_slice_from_str(), SOL_STR_SLICE_PRINT, TEST_CONFIRMABLE_DELETE, TEST_CONFIRMABLE_GET, TEST_CONFIRMABLE_OBSERVE, TEST_CONFIRMABLE_POST, TEST_NON_CONFIRMABLE_DELETE, TEST_NON_CONFIRMABLE_GET, TEST_NON_CONFIRMABLE_INVALID_GET, TEST_NON_CONFIRMABLE_OBSERVE, TEST_NON_CONFIRMABLE_POST, TEST_NON_CONFIRMABLE_PUT, and Context::test_number.
Referenced by main().
|
static |
References sol_oic_resource::addr, sol_str_slice::data, sol_oic_resource::device_id, device_id_decode(), DEVICE_ID_LEN, sol_oic_resource::interfaces, sol_str_slice::len, sol_oic_resource::observable, sol_oic_resource::path, sol_oic_resource::secure, SOL_BUFFER_DECLARE_STATIC, sol_buffer_get_slice(), SOL_NETWORK_INET_ADDR_STR_LEN, sol_network_link_addr_to_str(), sol_quit(), sol_quit_with_code(), SOL_STR_SLICE_PRINT, SOL_VECTOR_FOREACH_IDX, and sol_oic_resource::types.
Referenced by found_resource(), and main().
int main | ( | int | argc, |
char * | argv[] | ||
) |
References sol_network_link_addr::family, found_resource(), found_resource_print(), platform_info_cb(), Context::res, server_info_cb(), sol_init(), SOL_NETWORK_FAMILY_INET, sol_network_link_addr_from_str(), sol_oic_client_del(), sol_oic_client_find_resources(), sol_oic_client_get_platform_info_by_addr(), sol_oic_client_get_server_info_by_addr(), sol_oic_client_new(), sol_oic_resource_unref(), sol_run(), TEST_CONFIRMABLE_DELETE, TEST_CONFIRMABLE_GET, TEST_CONFIRMABLE_OBSERVE, TEST_CONFIRMABLE_POST, TEST_DISCOVER_DEVICES, TEST_DISCOVER_PLATFORM, TEST_DISCOVERY, TEST_NON_CONFIRMABLE_DELETE, TEST_NON_CONFIRMABLE_GET, TEST_NON_CONFIRMABLE_INVALID_GET, TEST_NON_CONFIRMABLE_OBSERVE, TEST_NON_CONFIRMABLE_POST, TEST_NON_CONFIRMABLE_PUT, Context::test_number, and usage().
|
static |
References sol_oic_platform_info::firmware_version, sol_oic_platform_info::hardware_version, sol_oic_platform_info::manufacture_date, sol_oic_platform_info::manufacturer_name, sol_oic_platform_info::manufacturer_url, sol_oic_platform_info::model_number, sol_oic_platform_info::platform_id, sol_oic_platform_info::platform_version, sol_quit(), sol_quit_with_code(), SOL_STR_SLICE_PRINT, and sol_oic_platform_info::support_url.
Referenced by main().
|
static |
References POST_REQUEST_POWER, sol_oic_map_append(), and SOL_OIC_REPR_INT.
Referenced by found_resource().
|
static |
References check_delete_request(), check_post_request(), check_put_request(), check_response_code(), sol_str_slice::data, dump_byte_string(), sol_oic_repr_field::key, sol_str_slice::len, Context::res, SOL_BUFFER_DECLARE_STATIC, sol_buffer_fini(), sol_buffer_get_slice(), SOL_BUFFER_INIT_EMPTY, SOL_COAP_METHOD_GET, SOL_NETWORK_INET_ADDR_STR_LEN, sol_network_link_addr_to_str(), sol_oic_client_request(), sol_oic_client_request_new(), SOL_OIC_MAP_LOOP, SOL_OIC_REPR_TYPE_BOOL, SOL_OIC_REPR_TYPE_BYTE_STRING, SOL_OIC_REPR_TYPE_DOUBLE, SOL_OIC_REPR_TYPE_FLOAT, SOL_OIC_REPR_TYPE_HALF_FLOAT, SOL_OIC_REPR_TYPE_INT, SOL_OIC_REPR_TYPE_SIMPLE, SOL_OIC_REPR_TYPE_TEXT_STRING, SOL_OIC_REPR_TYPE_UINT, SOL_OIC_REPR_TYPE_UNSUPPORTED, sol_quit(), sol_quit_with_code(), SOL_STR_SLICE_PRINT, TEST_CONFIRMABLE_DELETE, TEST_CONFIRMABLE_POST, TEST_NON_CONFIRMABLE_DELETE, TEST_NON_CONFIRMABLE_POST, TEST_NON_CONFIRMABLE_PUT, Context::test_number, sol_oic_repr_field::type, sol_oic_repr_field::v_boolean, sol_oic_repr_field::v_double, sol_oic_repr_field::v_float, sol_oic_repr_field::v_int, sol_oic_repr_field::v_simple, sol_oic_repr_field::v_slice, sol_oic_repr_field::v_uint, and sol_oic_repr_field::v_voidptr.
Referenced by found_resource().
|
static |
References PUT_REQUEST_POWER, SOL_INT_CHECK, sol_oic_map_append(), SOL_OIC_REPR_BOOL, and SOL_OIC_REPR_INT.
Referenced by found_resource().
|
static |
References check_response_code(), SOL_BUFFER_DECLARE_STATIC, sol_buffer_get_slice(), SOL_NETWORK_INET_ADDR_STR_LEN, sol_network_link_addr_to_str(), sol_quit(), sol_quit_with_code(), SOL_STR_SLICE_PRINT, and Context::test_number.
Referenced by found_resource().
|
static |
References sol_str_slice::data, sol_oic_device_info::data_model_version, sol_oic_device_info::device_id, device_id_decode(), DEVICE_ID_LEN, sol_oic_device_info::device_name, sol_quit(), sol_quit_with_code(), SOL_STR_SLICE_PRINT, and sol_oic_device_info::spec_version.
Referenced by main().
|
static |
Referenced by main().