1 //******************************************************************
3 // Copyright 2015 Samsung Electronics 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 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
21 #ifndef __PROVISIONING_HANDLER_H_
22 #define __PROVISIONING_HANDLER_H_
28 //-----------------------------------------------------------------------------
30 //-----------------------------------------------------------------------------
31 #define TAG "provisioninghandler"
32 #define DEFAULT_CONTEXT_VALUE 0x99
33 #ifndef MAX_LENGTH_IPv4_ADDR
34 #define MAX_LENGTH_IPv4_ADDR 16
37 //-----------------------------------------------------------------------------
39 //-----------------------------------------------------------------------------
42 * List of methods that can be inititated from the client
44 OCStackResult InitProvisioningHandler();
46 OCStackResult TerminateProvisioningHandler();
48 void listeningFunc(void*);
50 OCStackApplicationResult ProvisionEnrolleeResponse(void* ctx, OCDoHandle handle,
51 OCClientResponse * clientResponse);
53 OCStackResult ProvisionEnrollee(OCQualityOfService qos, const char* query, const char* resUri);
55 OCStackApplicationResult GetProvisioningStatusResponse(void* ctx,
56 OCDoHandle handle, OCClientResponse * clientResponse);
58 OCStackResult InvokeOCDoResource(const char* query, OCMethod method,
59 OCQualityOfService qos, OCClientResponseHandler cb, const char* request,
60 OCHeaderOption * options, uint8_t numOptions);
62 OCStackResult GetProvisioningStatus(OCQualityOfService qos, const char* query);
64 OCStackResult StartProvisioningProcess(const EnrolleeNWProvInfo_t *netInfo,
65 OCProvisioningStatusCB provisioningStatusCallback);
68 void StopProvisioningProcess();
70 OCStackApplicationResult SubscribeProvPresenceCallback(void* ctx, OCDoHandle handle,
71 OCClientResponse* clientResponse);
73 OCStackResult SubscribeProvPresence(OCQualityOfService qos, const char* requestURI);
75 OCStackApplicationResult FindProvisioningResourceResponse(void* ctx,
76 OCDoHandle handle, OCClientResponse * clientResponse);
78 void FindProvisioningResource(void *data);
80 //Invoke Provisioning Status Callback
81 ProvisioningInfo* PrepareProvisioingStatusCB(OCClientResponse * clientResponse,
82 ProvStatus provStatus);