/// <summary> /// Serialise the contents of the EZSP structure. </summary> public int[] Serialize(EzspSerializer serializer) { serializer.SerializeEmberEui64(_eui64); serializer.SerializeEmberKeyData(_keyData); serializer.SerializeUInt32(_incomingFrameCounter); serializer.SerializeUInt32(_countdownTimerMs); return(serializer.GetPayload()); }
/// <summary> /// Serialise the contents of the EZSP structure. </summary> public int[] Serialize(EzspSerializer serializer) { serializer.SerializeEmberKeyStructBitmask(_bitmask); serializer.SerializeEmberKeyType(_type); serializer.SerializeEmberKeyData(_key); serializer.SerializeUInt32(_outgoingFrameCounter); serializer.SerializeUInt32(_incomingFrameCounter); serializer.SerializeUInt8(_sequenceNumber); serializer.SerializeEmberEui64(_partnerEUI64); return(serializer.GetPayload()); }
/// <summary> /// Serialise the contents of the EZSP structure. </summary> public int[] Serialize(EzspSerializer serializer) { serializer.SerializeEmberGpSinkTableEntryStatus(_status); serializer.SerializeUInt32(_options); serializer.SerializeEmberGpAddress(_gpd); serializer.SerializeUInt8(_deviceId); serializer.SerializeEmberGpSinkListEntry(_sinkList); serializer.SerializeUInt16(_assignedAlias); serializer.SerializeUInt8(_groupcastRadius); serializer.SerializeUInt8(_securityOptions); serializer.SerializeUInt32(_gpdSecurityFrameCounter); serializer.SerializeEmberKeyData(_gpdKey); return(serializer.GetPayload()); }
/// <summary> /// Method for serializing the command fields </summary> public override int[] Serialize() { SerializeHeader(_serializer); _serializer.SerializeBool(_haveCurrentNetworkKey); _serializer.SerializeUInt32(_channelMask); return(_serializer.GetPayload()); }
/// <summary> /// Serialise the contents of the EZSP structure. </summary> public int[] Serialize(EzspSerializer serializer) { serializer.SerializeEmberEui64(_gpdIeeeAddress); serializer.SerializeUInt32(_sourceId); serializer.SerializeEmberGpApplicationId(_applicationId); serializer.SerializeUInt8(_endpoint); return(serializer.GetPayload()); }
/// <summary> /// Method for serializing the command fields </summary> public override int[] Serialize() { SerializeHeader(_serializer); _serializer.SerializeEzspNetworkScanType(_scanType); _serializer.SerializeUInt32(_channelMask); _serializer.SerializeUInt8(_duration); return(_serializer.GetPayload()); }
/// <summary> /// Method for serializing the command fields </summary> public override int[] Serialize() { SerializeHeader(_serializer); _serializer.SerializeUInt16(_target); _serializer.SerializeUInt32(_scanChannels); _serializer.SerializeUInt8(_scanDuration); _serializer.SerializeUInt16(_scanCount); return(_serializer.GetPayload()); }
/// <summary> /// Serialise the contents of the EZSP structure. </summary> public int[] Serialize(EzspSerializer serializer) { serializer.SerializeExtendedPanId(_extendedPanId); serializer.SerializeUInt16(_panId); serializer.SerializeUInt8(_radioTxPower); serializer.SerializeUInt8(_radioChannel); serializer.SerializeEmberJoinMethod(_joinMethod); serializer.SerializeUInt16(_nwkManagerId); serializer.SerializeUInt8(_nwkUpdateId); serializer.SerializeUInt32(_channels); return(serializer.GetPayload()); }
/// <summary> /// Method for serializing the command fields </summary> public override int[] Serialize() { SerializeHeader(_serializer); _serializer.SerializeUInt32(_options); _serializer.SerializeEmberGpAddress(_addr); _serializer.SerializeUInt8(_commMode); _serializer.SerializeUInt16(_sinkNetworkAddress); _serializer.SerializeUInt16(_sinkGroupId); _serializer.SerializeUInt16(_assignedAlias); _serializer.SerializeEmberEui64(_sinkIeeeAddress); _serializer.SerializeEmberKeyData(_gpdKey); return(_serializer.GetPayload()); }
/// <summary> /// Serialise the contents of the EZSP structure. </summary> public int[] Serialize(EzspSerializer serializer) { serializer.SerializeUInt8Array(_result); serializer.SerializeUInt32(_length); return(serializer.GetPayload()); }
/** * Sets the initial security state * * @param linkKey the initial {@link ZigBeeKey} * @param networkKey the initial {@link ZigBeeKey} * @return true if the security state was set successfully */ private bool SetSecurityState(ZigBeeKey linkKey, ZigBeeKey networkKey) { EzspSetInitialSecurityStateRequest securityState = new EzspSetInitialSecurityStateRequest(); EmberInitialSecurityState state = new EmberInitialSecurityState(); state.AddBitmask(EmberInitialSecurityBitmask.EMBER_TRUST_CENTER_GLOBAL_LINK_KEY); EmberKeyData networkKeyData = new EmberKeyData(); if (networkKey != null) { networkKeyData.SetContents(Array.ConvertAll(networkKey.Key, c => (int)c)); state.AddBitmask(EmberInitialSecurityBitmask.EMBER_HAVE_NETWORK_KEY); if (networkKey.SequenceNumber.HasValue) { state.SetNetworkKeySequenceNumber(networkKey.SequenceNumber.Value); } } state.SetNetworkKey(networkKeyData); EmberKeyData linkKeyData = new EmberKeyData(); if (linkKey != null) { linkKeyData.SetContents(Array.ConvertAll(linkKey.Key, c => (int)c)); state.AddBitmask(EmberInitialSecurityBitmask.EMBER_HAVE_PRECONFIGURED_KEY); state.AddBitmask(EmberInitialSecurityBitmask.EMBER_REQUIRE_ENCRYPTED_KEY); } state.SetPreconfiguredKey(linkKeyData); state.SetPreconfiguredTrustCenterEui64(new IeeeAddress()); securityState.SetState(state); EzspSingleResponseTransaction transaction = new EzspSingleResponseTransaction(securityState, typeof(EzspSetInitialSecurityStateResponse)); _protocolHandler.SendEzspTransaction(transaction); EzspSetInitialSecurityStateResponse securityStateResponse = (EzspSetInitialSecurityStateResponse)transaction.GetResponse(); Log.Debug(securityStateResponse.ToString()); if (securityStateResponse.GetStatus() != EmberStatus.EMBER_SUCCESS) { Log.Debug("Error during retrieval of network parameters: {Response}", securityStateResponse); return(false); } EmberNcp ncp = new EmberNcp(_protocolHandler); if (networkKey != null && networkKey.OutgoingFrameCounter.HasValue) { EzspSerializer serializer = new EzspSerializer(); serializer.SerializeUInt32(networkKey.OutgoingFrameCounter.Value); if (ncp.SetValue(EzspValueId.EZSP_VALUE_NWK_FRAME_COUNTER, serializer.GetPayload()) != EzspStatus.EZSP_SUCCESS) { return(false); } } if (linkKey != null && linkKey.OutgoingFrameCounter.HasValue) { EzspSerializer serializer = new EzspSerializer(); serializer.SerializeUInt32(linkKey.OutgoingFrameCounter.Value); if (ncp.SetValue(EzspValueId.EZSP_VALUE_APS_FRAME_COUNTER, serializer.GetPayload()) != EzspStatus.EZSP_SUCCESS) { return(false); } } return(true); }