IoTivity C++ SDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
escommon.h File Reference

Go to the source code of this file.

Macros

#define OC_RSRVD_ES_RES_TYPE_COL   "oic.wk.col"
 
#define OC_RSRVD_ES_INTERFACE   "if"
 
#define OC_RSRVD_ES_RES_TYPE   "rt"
 
#define OIC_STRING_MAX_VALUE   64
 
#define OIC_URI_STRING_MAX_VALUE   256
 
#define MAX_WEBLINKLEN   3
 
#define NUM_WIFIMODE   10
 
#define NUM_WIFIFREQ   5
 
#define NUM_CONNECT_TYPE   3
 
#define NUM_WIFIAUTHTYPE   4
 
#define NUM_WIFIENCTYPE   6
 
#define OC_RSRVD_ES_PROVSTATUS   "ps"
 Attributes used to form a proper easysetup conforming JSON message. More...
 
#define OC_RSRVD_ES_LAST_ERRORCODE   "lec"
 
#define OC_RSRVD_ES_LINKS   "links"
 
#define OC_RSRVD_ES_SUPPORTEDWIFIMODE   "swmt"
 
#define OC_RSRVD_ES_SUPPORTEDWIFIFREQ   "swf"
 
#define OC_RSRVD_ES_SUPPORTEDWIFIAUTHTYPE   "swat"
 
#define OC_RSRVD_ES_SUPPORTEDWIFIENCTYPE   "swet"
 
#define OC_RSRVD_ES_SSID   "tnn"
 
#define OC_RSRVD_ES_CRED   "cd"
 
#define OC_RSRVD_ES_AUTHTYPE   "wat"
 
#define OC_RSRVD_ES_ENCTYPE   "wet"
 
#define OC_RSRVD_ES_AUTHCODE   "ac"
 
#define OC_RSRVD_ES_ACCESSTOKEN   "at"
 
#define OC_RSRVD_ES_ACCESSTOKEN_TYPE   "att"
 
#define OC_RSRVD_ES_AUTHPROVIDER   "apn"
 
#define OC_RSRVD_ES_CISERVER   "cis"
 
#define OC_RSRVD_ES_SERVERID   "sid"
 
#define OC_RSRVD_ES_DEVNAME   "dn"
 
#define OC_RSRVD_ES_HREF   "href"
 
#define OC_RSRVD_ES_CONNECT   "cn"
 
#define OC_RSRVD_ES_RES_TYPE_EASYSETUP   "oic.r.easysetup"
 Easysetup defined resoruce types and uris. More...
 
#define OC_RSRVD_ES_URI_EASYSETUP   "/EasySetupResURI"
 
#define OC_RSRVD_ES_RES_TYPE_WIFICONF   "oic.r.wificonf"
 
#define OC_RSRVD_ES_URI_WIFICONF   "/WiFiConfResURI"
 
#define OC_RSRVD_ES_RES_TYPE_COAPCLOUDCONF   "oic.r.coapcloudconf"
 
#define OC_RSRVD_ES_URI_COAPCLOUDCONF   "/CoapCloudConfResURI"
 
#define OC_RSRVD_ES_RES_TYPE_DEVCONF   "oic.r.devconf"
 
#define OC_RSRVD_ES_URI_DEVCONF   "/DevConfResURI"
 

Typedefs

typedef enum ESEnrolleeState ProvStatus
 

Enumerations

enum  WIFI_FREQ { WIFI_24G = 0, WIFI_5G, WIFI_BOTH, WIFI_FREQ_NONE }
 Supported WIFI frequency like 2.4G and 5G. More...
 
enum  WIFI_MODE {
  WIFI_11A = 0, WIFI_11B, WIFI_11G, WIFI_11N,
  WIFI_11AC
}
 Supported WIFI mode like 802.11g and 802.11n. More...
 
enum  WIFI_AUTHTYPE { NONE_AUTH = 0, WEP, WPA_PSK, WPA2_PSK }
 WIFI Authentication tlype of the Enroller. More...
 
