Search in sources :

Example 1 with EzspGetChildDataResponse

use of com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspGetChildDataResponse in project com.zsmartsystems.zigbee by zsmartsystems.

the class EmberConsoleNcpChildrenCommand method process.

@Override
public void process(ZigBeeNetworkManager networkManager, String[] args, PrintStream out) throws IllegalArgumentException {
    EmberNcp ncp = getEmberNcp(networkManager);
    EzspGetParentChildParametersResponse childParameters = ncp.getChildParameters();
    out.println("Ember NCP contains " + childParameters.getChildCount() + " children" + ((childParameters.getChildCount() == 0) ? "." : ":"));
    for (int childId = 0; childId < childParameters.getChildCount(); childId++) {
        EzspGetChildDataResponse child = ncp.getChildInformation(childId);
        out.println(String.format("%2d  %-10s  %-10s  %s", child.getChildId(), child.getStatus(), child.getChildType(), child.getChildEui64()));
    }
}
Also used : EmberNcp(com.zsmartsystems.zigbee.dongle.ember.EmberNcp) EzspGetChildDataResponse(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspGetChildDataResponse) EzspGetParentChildParametersResponse(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspGetParentChildParametersResponse)

Example 2 with EzspGetChildDataResponse

use of com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspGetChildDataResponse in project com.zsmartsystems.zigbee by zsmartsystems.

the class EmberNcp method getChildInformation.

/**
 * Returns information about a child of the local node.
 *
 * @param childId the ID of the child to get information on
 * @return the {@link EzspGetChildDataResponse} of the requested childId or null on error
 */
public EzspGetChildDataResponse getChildInformation(int childId) {
    EzspGetChildDataRequest request = new EzspGetChildDataRequest();
    request.setIndex(childId);
    EzspTransaction transaction = ashHandler.sendEzspTransaction(new EzspSingleResponseTransaction(request, EzspGetChildDataResponse.class));
    EzspGetChildDataResponse response = (EzspGetChildDataResponse) transaction.getResponse();
    logger.debug(response.toString());
    lastStatus = response.getStatus();
    if (lastStatus != EmberStatus.EMBER_SUCCESS) {
        return null;
    }
    return response;
}
Also used : EzspGetChildDataResponse(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspGetChildDataResponse) EzspTransaction(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.transaction.EzspTransaction) EzspGetChildDataRequest(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspGetChildDataRequest) EzspSingleResponseTransaction(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.transaction.EzspSingleResponseTransaction)

Aggregations

EzspGetChildDataResponse (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspGetChildDataResponse)2 EmberNcp (com.zsmartsystems.zigbee.dongle.ember.EmberNcp)1 EzspGetChildDataRequest (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspGetChildDataRequest)1 EzspGetParentChildParametersResponse (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspGetParentChildParametersResponse)1 EzspSingleResponseTransaction (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.transaction.EzspSingleResponseTransaction)1 EzspTransaction (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.transaction.EzspTransaction)1