Functions

OCF()

ANT OCF API's main object. OCF only generates OCF adapter, and the OCF adapter takes charge of the main role of OCF API.

OCFAdapter()

OCF Adapter. It manages OCF thread's lifecycle.

OCFDevice(id, uri, resourceType, name, specVersion, dataModelVersion)

OCF Device

OCFResource(device, name, uri, types, interfaceMasks)

OCF Resource.

OCF()

ANT OCF API's main object. OCF only generates OCF adapter, and the OCF adapter takes charge of the main role of OCF API.

Kind: global function

OCFAdapter()

OCF Adapter. It manages OCF thread's lifecycle.

Kind: global function

ocfAdapter.setPlatform(mfgName)

OCFAdapter.setPlatform

Kind: instance method of OCFAdapter

Param Type Description
mfgName String Manufacturer's name

ocfAdapter.getPlatform() ⇒ string

OCFAdapter.getPlatform

Kind: instance method of OCFAdapter
Returns: string - platformName

ocfAdapter.addDevice(uri, resourceType, name, specVersion, dataModelVersion)

OCFAdapter.addDevice

Kind: instance method of OCFAdapter

Param Type Description
uri String id of device to be serviced
resourceType String resource type of device to be serviced
name String name of device to be serviced
specVersion String specification of device to be serviced
dataModelVersion String data model version of device to be serviced Set the device to be serviced by the OCFAdapter. One OCFAdapter can service multiple devices.

ocfAdapter.getDevices() ⇒ Array.<OCFDevice>

OCFAdapter.getDevices

Kind: instance method of OCFAdapter
Returns: Array.<OCFDevice> - devices

ocfAdapter.getDevice(i) ⇒ OCFDevice

OCFAdapter.getDevice

Kind: instance method of OCFAdapter
Returns: OCFDevice - device

Param Type
i Integer

ocfAdapter.onPrepareEventLoop(handler)

OCFAdapter.prototype.onPrepareEventLoop

Kind: instance method of OCFAdapter

Param Type
handler function

ocfAdapter.onPrepareClient(handler)

OCFAdapter.onPrepareClient

Kind: instance method of OCFAdapter

Param Type Description
handler function called when all preparations for executing client functions in the OCF thread are complete

ocfAdapter.onPrepareServer(handler)

OCFAdapter.onPrepareServer

Kind: instance method of OCFAdapter

Param Type Description
handler function called when all preparations for executing server functions in OCF thread are complete

ocfAdapter.start()

OCFAdapter.start Run the OCF thread. This function must be called after OCFAdapter.initialize() is called. You can use the OCF Server API and OCF Client API only while the OCF thread is running. If you need to know exactly when you can use OCF Server API and OCF Client API, you can use the handlers of OCFAdapter.onPrepareServer() and OCFAdapter.onPrepareClient().

Kind: instance method of OCFAdapter

ocfAdapter.stop()

OCFAdapter.stop Stop the OCF thread.

Kind: instance method of OCFAdapter

ocfAdapter.addResource(resource)

OCFAdapter.addResource

Kind: instance method of OCFAdapter

Param Type
resource OCFResource

ocfAdapter.deleteResource(resource)

OCFAdapter.deleteResource

Kind: instance method of OCFAdapter

Param Type
resource OCFResource

ocfAdapter.getResources() ⇒ OCFResource

OCFAdapter.getResources

Kind: instance method of OCFAdapter
Returns: OCFResource - resource

ocfAdapter.repStartRootObject()

OCFAdapter.repStartRootObject Let the OCF thread start writing the OCRepresentation.

Kind: instance method of OCFAdapter

ocfAdapter.repSet(key, value)

OCFAdapter.repSet

Kind: instance method of OCFAdapter

Param Type Description
key String
value Boolean \ Number \ String The value is stored in a specific key among OCRepresentations being created by OCF thread. In this function, various types of data including Boolean, Number, and String can be used as value.

ocfAdapter.repSetBufferAndString(value)

OCFAdapter.repSetBufferAndString

Kind: instance method of OCFAdapter

Param Type Description
value Object The special case of repSet() method. The data can include both byte buffer and string.

ocfAdapter.repEndRootObject()

OCFAdapter.repEndRootObject Finish writing OCRepresentation of OCF thread.

Kind: instance method of OCFAdapter

ocfAdapter.sendResponse(ocfRequest, statusCode, responsePayload)

OCFAdapter.sendResponse

Kind: instance method of OCFAdapter

Param Type Description
ocfRequest OCFRequest target of response
statusCode Number Response status code value
responsePayload Object Payload of response Sends a response with a specific status code to a request from another device.

ocfAdapter.sendResponseBuffer(ocfRequest, statusCode, responsePayloadBuffer, responsePayloadString)

OCFAdapter.sendResponseBuffer

Kind: instance method of OCFAdapter

Param Type Description
ocfRequest OCFRequest target of response
statusCode Number Response status code value
responsePayloadBuffer Buffer Buffer payload of response
responsePayloadString String String payload of response Sends a response with a specific status code to a request from another device.

ocfAdapter.stopDiscovery() ⇒ Boolean

OCFAdapter.stopDiscovery

Kind: instance method of OCFAdapter
Returns: Boolean - isSuccess