enum  WIFI_ENCTYPE {
  NONE_ENC = 0, WEP_64, WEP_128, TKIP,
  AES, TKIP_AES
}
 WIFI encryption type of the Enroller. More...
 
enum  OAUTH_TOKENTYPE { NONE_OAUTH_TOKENTYPE = 0, OAUTH_TOKENTYPE_BEARER, OAUTH_TOKENTYPE_MAC }
 OAuth Access Token Types. More...
 
enum  ES_CONNECT_TYPE { ES_CONNECT_NONE = 0, ES_CONNECT_WIFI = 1, ES_CONNECT_COAPCLOUD = 2 }
 A target configuration type to be connected (or executed) More...
 
enum  ESResult {
  ES_OK = 0, ES_SECURE_RESOURCE_IS_DISCOVERED = 1, ES_ENROLLEE_DISCOVERY_FAILURE = 11, ES_COMMUNICATION_ERROR,
  ES_SEC_OPERATION_IS_NOT_SUPPORTED, ES_SECURE_RESOURCE_DISCOVERY_FAILURE, ES_OWNERSHIP_TRANSFER_FAILURE = 20, ES_USER_DENIED_CONFIRMATION_REQ,
  ES_AUTHENTICATION_FAILURE_WITH_WRONG_CERT, ES_AUTHENTICATION_FAILURE_WITH_WRONG_PIN, ES_OWNERSHIP_IS_NOT_SYNCHRONIZED, ES_MOT_NOT_SUPPORTED = 30,
  ES_MOT_ENABLING_FAILURE, ES_MOT_METHOD_SELECTION_FAILURE, ES_PRE_CONFIG_PIN_PROVISIONING_FAILURE, ES_ACL_PROVISIONING_FAILURE = 40,
  ES_CERT_PROVISIONING_FAILURE, ES_ERROR = 255
}
 A result of Easy Setup. More...
 
enum  ESResourceMask { ES_WIFICONF_RESOURCE = 0x01, ES_COAPCLOUDCONF_RESOURCE = 0x02, ES_DEVCONF_RESOURCE = 0x04 }
 Indicate which resource is created in Enrollee. More...
 
enum  ESEnrolleeState {
  ES_STATE_INIT = 0, ES_STATE_CONNECTING_TO_ENROLLER, ES_STATE_CONNECTED_TO_ENROLLER, ES_STATE_FAILED_TO_CONNECT_TO_ENROLLER,
  ES_STATE_REGISTERING_TO_CLOUD, ES_STATE_REGISTERED_TO_CLOUD, ES_STATE_FAILED_TO_REGISTER_TO_CLOUD, ES_STATE_PUBLISHING_RESOURCES_TO_CLOUD,
  ES_STATE_PUBLISHED_RESOURCES_TO_CLOUD, ES_STATE_FAILED_TO_PUBLISH_RESOURCES_TO_CLOUD, ES_STATE_EOF = 255
}
 Indicate enrollee and provisioning status. More...
 
enum  ESErrorCode {
  ES_ERRCODE_NO_ERROR = 0, ES_ERRCODE_SSID_NOT_FOUND, ES_ERRCODE_PW_WRONG, ES_ERRCODE_IP_NOT_ALLOCATED,
  ES_ERRCODE_NO_INTERNETCONNECTION, ES_ERRCODE_TIMEOUT, ES_ERRCODE_AUTH_TYPE_NOT_SUPPORTED, ES_ERRCODE_ENC_TYPE_NOT_SUPPORTED,
  ES_ERRCODE_AUTH_TYPE_INVALID, ES_ERRCODE_ENC_TYPE_INVALID, ES_ERRCODE_FAILED_TO_ACCESS_CLOUD_SERVER, ES_ERRCODE_NO_RESPONSE_FROM_CLOUD_SERVER,
  ES_ERRCODE_INVALID_AUTHCODE, ES_ERRCODE_INVALID_ACCESSTOKEN, ES_ERRCODE_FAILED_TO_REFRESH_ACCESSTOKEN, ES_ERRCODE_FAILED_TO_FIND_REGISTERED_DEVICE_IN_CLOUD,
  ES_ERRCODE_FAILED_TO_FIND_REGISTERED_USER_IN_CLOUD, ES_ERRCODE_UNSUPPORTED_WIFI_FREQUENCY, ES_ERRCODE_UNKNOWN = 255
}
 Indicate last error code to describe a reason of error during easy setup. More...
 

