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
56 // following structure will be created in occollection.
57 typedef struct occapability {
58 struct occapability* next;
60 char *capability; // It is a name about resource capability.
61 char *status; // It is mean status of capability.
65 // following structure will be created in occollection.
66 typedef struct ocaction {
67 struct ocaction *next;
70 // It will be used to execute the action.
76 // following structure will be created in occollection.
77 typedef struct ocactionset {
79 struct ocactionset *next;
88 typedef struct resourcetype_t {
89 struct resourcetype_t *next; // linked list; for multiple types on resource
91 // Name of the type; this string is ‘.’ (dot) separate list of segments where each segment is a
92 // namespace and the final segment is the type; type and sub-types can be separate with
93 // ‘-‘ (dash) usually only two segments would be defined. Either way this string is meant to be
94 // human friendly and is used opaquely and not parsed by code. This name is used in the “rt=”
95 // parameter of a resource description when resources are introspected and is also use in the
96 // <base URI>/types list of available types.
97 char *resourcetypename;
100 typedef struct attr_t {
101 struct attr_t *next; // Points to next resource in list
103 // The name of the attribute; used to look up the attribute in list;
104 // for a given attribute SHOULD not be changed once assigned
105 const char *attrName;
106 char *attrValue; // value of the attribute as string
109 typedef struct resourceinterface_t {
110 struct resourceinterface_t *next; // linked list; for multiple interfaces on resource
112 // Name of the interface; this is ‘.’ (dot) separate list of segments where each segment is a
113 // namespace and the final segment is the interface; usually only two segments would be
114 // defined. Either way this string is opaque and not parsed by segment
117 // Supported content types to serialize request and response on this interface
118 // (REMOVE for V1 – only jSON for all but core.ll that uses Link Format)
120 char *inputContentType ;
121 char *outputContentType ;
123 /*** Future placeholder for access control and policy ***/
124 } OCResourceInterface;
126 typedef struct rsrc_t {
127 struct rsrc_t *next; // Points to next resource in list
128 // Relative path on the device; will be combined with base url to create fully qualified path
131 OCResourceType *rsrcType; // Resource type(s); linked list
132 OCResourceInterface *rsrcInterface; // Resource interface(s); linked list
133 OCAttribute *rsrcAttributes; // Resource interface(s); linked list
134 // Array of pointers to resources; can be used to represent a container of resources
135 // (i.e. hierarchies of resources) or for reference resources (i.e. for a resource collection)
136 struct rsrc_t *rsrcResources[MAX_CONTAINED_RESOURCES];
137 //struct rsrc_t *rsrcResources;
138 // Pointer to function that handles the entity bound to the resource.
139 // This handler has to be explicitly defined by the programmer
140 OCEntityHandler entityHandler;
141 // Properties on the resource – defines meta information on the resource
142 OCResourceProperty resourceProperties ; /* ACTIVE, DISCOVERABLE etc */
143 // Pointer to an opaque object where app/user specific data can be placed with the resource;
144 // this could be information for the entity handler between invocations
146 // NOTE: Methods supported by this resource should be based on the interface targeted
147 // i.e. look into the interface structure based on the query request Can be removed here;
148 // place holder for the note above
149 /* method_t methods; */
150 // Sequence number for observable resources. Per the CoAP standard it is a 24 bit value.
151 uint32_t sequenceNum;
152 // Pointer of ActionSet which to support group action.
153 OCActionSet *actionsetHead;
158 #endif /* OCRESOURCE_H_ */