ocfAdapter.isDiscovering() ⇒ Boolean

OCFAdapter.isDiscovering

Kind: instance method of OCFAdapter
Returns: Boolean - isDiscovering

ocfAdapter.discovery(resourceType, discoveryHandler) ⇒ Boolean

OCFAdapter.discovery

Kind: instance method of OCFAdapter
Returns: Boolean - isSuccess

Param Type Description
resourceType String Type of resource to find on the network
discoveryHandler function called whenever one OCFResource is discovered

ocfAdapter.discoveryAll(discoveryHandler) ⇒ Boolean

OCFAdapter.discoveryAll

Kind: instance method of OCFAdapter
Returns: Boolean - isSuccess Search all resources regardless of any type on the network.

Param Type Description
discoveryHandler function Handler function for discovery response

ocfAdapter.observe(endpoint, uri, userHandler, query, qos, isResponsePayloadBuffer) ⇒ Boolean

OCFAdapter.observe

Kind: instance method of OCFAdapter
Returns: Boolean - isSuccess

Param Type
endpoint OCFEndpoint
uri String
userHandler function
query String
qos Integer
isResponsePayloadBuffer Boolean

ocfAdapter.stopObserve(endpoint, uri) ⇒ Boolean

OCFAdapter.stopObserve

Kind: instance method of OCFAdapter
Returns: Boolean - isSuccess

Param Type
endpoint OCFEndpoint
uri String

ocfAdapter.get(endpoint, uri, userHandler, query, qos, isResponsePayloadBuffer) ⇒ Boolean

OCFAdapter.get

Kind: instance method of OCFAdapter
Returns: Boolean - isSuccess

Param Type
endpoint OCFEndpoint
uri String
userHandler function
query String
qos Integer
isResponsePayloadBuffer Boolean

ocfAdapter.delete(endpoint, uri, userHandler, query, qos, isResponsePayloadBuffer) ⇒ Boolean

OCFAdapter.delete

Kind: instance method of OCFAdapter
Returns: Boolean - isSuccess

Param Type
endpoint OCFEndpoint
uri String
userHandler function
query String
qos Integer
isResponsePayloadBuffer Boolean

ocfAdapter.initPost(endpoint, uri, userHandler, query, qos, isResponsePayloadBuffer) ⇒ Boolean

OCFAdapter.initPost

Kind: instance method of OCFAdapter
Returns: Boolean - isSuccess

Param Type
endpoint OCFEndpoint
uri String
userHandler function
query String
qos Integer
isResponsePayloadBuffer Boolean

ocfAdapter.initPut(endpoint, uri, userHandler, query, qos, isResponsePayloadBuffer) ⇒ Boolean

OCFAdapter.initPut

Kind: instance method of OCFAdapter
Returns: Boolean - isSuccess

Param Type
endpoint OCFEndpoint
uri String
userHandler function
query String
qos Integer
isResponsePayloadBuffer Boolean

ocfAdapter.finishPost() ⇒ Boolean

OCFAdapter.finishPost

Kind: instance method of OCFAdapter
Returns: Boolean - isSuccess

ocfAdapter.finishPut() ⇒ Boolean

OCFAdapter.finishPut

Kind: instance method of OCFAdapter
Returns: Boolean - isSuccess

ocfAdapter.post(endpoint, uri, userHandler, query, qos, isResponsePayloadBuffer, requestPayload) ⇒ Boolean

OCFAdapter.post

Kind: instance method of OCFAdapter
Returns: Boolean - isSuccess

Param Type
endpoint OCFEndpoint
uri String
userHandler function
query String
qos Integer
isResponsePayloadBuffer Boolean
requestPayload Object

ocfAdapter.put(endpoint, uri, userHandler, query, qos, isResponsePayloadBuffer, requestPayload) ⇒ Boolean

OCFAdapter.put

Kind: instance method of OCFAdapter
Returns: Boolean - isSuccess

Param Type
endpoint OCFEndpoint
uri String
userHandler function
query String
qos Integer
isResponsePayloadBuffer Boolean
requestPayload Object

OCFDevice(id, uri, resourceType, name, specVersion, dataModelVersion)

OCF Device

Kind: global function

Param Type Description
id int OCF device's ID that is internally managed.
uri string URI of the OCF device
resourceType string OCF device's resource type
name string the OCF device's name
specVersion string version of the device's spec
dataModelVersion string version of the device's data model

OCFResource(device, name, uri, types, interfaceMasks)

OCF Resource.

Kind: global function

Param Type Description
device object OCF device that serves this resource
name string the resource's name
uri string URI of the resource
types array the array of resource's types. each element's type is string.
interfaceMasks interfaceMasks the array of interface masks. each element's type is string.

ocfResource.destroyer()

OCFResource.destroyer

Kind: instance method of OCFResource

ocfResource.setDiscoverable(isDiscoverable)

OCFResource.setDiscoverable

Kind: instance method of OCFResource

Param Type
isDiscoverable Boolean

ocfResource.setPeriodicObservable(periodSec)

OCFResource.setPeriodicObservable

Kind: instance method of OCFResource

Param Type
periodSec Integer

ocfResource.setHandler(method, handler)

OCFResource.setHandler

Kind: instance method of OCFResource

Param Type
method Number
handler function

results matching ""

    No results matching ""