Macro Definition Documentation

#define MAX_WEBLINKLEN   3
#define NUM_CONNECT_TYPE   3
#define NUM_WIFIAUTHTYPE   4
#define NUM_WIFIENCTYPE   6
#define NUM_WIFIFREQ   5
#define NUM_WIFIMODE   10
#define OC_RSRVD_ES_ACCESSTOKEN   "at"
#define OC_RSRVD_ES_ACCESSTOKEN_TYPE   "att"
#define OC_RSRVD_ES_AUTHCODE   "ac"
#define OC_RSRVD_ES_AUTHPROVIDER   "apn"
#define OC_RSRVD_ES_AUTHTYPE   "wat"
#define OC_RSRVD_ES_CISERVER   "cis"
#define OC_RSRVD_ES_CONNECT   "cn"
#define OC_RSRVD_ES_CRED   "cd"
#define OC_RSRVD_ES_DEVNAME   "dn"
#define OC_RSRVD_ES_ENCTYPE   "wet"
#define OC_RSRVD_ES_HREF   "href"
#define OC_RSRVD_ES_INTERFACE   "if"
#define OC_RSRVD_ES_LAST_ERRORCODE   "lec"
#define OC_RSRVD_ES_LINKS   "links"
#define OC_RSRVD_ES_PROVSTATUS   "ps"

Attributes used to form a proper easysetup conforming JSON message.

#define OC_RSRVD_ES_RES_TYPE   "rt"
#define OC_RSRVD_ES_RES_TYPE_COAPCLOUDCONF   "oic.r.coapcloudconf"
#define OC_RSRVD_ES_RES_TYPE_COL   "oic.wk.col"
#define OC_RSRVD_ES_RES_TYPE_DEVCONF   "oic.r.devconf"
#define OC_RSRVD_ES_RES_TYPE_EASYSETUP   "oic.r.easysetup"

Easysetup defined resoruce types and uris.

#define OC_RSRVD_ES_RES_TYPE_WIFICONF   "oic.r.wificonf"
#define OC_RSRVD_ES_SERVERID   "sid"
#define OC_RSRVD_ES_SSID   "tnn"
#define OC_RSRVD_ES_SUPPORTEDWIFIAUTHTYPE   "swat"
#define OC_RSRVD_ES_SUPPORTEDWIFIENCTYPE   "swet"
#define OC_RSRVD_ES_SUPPORTEDWIFIFREQ   "swf"
#define OC_RSRVD_ES_SUPPORTEDWIFIMODE   "swmt"
#define OC_RSRVD_ES_URI_COAPCLOUDCONF   "/CoapCloudConfResURI"
#define OC_RSRVD_ES_URI_DEVCONF   "/DevConfResURI"
#define OC_RSRVD_ES_URI_EASYSETUP   "/EasySetupResURI"
#define OC_RSRVD_ES_URI_WIFICONF   "/WiFiConfResURI"
#define OIC_STRING_MAX_VALUE   64
#define OIC_URI_STRING_MAX_VALUE   256

Typedef Documentation

Enumeration Type Documentation

A target configuration type to be connected (or executed)

Enumerator
ES_CONNECT_NONE 

Init value.

ES_CONNECT_WIFI 

WiFi Conf resource.

ES_CONNECT_COAPCLOUD 

Coap Cloud Conf resource.

Indicate enrollee and provisioning status.

Provisioning status is shown in "provisioning status" property in easysetup resource.

Enumerator
ES_STATE_INIT 

Default state of the device.

ES_STATE_CONNECTING_TO_ENROLLER 

Status indicating being connecting to target network.

ES_STATE_CONNECTED_TO_ENROLLER 

Status indicating successful conection to target network.

ES_STATE_FAILED_TO_CONNECT_TO_ENROLLER 

Status indicating connection failure to target network.

ES_STATE_REGISTERING_TO_CLOUD 

