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 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
22 #ifndef __PROVISIONING_HANDLER_H_
23 #define __PROVISIONING_HANDLER_H_
32 //-----------------------------------------------------------------------------
34 //-----------------------------------------------------------------------------
35 #define TAG "provisioninghandler"
36 #define DEFAULT_CONTEXT_VALUE 0x99
37 #ifndef MAX_LENGTH_IPv4_ADDR
38 #define MAX_LENGTH_IPv4_ADDR 16
41 //-----------------------------------------------------------------------------
43 //-----------------------------------------------------------------------------
46 * List of methods that can be inititated from the client
48 OCStackResult InitProvisioningHandler();
50 OCStackResult TerminateProvisioningHandler();
52 void listeningFunc(void*);
54 OCStackApplicationResult ProvisionEnrolleeResponse(void* ctx, OCDoHandle handle,
55 OCClientResponse * clientResponse);
57 OCStackResult ProvisionEnrollee(OCQualityOfService qos, const char* query, const char* resUri);
59 OCStackApplicationResult GetProvisioningStatusResponse(void* ctx,
60 OCDoHandle handle, OCClientResponse * clientResponse);
62 OCStackResult InvokeOCDoResource(const char* query, OCMethod method,
63 OCQualityOfService qos, OCClientResponseHandler cb,OCRepPayload * request,
64 OCHeaderOption * options, uint8_t numOptions);
66 OCStackResult GetProvisioningStatus(OCQualityOfService qos, const char* query);
68 OCStackResult StartProvisioningProcess(const EnrolleeNWProvInfo_t *netInfo,
69 OCProvisioningStatusCB provisioningStatusCallback);
72 void StopProvisioningProcess();
74 OCStackApplicationResult SubscribeProvPresenceCallback(void* ctx, OCDoHandle handle,
75 OCClientResponse* clientResponse);
77 OCStackResult SubscribeProvPresence(OCQualityOfService qos, const char* requestURI);
79 OCStackApplicationResult FindProvisioningResourceResponse(void* ctx,
80 OCDoHandle handle, OCClientResponse * clientResponse);
82 void FindProvisioningResource(void *data);
84 //Invoke Provisioning Status Callback
85 ProvisioningInfo* PrepareProvisioingStatusCB(OCClientResponse * clientResponse,
86 ProvStatus provStatus);