resourcehandler.h 2.6 KB
Newer Older
1 2
//******************************************************************
//
3
// Copyright 2015 Samsung Electronics All Rights Reserved.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
//
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

// Do not remove the include below

23
#include <string.h>
24 25
#include "logger.h"
#include "ocstack.h"
26
#include "escommon.h"
27
#include "networkhandler.h"
28 29 30 31 32
#include "octypes.h"

#ifndef ES_RESOURCE_HANDLER_H_
#define ES_RESOURCE_HANDLER_H_

33 34 35 36
#ifdef __cplusplus
extern "C" {
#endif

37
typedef void (*ESEnrolleeResourceEventCallback)(ESResult);
38 39 40 41 42

/* Structure to represent a Light resource */
typedef struct PROVRESOURCE
{
    OCResourceHandle handle;
43 44 45
    int64_t status; // provisiong status, 1 : need to provisioning, 2 : Connected to Enroller.
    bool trigger; // Trigger network connection, 0 : Init value, 1 : Connected to the target network.
    int64_t errorCode;
46 47
} ProvResource;

48
typedef struct
49 50
{
    OCResourceHandle handle;
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
    int64_t supportedMode[NUM_WIFIMODE];
    uint8_t numMode;
    int64_t supportedFreq;
    char ssid[MAXSSIDLEN]; // target network name, i.e. SSID for WLAN, MAC address for BT.
    char cred[MAXNETCREDLEN]; // credential information.
    int64_t authType;
    int64_t encType;
} WiFiResource;

typedef struct
{
    OCResourceHandle handle;
    char authCode[OIC_STRING_MAX_VALUE];
    char authProvider[OIC_STRING_MAX_VALUE];
    char ciServer[OIC_STRING_MAX_VALUE];
} CloudResource;

typedef struct
{
    OCResourceHandle handle;
    char devName[OIC_STRING_MAX_VALUE];
    char language[OIC_STRING_MAX_VALUE];
    char country[OIC_STRING_MAX_VALUE];
} DevConfResource;

76

77
OCStackResult CreateProvisioningResource(bool isSecured);
78
OCStackResult CreateEasySetupResources(bool isSecured);
79
OCStackResult DeleteProvisioningResource();
80 81
OCStackResult DeleteEasySetupResources();

82 83

void GetTargetNetworkInfoFromProvResource(char *, char *);
84
void RegisterResourceEventCallBack(ESEnrolleeResourceEventCallback);
85
void UnRegisterResourceEventCallBack(void);
86

87 88
#ifdef __cplusplus
}
89
#endif
90

91
#endif //ES_RESOURCE_HANDLER_H_