Status indicating being registering to cloud.

ES_STATE_REGISTERED_TO_CLOUD 

Status indicating successful registration to cloud.

ES_STATE_FAILED_TO_REGISTER_TO_CLOUD 

Status indicating registeration failure to cloud.

ES_STATE_PUBLISHING_RESOURCES_TO_CLOUD 

Status indicating being publishing resources to cloud.

ES_STATE_PUBLISHED_RESOURCES_TO_CLOUD 

Status indicating successful resource publish to cloud.

ES_STATE_FAILED_TO_PUBLISH_RESOURCES_TO_CLOUD 

Status indicating resource publish failure to cloud.

ES_STATE_EOF 

End of Easy setup status.

Indicate last error code to describe a reason of error during easy setup.

Enumerator
ES_ERRCODE_NO_ERROR 

Init Error Code.

ES_ERRCODE_SSID_NOT_FOUND 

WiFi's SSID is not found.

ES_ERRCODE_PW_WRONG 

WiFi's Password is wrong.

ES_ERRCODE_IP_NOT_ALLOCATED 

IP address is not allocated.

ES_ERRCODE_NO_INTERNETCONNECTION 

There is no Internet connection.

ES_ERRCODE_TIMEOUT 

Timeout occured.

ES_ERRCODE_AUTH_TYPE_NOT_SUPPORTED 

Auth type is not supported by the Enrollee.

ES_ERRCODE_ENC_TYPE_NOT_SUPPORTED 

Enc type is not supported by the Enrollee.

ES_ERRCODE_AUTH_TYPE_INVALID 

Auth type is not supported by the Enroller.

ES_ERRCODE_ENC_TYPE_INVALID 

Enc type is not supported by the Enroller.

ES_ERRCODE_FAILED_TO_ACCESS_CLOUD_SERVER 

Cloud server is not reachable due to wrong URL of cloud server, for example.

ES_ERRCODE_NO_RESPONSE_FROM_CLOUD_SERVER 

No response from cloud server.

ES_ERRCODE_INVALID_AUTHCODE 

Delivered authcode is not valid.

ES_ERRCODE_INVALID_ACCESSTOKEN 

Access token is not valid due to its expiration, for example.

ES_ERRCODE_FAILED_TO_REFRESH_ACCESSTOKEN 

Refresh of expired access token is failed due to some reasons.

ES_ERRCODE_FAILED_TO_FIND_REGISTERED_DEVICE_IN_CLOUD 

Target device is not discovered in cloud server.

ES_ERRCODE_FAILED_TO_FIND_REGISTERED_USER_IN_CLOUD 

Target user does not exist in cloud server.

ES_ERRCODE_UNSUPPORTED_WIFI_FREQUENCY 

Enrollee can not connect to a target WiFi AP because the AP resides in an unsupported WiFi frequency.

ES_ERRCODE_UNKNOWN 

Unknown error occured.

Indicate which resource is created in Enrollee.

Enumerator
ES_WIFICONF_RESOURCE 
ES_COAPCLOUDCONF_RESOURCE 
ES_DEVCONF_RESOURCE 
enum ESResult

A result of Easy Setup.

Enumerator
ES_OK 

Provisioning succeeds.

ES_SECURE_RESOURCE_IS_DISCOVERED 

Secure resource is discovered.

ES_ENROLLEE_DISCOVERY_FAILURE 

Enrollee discovery fails in cloud provisioning.

ES_COMMUNICATION_ERROR 

Valid GET or POST request fails for some reason.

This failure may happen when it failed to receive any response from Enrollee by a timeout threshold

ES_SEC_OPERATION_IS_NOT_SUPPORTED 

Security opertion is not supported because Mediator is built as unsecured mode.

ES_SECURE_RESOURCE_DISCOVERY_FAILURE 

Security resource discovery fails due to loss of discovery packet or absence of the resource in a network.

ES_OWNERSHIP_TRANSFER_FAILURE 

Ownership transfer fails due to one of unexpected reasons.

