Search in sources :

Example 1 with EzspGetKeyResponse

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

the class EmberNcp method getKey.

/**
 * Gets a Security Key based on the passed key type.
 *
 * @param keyType the {@link EmberKeyType} of the key to get
 * @return the {@link EmberKeyStruct} or null on error
 */
public EmberKeyStruct getKey(EmberKeyType keyType) {
    EzspGetKeyRequest request = new EzspGetKeyRequest();
    request.setKeyType(keyType);
    EzspTransaction transaction = ashHandler.sendEzspTransaction(new EzspSingleResponseTransaction(request, EzspGetKeyResponse.class));
    EzspGetKeyResponse response = (EzspGetKeyResponse) transaction.getResponse();
    logger.debug(response.toString());
    lastStatus = response.getStatus();
    if (lastStatus != EmberStatus.EMBER_SUCCESS) {
        return null;
    }
    return response.getKeyStruct();
}
Also used : EzspTransaction(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.transaction.EzspTransaction) EzspGetKeyRequest(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspGetKeyRequest) EzspSingleResponseTransaction(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.transaction.EzspSingleResponseTransaction) EzspGetKeyResponse(com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspGetKeyResponse)

Aggregations

EzspGetKeyRequest (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspGetKeyRequest)1 EzspGetKeyResponse (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspGetKeyResponse)1 EzspSingleResponseTransaction (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.transaction.EzspSingleResponseTransaction)1 EzspTransaction (com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.transaction.EzspTransaction)1