Merge test folder of test branch
[iotivity.git] / test / src / tc / pm / gtest / csdk / include / PMCsdkMotHelper.h
1 /******************************************************************
2  *
3  * Copyright 2016 Samsung Electronics All Rights Reserved.
4  *
5  *
6  *
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
10  *
11  *      LICENSE-2.0" target="_blank">http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  *
20  ******************************************************************/
21 #ifndef PMCsdkMotHelper_H_
22 #define PMCsdkMotHelper_H_
23 #ifdef __MOT__
24 #include "PMCsdkUtilityHelper.h"
25
26 #define ctxProvisionPreconfPin "ProvisionPreconfPin Context"
27 #define ctxChangeMOTMode "OCChangeMOTMode Context"
28 #define ctxSelectMOTMethod "OCSelectMOTMethod Context"
29
30 class PMCsdkMotHelper
31 {
32 private:
33     std::string m_failureMessage;
34
35 public:
36
37     PMCsdkMotHelper();
38
39     static FILE* fopenMotClient(const char*, const char*);
40
41     bool initMotClient();
42
43     bool discoverMultipleOwnerEnabledDevices(int nTime, OCProvisionDev_t** motdev_list,
44             OCStackResult expectedResult);
45
46     bool discoverMultipleOwnerEnabledSingleDevice(unsigned short timeoutSeconds,
47             const OicUuid_t *deviceID, OCProvisionDev_t **motdev_list, OCStackResult expectedResult);
48
49     bool discoverMultipleOwnedDevices(int nTime, OCProvisionDev_t** motOnwedDev_list,
50             OCStackResult expectedResult);
51
52     bool addPreconfigPIN(const OCProvisionDev_t *targetDeviceInfo, const char* preconfPIN,
53             size_t preconfPINLen, OCStackResult expectedResult);
54
55     bool doMultipleOwnershipTransfer(void* ctx, OCProvisionDev_t *targetDevices,
56             OCProvisionResultCB resultCallback, OCStackResult expectedResult);
57
58     bool isSubownerOfDevice(OCProvisionDev_t *device, bool *isSubowner,
59             OCStackResult expectedResult, bool expectedVal);
60
61     bool provisionPreconfPin(void* ctx, OCProvisionDev_t *targetDeviceInfo, const char * preconfPin, size_t preconfPinLen, OCProvisionResultCB resultCallback, OCStackResult expectedResult);
62
63     bool changeMOTMode(void *ctx, const OCProvisionDev_t *targetDeviceInfo, const OicSecMomType_t momType, OCProvisionResultCB resultCallback, OCStackResult expectedResult);
64
65     bool selectMOTMethod(void *ctx, const OCProvisionDev_t *targetDeviceInfo, const OicSecOxm_t oxmSelValue, OCProvisionResultCB resultCallback, OCStackResult expectedResult);
66
67     static void provisionPreconfPinCB(void* ctx, size_t nOfRes, OCProvisionResult_t* arr, bool hasError);
68
69     static void changeMOTModeCB(void* ctx, size_t nOfRes, OCProvisionResult_t* arr, bool hasError);
70
71     static void selectMOTMethodCB(void* ctx, size_t nOfRes, OCProvisionResult_t* arr, bool hasError);
72
73     /**
74      * Callback Methods
75      */
76     static void multipleOwnershipTransferCB(void* ctx, size_t nOfRes, OCProvisionResult_t* arr,
77             bool hasError);
78
79     /**
80      * All Utility Methods for Provision Manager
81      */
82     std::string getFailureMessage();
83
84     int waitCallbackRet(void);
85 };
86 #endif /*_MOT_*/
87 #endif /*PMCsdkMotHelper_H_*/