E.g. A packet loss even with retransmission happens during ownership transfer. E.g. Mediator's owned status is 'unowned' E.g. A user confirmation for random pin-based or certificate-based OT fails

ES_USER_DENIED_CONFIRMATION_REQ 

Ownership transfer which is cert-based method fails due to user confirmation is denied.

ES_AUTHENTICATION_FAILURE_WITH_WRONG_CERT 

Ownership transfer which is cert-based method fails due to wrong certificate.

ES_AUTHENTICATION_FAILURE_WITH_WRONG_PIN 

Ownership transfer which is random-pin method fails due to wrong pin.

ES_OWNERSHIP_IS_NOT_SYNCHRONIZED 

Ownership information is not synchronized between Mediator and Enrollee.

e.g. A mediator's PDM DB has an ownership information to the found enrollee but it is actually owned by other mediator. That can happen where the found enrollee is reset and performed in easy setup without any inform to the first mediator. e.g. A list of owned devices managed in mediator's PMD db has no element for the found enrollee. That can happen where only mediator is reset without any inform to the enrollee. To proceed an ownership transfer to the enrollee, it needs to reset the enrollee's SVR DB for its owner, i.e. the mediator

ES_MOT_NOT_SUPPORTED 

MOT is not supported at the target Enrollee device.

Note
This ESResult values will be returned ONLY IF a mediator is a first owner to an Enrollee.
If the mediator gets this values, it means OT has been successfully done (or already took an ownership, before), but failed MOT configuration.
ES_MOT_ENABLING_FAILURE 

MOT enabling is failed.

Note
This ESResult values will be returned ONLY IF a mediator is a first owner to an Enrollee.
If the mediator gets this values, it means OT has been successfully done (or already took an ownership, before), but failed MOT configuration.
ES_MOT_METHOD_SELECTION_FAILURE 

MOT method selection is failed.

Note
This ESResult values will be returned ONLY IF a mediator is a first owner to an Enrollee.
If the mediator gets this values, it means OT has been successfully done (or already took an ownership, before), but failed MOT configuration.
ES_PRE_CONFIG_PIN_PROVISIONING_FAILURE 

A provisioning of Pre-configured pin number for MOT is failed.

Note
This ESResult values will be returned ONLY IF a mediator is a first owner to an Enrollee.
If the mediator gets this values, it means OT has been successfully done (or already took an ownership, before), but failed MOT configuration.
ES_ACL_PROVISIONING_FAILURE 

ACL provisioning fails in cloud provisioning.

It could be that UUID format of cloud server is wrong. Or any response for the provisioning request is not arrived at Mediator

ES_CERT_PROVISIONING_FAILURE 

Cert.

provisioning fails in cloud provisioning. It could be that you put a wrong cred ID of which the corresponding certificate does not exist in SVR DB. Or any response for the provisioning request is not arrived at Mediator

ES_ERROR 

Provisioning fails for some reason.

OAuth Access Token Types.

"bearer" and "mac" types are supported.

Enumerator
NONE_OAUTH_TOKENTYPE 
OAUTH_TOKENTYPE_BEARER 
OAUTH_TOKENTYPE_MAC 

WIFI Authentication tlype of the Enroller.

Enumerator
NONE_AUTH 

NO authentication.

WEP 

WEP.

WPA_PSK 

WPA-PSK.

WPA2_PSK 

WPA2-PSK.

WIFI encryption type of the Enroller.

Enumerator
NONE_ENC 

NO encryption.

WEP_64 

WEP-64.

WEP_128 

WEP-128.

TKIP 

TKIP.

AES 

AES.

TKIP_AES 

TKIP-AES.

enum WIFI_FREQ

Supported WIFI frequency like 2.4G and 5G.

Enumerator
WIFI_24G 

2.4G

WIFI_5G 

5G

WIFI_BOTH 

2.4G and 5G

WIFI_FREQ_NONE 

EOF.

enum WIFI_MODE

Supported WIFI mode like 802.11g and 802.11n.

Enumerator
WIFI_11A 

802.11a

WIFI_11B 

802.11b

WIFI_11G 

802.11g

WIFI_11N 

802.11n

WIFI_11AC 

802.11ac