Soletta™ Framework
Framework for making IoT devices

Full online documentation | C API Index
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
sol-oic-client.h
Go to the documentation of this file.
1 /*
2  * This file is part of the Soletta (TM) Project
3  *
4  * Copyright (C) 2015 Intel Corporation. All rights reserved.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 
19 #pragma once
20 
21 #include <stdbool.h>
22 #include <stdint.h>
23 #include <sol-coap.h>
24 #include <sol-network.h>
25 #include <sol-str-slice.h>
26 #include <sol-vector.h>
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 #include "sol-oic.h"
33 
55 struct sol_oic_client;
57 
68 struct sol_oic_pending;
70 
77 typedef struct sol_oic_resource {
78 #ifndef SOL_NO_API_VERSION
79 #define SOL_OIC_RESOURCE_API_VERSION (1)
80  uint16_t api_version;
81 #endif
82 
89  const struct sol_str_slice path;
93  const struct sol_str_slice device_id;
98  const struct sol_vector types;
102  const struct sol_vector interfaces;
106  const bool observable;
111  const bool secure;
113 
121 struct sol_oic_client *sol_oic_client_new(void);
122 
133 void sol_oic_client_del(struct sol_oic_client *client);
134 
141 
184  struct sol_network_link_addr *addr, const char *resource_type,
185  const char *resource_interface,
186  bool (*resource_found_cb)(void *data, struct sol_oic_client *cli,
187  struct sol_oic_resource *res),
188  const void *data);
189 
221  struct sol_oic_resource *resource,
222  void (*info_received_cb)(void *data, struct sol_oic_client *cli,
223  const struct sol_oic_platform_info *info),
224  const void *data);
225 
258  struct sol_network_link_addr *addr,
259  void (*info_received_cb)(void *data, struct sol_oic_client *cli,
260  const struct sol_oic_platform_info *info),
261  const void *data);
262 
294  struct sol_oic_resource *resource,
295  void (*info_received_cb)(void *data, struct sol_oic_client *cli,
296  const struct sol_oic_device_info *info),
297  const void *data);
298 
328  struct sol_network_link_addr *addr,
329  void (*info_received_cb)(void *data, struct sol_oic_client *cli,
330  const struct sol_oic_device_info *info),
331  const void *data);
332 
359  struct sol_oic_request *request,
360  void (*callback)(void *data, enum sol_coap_response_code response_code,
361  struct sol_oic_client *cli, const struct sol_network_link_addr *addr,
362  const struct sol_oic_map_reader *repr_vec), const void *callback_data);
363 
375 
387 
393 void sol_oic_client_request_free(struct sol_oic_request *request);
394 
404 
437  void (*callback)(void *data, enum sol_coap_response_code response_code, struct sol_oic_client *cli, const struct sol_network_link_addr *addr,
438  const struct sol_oic_map_reader *repr_map),
439  const void *data, bool observe);
440 
477  void (*callback)(void *data, enum sol_coap_response_code response_code, struct sol_oic_client *cli, const struct sol_network_link_addr *addr,
478  const struct sol_oic_map_reader *repr_map),
479  const void *data, bool observe);
480 
491 
500 
505 #ifdef __cplusplus
506 }
507 #endif
struct sol_http_client_connection * pending
Definition: download.c:29
uint16_t api_version
API version.
Definition: sol-oic-client.h:80
void sol_oic_client_request_free(struct sol_oic_request *request)
Release memory from a request.
struct sol_oic_request * sol_oic_client_non_confirmable_request_new(enum sol_coap_method method, struct sol_oic_resource *res)
Create an OIC client request for an specific resource, using a non-confirmable CoAP packet...
Structure defining an OIC resource.
Definition: sol-oic-client.h:77
struct sol_oic_pending * sol_oic_client_find_resources(struct sol_oic_client *client, struct sol_network_link_addr *addr, const char *resource_type, const char *resource_interface, bool(*resource_found_cb)(void *data, struct sol_oic_client *cli, struct sol_oic_resource *res), const void *data)
Send a discovevery packet to find resources.
Structure containing all fields that are retrieved by sol_oic_client_get_server_info() and sol_oic_cl...
Definition: sol-oic.h:175
const struct sol_str_slice path
The path pointing at this resource.
Definition: sol-oic-client.h:89
int sol_oic_client_resource_set_observable_non_confirmable(struct sol_oic_client *client, struct sol_oic_resource *res, void(*callback)(void *data, enum sol_coap_response_code response_code, struct sol_oic_client *cli, const struct sol_network_link_addr *addr, const struct sol_oic_map_reader *repr_map), const void *data, bool observe)
Set this resource as observable for this client, using non-confirmable packets.
void sol_oic_resource_unref(struct sol_oic_resource *r)
Release a reference from the given resource.
const bool observable
True if server supports observe mode for this resource.
Definition: sol-oic-client.h:106
struct sol_oic_pending * sol_oic_client_get_server_info(struct sol_oic_client *client, struct sol_oic_resource *resource, void(*info_received_cb)(void *data, struct sol_oic_client *cli, const struct sol_oic_device_info *info), const void *data)
Retrieve server information.
const bool secure
True if the connection established with this resource's server is secure.
Definition: sol-oic-client.h:111
String slice type.
Definition: sol-str-slice.h:84
sol_coap_response_code
Set of response codes available for a response packet.
Definition: sol-coap.h:190
Structure containing all fields that are retrieved by sol_oic_client_get_platform_info() and sol_oic_...
Definition: sol-oic.h:55
const struct sol_vector types
List of resource types (sol_str_slice entries) from this resource.
Definition: sol-oic-client.h:98
struct sol_oic_request sol_oic_request
Information about a client request.
Definition: sol-oic.h:448
struct sol_oic_pending * sol_oic_client_request(struct sol_oic_client *client, struct sol_oic_request *request, void(*callback)(void *data, enum sol_coap_response_code response_code, struct sol_oic_client *cli, const struct sol_network_link_addr *addr, const struct sol_oic_map_reader *repr_vec), const void *callback_data)
Send a request packet to server.
sol_coap_method
Available request methods.
Definition: sol-coap.h:107
struct sol_oic_pending * sol_oic_client_get_platform_info(struct sol_oic_client *client, struct sol_oic_resource *resource, void(*info_received_cb)(void *data, struct sol_oic_client *cli, const struct sol_oic_platform_info *info), const void *data)
Retrieve platform information.
struct sol_oic_map_writer sol_oic_map_writer
Opaque handler for an OIC packet map writer.
Definition: sol-oic.h:384
void sol_oic_client_del(struct sol_oic_client *client)
Delete client.
struct sol_oic_client sol_oic_client
Opaque handler for an OIC client instance.
Definition: sol-oic-client.h:56
struct sol_oic_pending * sol_oic_client_get_platform_info_by_addr(struct sol_oic_client *client, struct sol_network_link_addr *addr, void(*info_received_cb)(void *data, struct sol_oic_client *cli, const struct sol_oic_platform_info *info), const void *data)
Retrieve platform information from addr.
struct sol_oic_pending * sol_oic_client_get_server_info_by_addr(struct sol_oic_client *client, struct sol_network_link_addr *addr, void(*info_received_cb)(void *data, struct sol_oic_client *cli, const struct sol_oic_device_info *info), const void *data)
Retrieve server information from addr.
const struct sol_network_link_addr addr
The resource address.
Definition: sol-oic-client.h:85
const struct sol_vector interfaces
List of interfaces implemented by this resource.
Definition: sol-oic-client.h:102
These are routines that Soletta provides for its string slice implementation.
struct sol_oic_client * sol_oic_client_new(void)
Creates a new OIC client intance.
Soletta vector is an array that grows dynamically.
Definition: sol-vector.h:58
struct sol_oic_pending sol_oic_pending
Represents a pending OIC client call.
Definition: sol-oic-client.h:69
struct sol_oic_request * sol_oic_client_request_new(enum sol_coap_method method, struct sol_oic_resource *res)
Create an OIC client request for an specific resource, using a confirmable CoAP packet.
int sol_oic_client_resource_set_observable(struct sol_oic_client *client, struct sol_oic_resource *res, void(*callback)(void *data, enum sol_coap_response_code response_code, struct sol_oic_client *cli, const struct sol_network_link_addr *addr, const struct sol_oic_map_reader *repr_map), const void *data, bool observe)
Set this resource as observable for this client.
Routines to handle CoAP protocol.
These are routines that Soletta provides for its vector implementation.
Handler for an OIC packet map reader.
Definition: sol-oic.h:431
struct sol_oic_resource * sol_oic_resource_ref(struct sol_oic_resource *r)
Take a reference of the given server.
struct sol_oic_map_writer * sol_oic_client_request_get_writer(struct sol_oic_request *request)
Get the packet writer from a client request.
void sol_oic_pending_cancel(struct sol_oic_pending *pending)
Cancel a pending OIC call.
These are routines that Soletta provides for handling network link interfaces, making it possible to ...
const struct sol_str_slice device_id
The Device ID as a UUID 16-byte array.
Definition: sol-oic-client.h:93
struct sol_oic_resource sol_oic_resource
Structure defining an OIC resource.