1 //******************************************************************
3 // Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved.
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
7 // Licensed under the Apache License, Version 2.0 (the "License");
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
11 // http://www.apache.org/licenses/LICENSE-2.0
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an "AS IS" BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
24 #define OC_OBSERVER_NOT_INTERESTED (0)
25 #define OC_OBSERVER_STILL_INTERESTED (1)
26 #define OC_OBSERVER_FAILED_COMM (2)
28 //-----------------------------------------------------------------------------
29 // Virtual Resource Presence Attributes
30 //-----------------------------------------------------------------------------
32 typedef struct PRESENCERESOURCE{
33 OCResourceHandle handle;
38 //-----------------------------------------------------------------------------
39 // Forward declarations
40 //-----------------------------------------------------------------------------
43 //-----------------------------------------------------------------------------
45 //-----------------------------------------------------------------------------
47 // IF here stands for Interface
55 typedef struct resourcetype_t {
56 struct resourcetype_t *next; // linked list; for multiple types on resource
58 // Name of the type; this string is ‘.’ (dot) separate list of segments where each segment is a
59 // namespace and the final segment is the type; type and sub-types can be separate with
60 // ‘-‘ (dash) usually only two segments would be defined. Either way this string is meant to be
61 // human friendly and is used opaquely and not parsed by code. This name is used in the “rt=”
62 // parameter of a resource description when resources are introspected and is also use in the
63 // <base URI>/types list of available types.
64 char *resourcetypename;
67 typedef struct attr_t {
68 struct attr_t *next; // Points to next resource in list
70 // The name of the attribute; used to look up the attribute in list;
71 // for a given attribute SHOULD not be changed once assigned
73 char *attrValue; // value of the attribute as string
76 typedef struct resourceinterface_t {
77 struct resourceinterface_t *next; // linked list; for multiple interfaces on resource
79 // Name of the interface; this is ‘.’ (dot) separate list of segments where each segment is a
80 // namespace and the final segment is the interface; usually only two segments would be
81 // defined. Either way this string is opaque and not parsed by segment
84 // Supported content types to serialize request and response on this interface
85 // (REMOVE for V1 – only jSON for all but core.ll that uses Link Format)
87 char *inputContentType ;
88 char *outputContentType ;
90 /*** Future placeholder for access control and policy ***/
91 } OCResourceInterface;
93 typedef struct rsrc_t {
94 struct rsrc_t *next; // Points to next resource in list
95 // Relative path on the device; will be combined with base url to create fully qualified path
98 OCResourceType *rsrcType; // Resource type(s); linked list
99 OCResourceInterface *rsrcInterface; // Resource interface(s); linked list
100 OCAttribute *rsrcAttributes; // Resource interface(s); linked list
101 // Array of pointers to resources; can be used to represent a container of resources
102 // (i.e. hierarchies of resources) or for reference resources (i.e. for a resource collection)
103 struct rsrc_t *rsrcResources[MAX_CONTAINED_RESOURCES];
104 //struct rsrc_t *rsrcResources;
105 // Pointer to function that handles the entity bound to the resource.
106 // This handler has to be explicitly defined by the programmer
107 OCEntityHandler entityHandler;
108 // Properties on the resource – defines meta information on the resource
109 OCResourceProperty resourceProperties ; /* ACTIVE, DISCOVERABLE etc */
110 // Pointer to an opaque object where app/user specific data can be placed with the resource;
111 // this could be information for the entity handler between invocations
113 // NOTE: Methods supported by this resource should be based on the interface targeted
114 // i.e. look into the interface structure based on the query request Can be removed here;
115 // place holder for the note above
116 /* method_t methods; */
117 // Sequence number for observable resources. Per the CoAP standard it is a 24 bit value.
118 uint32_t sequenceNum;
123 #endif /* OCRESOURCE_H_ */