public interface ZigBeeHost extends ZigBeeNode
ZigBeeHost is more than a ZigBeeNode.
It must be registered as a OSGi service.
Even if not specified explicitly in the javadoc, any method of this interface
must throw an IllegalArgumentException
exception if a or one of the
passed arguments has a value not admitted by the method.
Modifier and Type | Field and Description |
---|---|
static short |
UNLIMITED_BROADCAST_RADIUS
Value constant to set an unlimited broadcast radius.
|
COORDINATOR, EXTENDED_PAN_ID, IEEE_ADDRESS, LOGICAL_TYPE, MANUFACTURER_CODE, PAN_ID, POWER_SOURCE, RECEIVER_ON_WHEN_IDLE, ROUTER, ZED
Modifier and Type | Method and Description |
---|---|
ZCLCommandResponseStream |
broadcast(int clusterID,
ZCLFrame frame)
Broadcasts a ZCL frame to the cluster ID of all the nodes of the ZigBee
network.
|
ZCLCommandResponseStream |
broadcast(int clusterID,
ZCLFrame frame,
String exportedServicePID)
Broadcasts a ZCL frame to the cluster ID of all the nodes of the ZigBee
network.
|
void |
createGroupService(int groupAddress)
Creates a
ZigBeeGroup service that has not yet been discovered by
the ZigBee Base Driver or that does not exist on the ZigBee network yet. |
short |
getBroadcastRadius()
Returns the current broadcast radius value.
|
int |
getChannel()
Returns the current network channel.
|
int |
getChannelMask()
Returns the currently configured channel mask.
|
long |
getCommunicationTimeout()
Returns the current value set for the communication timeout.
|
String |
getPreconfiguredLinkKey()
Returns the current preconfigured link key.
|
int |
getSecurityLevel()
Returns the network security level.
|
boolean |
isStarted()
Checks the host's start/stop state.
|
void |
permitJoin(short duration)
Indicates if a ZigBee device can join the network.
|
Promise<Boolean> |
refreshNetwork()
Forces a new network scan.
|
void |
setBroadcastRadius(short broadcastRadius)
Sets the broadcast radius value.
|
void |
setChannelMask(int mask)
Sets a new configured channel mask.
|
void |
setCommunicationTimeout(long timeout)
Sets the timeout for the communication sent through this device.
|
void |
setExtendedPanId(BigInteger extendedPanId)
Sets the extendedPanId.
|
void |
setLogicalType(short logicalNodeType)
Sets the host logical node type.
|
void |
setPanId(int panId)
Sets the panId.
|
void |
start()
Starts the host.
|
void |
stop()
Stops the host.
|
void |
updateNetworkChannel(byte channel)
Updates the network channel.
|
getComplexDescriptor, getEndpoints, getExtendedPanId, getHostPid, getIEEEAddress, getLinksQuality, getNetworkAddress, getNodeDescriptor, getPanId, getPowerDescriptor, getRoutingTable, getUserDescription, invoke, invoke, leave, leave, setUserDescription
static final short UNLIMITED_BROADCAST_RADIUS
void start() throws Exception
ZigBeeNode.COORDINATOR
, then it can be started
with or without ZigBeeNode.PAN_ID
and
ZigBeeNode.EXTENDED_PAN_ID
(that is, if no PAN_ID, and Extended
PAN_ID are given, then they will be automatically generated and then
added to the service properties).
If the host is a ZigBeeNode.ROUTER
, or a ZigBeeNode.ZED
,
then the host may start without a registered ZigBeeNode.PAN_ID
property; the property will be set when the host will find and join a
ZigBee network.
The host status must be persistent, that is, if the host was started, then the host must starts again when the bundle restarts. In addition, the values of channel, pan id, extended pan id, and host PID must remain the same.
Exception
- Any exception related to the communication with the
chip.void stop() throws Exception
Exception
- Any exception related to the communication with the
chip.boolean isStarted()
void setPanId(int panId)
panId
- The network Personal Area Network identifier (PAN ID)IllegalArgumentException
- if set with a value out of the expected
range [0x0000, 0xffff].IllegalStateException
- If the host is already started.void setExtendedPanId(BigInteger extendedPanId)
extendedPanId
- The network Extended PAN identifier(EPID)IllegalStateException
- If the host is already started.void permitJoin(short duration) throws Exception
Broadcasts a Mgmt_Permit_req to all routers and the coordinator. If the duration argument is not equal to zero or 0xFF, the argument is a number of seconds and joining is permitted until it counts down to zero, after which time, joining is not permitted. If the duration is set to zero, joining is not permitted. If set to 0xFF, joining is permitted indefinitely or until another Mgmt_Permit_Joining_req is received by the coordinator.
As described in "Table 2.133 Fields of the Mgmt_Permit_Joining_rsp
Command" of the ZigBee specification
1_053474r17ZB_TSC-ZigBee-Specification.pdf, a permitJoin request can have
the following status: ZDPException.SUCCESS
,
ZDPException.INV_REQUESTTYPE
, ZDPException.NOT_AUTHORIZED
or any status code returned from the NLMEPERMITJOINING.confirm primitive.
duration
- The time during which associations are permitted.Exception
- Any exception related to the communication with the
chip.void setLogicalType(short logicalNodeType) throws Exception
ZigBeeNode.COORDINATOR
, ZigBeeNode.ROUTER
and
ZigBeeNode.ZED
.logicalNodeType
- The logical node type.IllegalStateException
- If the host is already started.Exception
- Any exception related to the communication with the
chip.int getChannel() throws Exception
Exception
- Any exception related to the communication with the
chip.void updateNetworkChannel(byte channel) throws IOException
As described in "Table 2.4.3.3.9 Mgmt_NWK_Update_req" of the ZigBee specification 1_053474r17ZB_TSC-ZigBee-Specification.pdf, this request is sent as broadcast by the network manager with a ScanDuration to be set with the channel parameter.
channel
- The network channel.IllegalStateException
- If the host is started, or the host
is not a network manager.IOException
- for serial communication exception.int getChannelMask() throws Exception
Exception
- Any exception related to the communication with the
chip.void setChannelMask(int mask) throws IOException
As described in "Table 2.13 APSME-SET.confirm Parameters" of the ZigBee
specification 1_053474r17ZB_TSC-ZigBee-Specification.pdf, a set request
can have the following status: APSException.SUCCESS
,
APSException.INVALID_PARAMETER
or
APSException.UNSUPPORTED_ATTRIBUTE
.
mask
- A value representing the channel mask.IllegalStateException
- If the host is already started.IOException
- for serial communication exception.Promise<Boolean> refreshNetwork() throws Exception
Boolean.TRUE
otherwise the promise is failed with an exception.Exception
- Any exception related to the communication with the
chip.int getSecurityLevel() throws Exception
Exception
- Any exception related to the communication with the
chip.String getPreconfiguredLinkKey() throws Exception
Exception
- Any exception related to the communication with the
chip.void createGroupService(int groupAddress) throws Exception
ZigBeeGroup
service that has not yet been discovered by
the ZigBee Base Driver or that does not exist on the ZigBee network yet.groupAddress
- the address of the group to create.Exception
- when a ZigBeeGroup service with the same groupAddress
already exists.ZCLCommandResponseStream broadcast(int clusterID, ZCLFrame frame)
setBroadcastRadius(short)
method, may be used to
limit the broadcast radius used in the subsequent broadcast calls.broadcast
in interface ZigBeeNode
clusterID
- The cluster ID this ZCL frame must be sent to.frame
- A ZCL Frame.ZCLCommandResponseStream broadcast(int clusterID, ZCLFrame frame, String exportedServicePID)
exportedServicePID
allows to force the source
endpoint of the message sent to be the endpoint id of the exported
ZigBeeEndPoint service having the specified service.pid property.broadcast
in interface ZigBeeNode
clusterID
- The cluster ID.frame
- A ZCL Frame.exportedServicePID
- the source endpoint of the command request. In
targeted situations, the source endpoint is the valid service PID
of an exported endpoint.Setting the broadcast radius.
short getBroadcastRadius()
void setBroadcastRadius(short broadcastRadius)
ZigBeeHost
must
use UNLIMITED_BROADCAST_RADIUS
as default value for the
broadcast.broadcastRadius
- - is the number of routers that the messages are
allowed to cross. Radius value is in the range from 0 to 0xff.IllegalArgumentException
- if set with a value out of the expected
range.IllegalStateException
- if set when the ZigBeeHost is "running".void setCommunicationTimeout(long timeout)
timeout
- the number of milliseconds before firing a timeout
exception.long getCommunicationTimeout()
Copyright © Contributors to the Eclipse Foundation Licensed under the Eclipse Foundation Specification License – v1.0