@matter/protocol 0.16.0-alpha.0-20250809-ee8375bcb → 0.16.0-alpha.0-20250812-285b75d83
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/advertisement/Advertisement.d.ts +119 -0
- package/dist/cjs/advertisement/Advertisement.d.ts.map +1 -0
- package/dist/cjs/advertisement/Advertisement.js +267 -0
- package/dist/cjs/advertisement/Advertisement.js.map +6 -0
- package/dist/cjs/advertisement/Advertiser.d.ts +50 -0
- package/dist/cjs/advertisement/Advertiser.d.ts.map +1 -0
- package/dist/cjs/advertisement/Advertiser.js +81 -0
- package/dist/cjs/advertisement/Advertiser.js.map +6 -0
- package/dist/cjs/advertisement/CommissioningMode.d.ts +11 -0
- package/dist/cjs/advertisement/CommissioningMode.d.ts.map +1 -0
- package/dist/cjs/advertisement/CommissioningMode.js +35 -0
- package/dist/cjs/advertisement/CommissioningMode.js.map +6 -0
- package/dist/cjs/{common/InstanceBroadcaster.d.ts → advertisement/PairingHintBitmap.d.ts} +3 -69
- package/dist/cjs/advertisement/PairingHintBitmap.d.ts.map +1 -0
- package/dist/cjs/{common/InstanceBroadcaster.js → advertisement/PairingHintBitmap.js} +5 -12
- package/dist/cjs/advertisement/PairingHintBitmap.js.map +6 -0
- package/dist/cjs/advertisement/ServiceDescription.d.ts +70 -0
- package/dist/cjs/advertisement/ServiceDescription.d.ts.map +1 -0
- package/dist/cjs/advertisement/ServiceDescription.js +61 -0
- package/dist/cjs/advertisement/ServiceDescription.js.map +6 -0
- package/dist/cjs/advertisement/ble/BleAdvertisement.d.ts +16 -0
- package/dist/cjs/advertisement/ble/BleAdvertisement.d.ts.map +1 -0
- package/dist/cjs/advertisement/ble/BleAdvertisement.js +85 -0
- package/dist/cjs/advertisement/ble/BleAdvertisement.js.map +6 -0
- package/dist/cjs/advertisement/ble/BleAdvertiser.d.ts +66 -0
- package/dist/cjs/advertisement/ble/BleAdvertiser.d.ts.map +1 -0
- package/dist/cjs/advertisement/ble/BleAdvertiser.js +83 -0
- package/dist/cjs/advertisement/ble/BleAdvertiser.js.map +6 -0
- package/dist/cjs/advertisement/ble/index.d.ts +8 -0
- package/dist/cjs/advertisement/ble/index.d.ts.map +1 -0
- package/dist/cjs/advertisement/ble/index.js +25 -0
- package/dist/cjs/advertisement/ble/index.js.map +6 -0
- package/dist/cjs/advertisement/index.d.ts +13 -0
- package/dist/cjs/advertisement/index.d.ts.map +1 -0
- package/dist/cjs/advertisement/index.js +30 -0
- package/dist/cjs/advertisement/index.js.map +6 -0
- package/dist/cjs/advertisement/mdns/CommissionableMdnsAdvertisement.d.ts +21 -0
- package/dist/cjs/advertisement/mdns/CommissionableMdnsAdvertisement.d.ts.map +1 -0
- package/dist/cjs/advertisement/mdns/CommissionableMdnsAdvertisement.js +104 -0
- package/dist/cjs/advertisement/mdns/CommissionableMdnsAdvertisement.js.map +6 -0
- package/dist/cjs/advertisement/mdns/CommissionerMdnsAdvertisement.d.ts +20 -0
- package/dist/cjs/advertisement/mdns/CommissionerMdnsAdvertisement.d.ts.map +1 -0
- package/dist/cjs/advertisement/mdns/CommissionerMdnsAdvertisement.js +70 -0
- package/dist/cjs/advertisement/mdns/CommissionerMdnsAdvertisement.js.map +6 -0
- package/dist/cjs/advertisement/mdns/MdnsAdvertisement.d.ts +40 -0
- package/dist/cjs/advertisement/mdns/MdnsAdvertisement.d.ts.map +1 -0
- package/dist/cjs/advertisement/mdns/MdnsAdvertisement.js +145 -0
- package/dist/cjs/advertisement/mdns/MdnsAdvertisement.js.map +6 -0
- package/dist/cjs/advertisement/mdns/MdnsAdvertiser.d.ts +99 -0
- package/dist/cjs/advertisement/mdns/MdnsAdvertiser.d.ts.map +1 -0
- package/dist/cjs/advertisement/mdns/MdnsAdvertiser.js +166 -0
- package/dist/cjs/advertisement/mdns/MdnsAdvertiser.js.map +6 -0
- package/dist/cjs/advertisement/mdns/OperationalMdnsAdvertisement.d.ts +18 -0
- package/dist/cjs/advertisement/mdns/OperationalMdnsAdvertisement.d.ts.map +1 -0
- package/dist/cjs/advertisement/mdns/OperationalMdnsAdvertisement.js +55 -0
- package/dist/cjs/advertisement/mdns/OperationalMdnsAdvertisement.js.map +6 -0
- package/dist/cjs/advertisement/mdns/index.d.ts +11 -0
- package/dist/cjs/advertisement/mdns/index.d.ts.map +1 -0
- package/dist/cjs/advertisement/mdns/index.js +28 -0
- package/dist/cjs/advertisement/mdns/index.js.map +6 -0
- package/dist/cjs/ble/Ble.d.ts +7 -5
- package/dist/cjs/ble/Ble.d.ts.map +1 -1
- package/dist/cjs/ble/Ble.js.map +1 -1
- package/dist/cjs/ble/BleConsts.d.ts +2 -1
- package/dist/cjs/ble/BleConsts.d.ts.map +1 -1
- package/dist/cjs/ble/BleConsts.js +3 -1
- package/dist/cjs/ble/BleConsts.js.map +1 -1
- package/dist/cjs/codec/BtpCodec.d.ts +1 -1
- package/dist/cjs/codec/BtpCodec.d.ts.map +1 -1
- package/dist/cjs/codec/BtpCodec.js +4 -4
- package/dist/cjs/codec/BtpCodec.js.map +1 -1
- package/dist/cjs/common/Scanner.d.ts +1 -25
- package/dist/cjs/common/Scanner.d.ts.map +1 -1
- package/dist/cjs/common/Scanner.js +1 -18
- package/dist/cjs/common/Scanner.js.map +1 -1
- package/dist/cjs/common/SupportedTransportsBitmap.d.ts +33 -0
- package/dist/cjs/common/SupportedTransportsBitmap.d.ts.map +1 -0
- package/dist/cjs/common/SupportedTransportsBitmap.js +45 -0
- package/dist/cjs/common/SupportedTransportsBitmap.js.map +6 -0
- package/dist/cjs/common/index.d.ts +1 -1
- package/dist/cjs/common/index.d.ts.map +1 -1
- package/dist/cjs/common/index.js +1 -1
- package/dist/cjs/common/index.js.map +1 -1
- package/dist/cjs/fabric/Fabric.d.ts +1 -0
- package/dist/cjs/fabric/Fabric.d.ts.map +1 -1
- package/dist/cjs/fabric/Fabric.js +7 -0
- package/dist/cjs/fabric/Fabric.js.map +1 -1
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/{esm/mdns/MdnsScanner.d.ts → cjs/mdns/MdnsClient.d.ts} +11 -14
- package/dist/cjs/mdns/MdnsClient.d.ts.map +1 -0
- package/dist/cjs/mdns/{MdnsScanner.js → MdnsClient.js} +35 -90
- package/dist/cjs/mdns/MdnsClient.js.map +6 -0
- package/dist/cjs/mdns/MdnsConsts.d.ts +11 -2
- package/dist/cjs/mdns/MdnsConsts.d.ts.map +1 -1
- package/dist/cjs/mdns/MdnsConsts.js +31 -4
- package/dist/cjs/mdns/MdnsConsts.js.map +1 -1
- package/dist/cjs/mdns/MdnsServer.d.ts +13 -22
- package/dist/cjs/mdns/MdnsServer.d.ts.map +1 -1
- package/dist/cjs/mdns/MdnsServer.js +53 -150
- package/dist/cjs/mdns/MdnsServer.js.map +2 -2
- package/dist/cjs/mdns/MdnsService.d.ts +4 -5
- package/dist/cjs/mdns/MdnsService.d.ts.map +1 -1
- package/dist/cjs/mdns/MdnsService.js +22 -23
- package/dist/cjs/mdns/MdnsService.js.map +1 -1
- package/dist/cjs/mdns/MdnsSocket.d.ts +32 -0
- package/dist/cjs/mdns/MdnsSocket.d.ts.map +1 -0
- package/dist/cjs/mdns/MdnsSocket.js +144 -0
- package/dist/cjs/mdns/MdnsSocket.js.map +6 -0
- package/dist/cjs/mdns/index.d.ts +2 -3
- package/dist/cjs/mdns/index.d.ts.map +1 -1
- package/dist/cjs/mdns/index.js +2 -3
- package/dist/cjs/mdns/index.js.map +1 -1
- package/dist/cjs/peer/ControllerCommissioner.js +2 -2
- package/dist/cjs/peer/ControllerCommissioner.js.map +1 -1
- package/dist/cjs/peer/ControllerDiscovery.d.ts +3 -3
- package/dist/cjs/peer/ControllerDiscovery.d.ts.map +1 -1
- package/dist/cjs/peer/ControllerDiscovery.js.map +1 -1
- package/dist/cjs/peer/PeerSet.d.ts.map +1 -1
- package/dist/cjs/peer/PeerSet.js +10 -5
- package/dist/cjs/peer/PeerSet.js.map +1 -1
- package/dist/cjs/protocol/DeviceAdvertiser.d.ts +23 -18
- package/dist/cjs/protocol/DeviceAdvertiser.d.ts.map +1 -1
- package/dist/cjs/protocol/DeviceAdvertiser.js +130 -129
- package/dist/cjs/protocol/DeviceAdvertiser.js.map +1 -1
- package/dist/cjs/protocol/DeviceCommissioner.d.ts +0 -1
- package/dist/cjs/protocol/DeviceCommissioner.d.ts.map +1 -1
- package/dist/cjs/protocol/DeviceCommissioner.js +44 -44
- package/dist/cjs/protocol/DeviceCommissioner.js.map +1 -1
- package/dist/cjs/protocol/ExchangeManager.js +1 -1
- package/dist/cjs/protocol/ExchangeManager.js.map +1 -1
- package/dist/cjs/protocol/MessageExchange.d.ts +1 -1
- package/dist/cjs/protocol/MessageExchange.d.ts.map +1 -1
- package/dist/cjs/protocol/MessageExchange.js +6 -8
- package/dist/cjs/protocol/MessageExchange.js.map +1 -1
- package/dist/cjs/protocol/ProtocolHandler.d.ts +4 -0
- package/dist/cjs/protocol/ProtocolHandler.d.ts.map +1 -1
- package/dist/cjs/protocol/ProtocolStatusMessage.d.ts +8 -4
- package/dist/cjs/protocol/ProtocolStatusMessage.d.ts.map +1 -1
- package/dist/cjs/protocol/ProtocolStatusMessage.js +23 -8
- package/dist/cjs/protocol/ProtocolStatusMessage.js.map +1 -1
- package/dist/cjs/securechannel/SecureChannelMessenger.js +2 -2
- package/dist/cjs/securechannel/SecureChannelMessenger.js.map +1 -1
- package/dist/cjs/securechannel/SecureChannelProtocol.js +1 -1
- package/dist/cjs/securechannel/SecureChannelProtocol.js.map +1 -1
- package/dist/cjs/securechannel/SecureChannelStatusMessageSchema.d.ts +3 -3
- package/dist/cjs/securechannel/SecureChannelStatusMessageSchema.d.ts.map +1 -1
- package/dist/cjs/securechannel/SecureChannelStatusMessageSchema.js +3 -3
- package/dist/cjs/securechannel/SecureChannelStatusMessageSchema.js.map +1 -1
- package/dist/cjs/session/NodeSession.d.ts +1 -0
- package/dist/cjs/session/NodeSession.d.ts.map +1 -1
- package/dist/cjs/session/NodeSession.js +3 -0
- package/dist/cjs/session/NodeSession.js.map +1 -1
- package/dist/cjs/session/Session.d.ts +3 -33
- package/dist/cjs/session/Session.d.ts.map +1 -1
- package/dist/cjs/session/Session.js +4 -9
- package/dist/cjs/session/Session.js.map +1 -1
- package/dist/cjs/session/SessionIntervals.d.ts +36 -0
- package/dist/cjs/session/SessionIntervals.d.ts.map +1 -0
- package/dist/cjs/session/SessionIntervals.js +51 -0
- package/dist/cjs/session/SessionIntervals.js.map +6 -0
- package/dist/cjs/session/SessionManager.d.ts +1 -1
- package/dist/cjs/session/SessionManager.d.ts.map +1 -1
- package/dist/cjs/session/SessionManager.js +11 -12
- package/dist/cjs/session/SessionManager.js.map +1 -1
- package/dist/cjs/session/pase/PaseMessages.js +2 -2
- package/dist/cjs/session/pase/PaseMessages.js.map +1 -1
- package/dist/esm/advertisement/Advertisement.d.ts +119 -0
- package/dist/esm/advertisement/Advertisement.d.ts.map +1 -0
- package/dist/esm/advertisement/Advertisement.js +247 -0
- package/dist/esm/advertisement/Advertisement.js.map +6 -0
- package/dist/esm/advertisement/Advertiser.d.ts +50 -0
- package/dist/esm/advertisement/Advertiser.d.ts.map +1 -0
- package/dist/esm/advertisement/Advertiser.js +61 -0
- package/dist/esm/advertisement/Advertiser.js.map +6 -0
- package/dist/esm/advertisement/CommissioningMode.d.ts +11 -0
- package/dist/esm/advertisement/CommissioningMode.d.ts.map +1 -0
- package/dist/esm/advertisement/CommissioningMode.js +15 -0
- package/dist/esm/advertisement/CommissioningMode.js.map +6 -0
- package/dist/esm/{common/InstanceBroadcaster.d.ts → advertisement/PairingHintBitmap.d.ts} +3 -69
- package/dist/esm/advertisement/PairingHintBitmap.d.ts.map +1 -0
- package/dist/esm/{common/InstanceBroadcaster.js → advertisement/PairingHintBitmap.js} +2 -9
- package/dist/esm/{common/InstanceBroadcaster.js.map → advertisement/PairingHintBitmap.js.map} +3 -3
- package/dist/esm/advertisement/ServiceDescription.d.ts +70 -0
- package/dist/esm/advertisement/ServiceDescription.d.ts.map +1 -0
- package/dist/esm/advertisement/ServiceDescription.js +41 -0
- package/dist/esm/advertisement/ServiceDescription.js.map +6 -0
- package/dist/esm/advertisement/ble/BleAdvertisement.d.ts +16 -0
- package/dist/esm/advertisement/ble/BleAdvertisement.d.ts.map +1 -0
- package/dist/esm/advertisement/ble/BleAdvertisement.js +65 -0
- package/dist/esm/advertisement/ble/BleAdvertisement.js.map +6 -0
- package/dist/esm/advertisement/ble/BleAdvertiser.d.ts +66 -0
- package/dist/esm/advertisement/ble/BleAdvertiser.d.ts.map +1 -0
- package/dist/esm/advertisement/ble/BleAdvertiser.js +63 -0
- package/dist/esm/advertisement/ble/BleAdvertiser.js.map +6 -0
- package/dist/esm/advertisement/ble/index.d.ts +8 -0
- package/dist/esm/advertisement/ble/index.d.ts.map +1 -0
- package/dist/esm/advertisement/ble/index.js +8 -0
- package/dist/esm/advertisement/ble/index.js.map +6 -0
- package/dist/esm/advertisement/index.d.ts +13 -0
- package/dist/esm/advertisement/index.d.ts.map +1 -0
- package/dist/esm/advertisement/index.js +13 -0
- package/dist/esm/advertisement/index.js.map +6 -0
- package/dist/esm/advertisement/mdns/CommissionableMdnsAdvertisement.d.ts +21 -0
- package/dist/esm/advertisement/mdns/CommissionableMdnsAdvertisement.d.ts.map +1 -0
- package/dist/esm/advertisement/mdns/CommissionableMdnsAdvertisement.js +95 -0
- package/dist/esm/advertisement/mdns/CommissionableMdnsAdvertisement.js.map +6 -0
- package/dist/esm/advertisement/mdns/CommissionerMdnsAdvertisement.d.ts +20 -0
- package/dist/esm/advertisement/mdns/CommissionerMdnsAdvertisement.d.ts.map +1 -0
- package/dist/esm/advertisement/mdns/CommissionerMdnsAdvertisement.js +54 -0
- package/dist/esm/advertisement/mdns/CommissionerMdnsAdvertisement.js.map +6 -0
- package/dist/esm/advertisement/mdns/MdnsAdvertisement.d.ts +40 -0
- package/dist/esm/advertisement/mdns/MdnsAdvertisement.d.ts.map +1 -0
- package/dist/esm/advertisement/mdns/MdnsAdvertisement.js +125 -0
- package/dist/esm/advertisement/mdns/MdnsAdvertisement.js.map +6 -0
- package/dist/esm/advertisement/mdns/MdnsAdvertiser.d.ts +99 -0
- package/dist/esm/advertisement/mdns/MdnsAdvertiser.d.ts.map +1 -0
- package/dist/esm/advertisement/mdns/MdnsAdvertiser.js +146 -0
- package/dist/esm/advertisement/mdns/MdnsAdvertiser.js.map +6 -0
- package/dist/esm/advertisement/mdns/OperationalMdnsAdvertisement.d.ts +18 -0
- package/dist/esm/advertisement/mdns/OperationalMdnsAdvertisement.d.ts.map +1 -0
- package/dist/esm/advertisement/mdns/OperationalMdnsAdvertisement.js +40 -0
- package/dist/esm/advertisement/mdns/OperationalMdnsAdvertisement.js.map +6 -0
- package/dist/esm/advertisement/mdns/index.d.ts +11 -0
- package/dist/esm/advertisement/mdns/index.d.ts.map +1 -0
- package/dist/esm/advertisement/mdns/index.js +11 -0
- package/dist/esm/advertisement/mdns/index.js.map +6 -0
- package/dist/esm/ble/Ble.d.ts +7 -5
- package/dist/esm/ble/Ble.d.ts.map +1 -1
- package/dist/esm/ble/Ble.js.map +1 -1
- package/dist/esm/ble/BleConsts.d.ts +2 -1
- package/dist/esm/ble/BleConsts.d.ts.map +1 -1
- package/dist/esm/ble/BleConsts.js +3 -1
- package/dist/esm/ble/BleConsts.js.map +1 -1
- package/dist/esm/codec/BtpCodec.d.ts +1 -1
- package/dist/esm/codec/BtpCodec.d.ts.map +1 -1
- package/dist/esm/codec/BtpCodec.js +4 -4
- package/dist/esm/codec/BtpCodec.js.map +1 -1
- package/dist/esm/common/Scanner.d.ts +1 -25
- package/dist/esm/common/Scanner.d.ts.map +1 -1
- package/dist/esm/common/Scanner.js +1 -18
- package/dist/esm/common/Scanner.js.map +1 -1
- package/dist/esm/common/SupportedTransportsBitmap.d.ts +33 -0
- package/dist/esm/common/SupportedTransportsBitmap.d.ts.map +1 -0
- package/dist/esm/common/SupportedTransportsBitmap.js +25 -0
- package/dist/esm/common/SupportedTransportsBitmap.js.map +6 -0
- package/dist/esm/common/index.d.ts +1 -1
- package/dist/esm/common/index.d.ts.map +1 -1
- package/dist/esm/common/index.js +1 -1
- package/dist/esm/fabric/Fabric.d.ts +1 -0
- package/dist/esm/fabric/Fabric.d.ts.map +1 -1
- package/dist/esm/fabric/Fabric.js +7 -0
- package/dist/esm/fabric/Fabric.js.map +1 -1
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/{cjs/mdns/MdnsScanner.d.ts → esm/mdns/MdnsClient.d.ts} +11 -14
- package/dist/esm/mdns/MdnsClient.d.ts.map +1 -0
- package/dist/esm/mdns/{MdnsScanner.js → MdnsClient.js} +34 -92
- package/dist/esm/mdns/MdnsClient.js.map +6 -0
- package/dist/esm/mdns/MdnsConsts.d.ts +11 -2
- package/dist/esm/mdns/MdnsConsts.d.ts.map +1 -1
- package/dist/esm/mdns/MdnsConsts.js +31 -4
- package/dist/esm/mdns/MdnsConsts.js.map +1 -1
- package/dist/esm/mdns/MdnsServer.d.ts +13 -22
- package/dist/esm/mdns/MdnsServer.d.ts.map +1 -1
- package/dist/esm/mdns/MdnsServer.js +55 -155
- package/dist/esm/mdns/MdnsServer.js.map +2 -2
- package/dist/esm/mdns/MdnsService.d.ts +4 -5
- package/dist/esm/mdns/MdnsService.d.ts.map +1 -1
- package/dist/esm/mdns/MdnsService.js +22 -24
- package/dist/esm/mdns/MdnsService.js.map +1 -1
- package/dist/esm/mdns/MdnsSocket.d.ts +32 -0
- package/dist/esm/mdns/MdnsSocket.d.ts.map +1 -0
- package/dist/esm/mdns/MdnsSocket.js +133 -0
- package/dist/esm/mdns/MdnsSocket.js.map +6 -0
- package/dist/esm/mdns/index.d.ts +2 -3
- package/dist/esm/mdns/index.d.ts.map +1 -1
- package/dist/esm/mdns/index.js +2 -3
- package/dist/esm/mdns/index.js.map +1 -1
- package/dist/esm/peer/ControllerCommissioner.js +2 -2
- package/dist/esm/peer/ControllerCommissioner.js.map +1 -1
- package/dist/esm/peer/ControllerDiscovery.d.ts +3 -3
- package/dist/esm/peer/ControllerDiscovery.d.ts.map +1 -1
- package/dist/esm/peer/ControllerDiscovery.js.map +1 -1
- package/dist/esm/peer/PeerSet.d.ts.map +1 -1
- package/dist/esm/peer/PeerSet.js +10 -5
- package/dist/esm/peer/PeerSet.js.map +1 -1
- package/dist/esm/protocol/DeviceAdvertiser.d.ts +23 -18
- package/dist/esm/protocol/DeviceAdvertiser.d.ts.map +1 -1
- package/dist/esm/protocol/DeviceAdvertiser.js +131 -139
- package/dist/esm/protocol/DeviceAdvertiser.js.map +1 -1
- package/dist/esm/protocol/DeviceCommissioner.d.ts +0 -1
- package/dist/esm/protocol/DeviceCommissioner.d.ts.map +1 -1
- package/dist/esm/protocol/DeviceCommissioner.js +47 -47
- package/dist/esm/protocol/DeviceCommissioner.js.map +1 -1
- package/dist/esm/protocol/ExchangeManager.js +1 -1
- package/dist/esm/protocol/ExchangeManager.js.map +1 -1
- package/dist/esm/protocol/MessageExchange.d.ts +1 -1
- package/dist/esm/protocol/MessageExchange.d.ts.map +1 -1
- package/dist/esm/protocol/MessageExchange.js +6 -12
- package/dist/esm/protocol/MessageExchange.js.map +1 -1
- package/dist/esm/protocol/ProtocolHandler.d.ts +4 -0
- package/dist/esm/protocol/ProtocolHandler.d.ts.map +1 -1
- package/dist/esm/protocol/ProtocolStatusMessage.d.ts +8 -4
- package/dist/esm/protocol/ProtocolStatusMessage.d.ts.map +1 -1
- package/dist/esm/protocol/ProtocolStatusMessage.js +24 -9
- package/dist/esm/protocol/ProtocolStatusMessage.js.map +1 -1
- package/dist/esm/securechannel/SecureChannelMessenger.js +3 -3
- package/dist/esm/securechannel/SecureChannelMessenger.js.map +1 -1
- package/dist/esm/securechannel/SecureChannelProtocol.js +2 -2
- package/dist/esm/securechannel/SecureChannelProtocol.js.map +1 -1
- package/dist/esm/securechannel/SecureChannelStatusMessageSchema.d.ts +3 -3
- package/dist/esm/securechannel/SecureChannelStatusMessageSchema.d.ts.map +1 -1
- package/dist/esm/securechannel/SecureChannelStatusMessageSchema.js +3 -3
- package/dist/esm/securechannel/SecureChannelStatusMessageSchema.js.map +1 -1
- package/dist/esm/session/NodeSession.d.ts +1 -0
- package/dist/esm/session/NodeSession.d.ts.map +1 -1
- package/dist/esm/session/NodeSession.js +3 -0
- package/dist/esm/session/NodeSession.js.map +1 -1
- package/dist/esm/session/Session.d.ts +3 -33
- package/dist/esm/session/Session.d.ts.map +1 -1
- package/dist/esm/session/Session.js +4 -9
- package/dist/esm/session/Session.js.map +1 -1
- package/dist/esm/session/SessionIntervals.d.ts +36 -0
- package/dist/esm/session/SessionIntervals.d.ts.map +1 -0
- package/dist/esm/session/SessionIntervals.js +31 -0
- package/dist/esm/session/SessionIntervals.js.map +6 -0
- package/dist/esm/session/SessionManager.d.ts +1 -1
- package/dist/esm/session/SessionManager.d.ts.map +1 -1
- package/dist/esm/session/SessionManager.js +10 -14
- package/dist/esm/session/SessionManager.js.map +1 -1
- package/dist/esm/session/pase/PaseMessages.js +1 -1
- package/package.json +6 -6
- package/src/advertisement/Advertisement.ts +348 -0
- package/src/advertisement/Advertiser.ts +83 -0
- package/src/advertisement/CommissioningMode.ts +11 -0
- package/src/{common/InstanceBroadcaster.ts → advertisement/PairingHintBitmap.ts} +1 -92
- package/src/advertisement/ServiceDescription.ts +110 -0
- package/src/advertisement/ble/BleAdvertisement.ts +90 -0
- package/src/advertisement/ble/BleAdvertiser.ts +116 -0
- package/src/advertisement/ble/index.ts +8 -0
- package/src/advertisement/index.ts +13 -0
- package/src/advertisement/mdns/CommissionableMdnsAdvertisement.ts +118 -0
- package/src/advertisement/mdns/CommissionerMdnsAdvertisement.ts +73 -0
- package/src/advertisement/mdns/MdnsAdvertisement.ts +167 -0
- package/src/advertisement/mdns/MdnsAdvertiser.ts +248 -0
- package/src/advertisement/mdns/OperationalMdnsAdvertisement.ts +50 -0
- package/src/advertisement/mdns/index.ts +11 -0
- package/src/ble/Ble.ts +8 -5
- package/src/ble/BleConsts.ts +2 -1
- package/src/codec/BtpCodec.ts +4 -3
- package/src/common/Scanner.ts +1 -17
- package/src/common/SupportedTransportsBitmap.ts +25 -0
- package/src/common/index.ts +1 -1
- package/src/fabric/Fabric.ts +8 -0
- package/src/index.ts +1 -0
- package/src/mdns/{MdnsScanner.ts → MdnsClient.ts} +34 -103
- package/src/mdns/MdnsConsts.ts +27 -2
- package/src/mdns/MdnsServer.ts +76 -198
- package/src/mdns/MdnsService.ts +24 -27
- package/src/mdns/MdnsSocket.ts +179 -0
- package/src/mdns/index.ts +2 -3
- package/src/peer/ControllerCommissioner.ts +2 -2
- package/src/peer/ControllerDiscovery.ts +3 -3
- package/src/peer/PeerSet.ts +15 -9
- package/src/protocol/DeviceAdvertiser.ts +161 -151
- package/src/protocol/DeviceCommissioner.ts +65 -75
- package/src/protocol/ExchangeManager.ts +1 -1
- package/src/protocol/MessageExchange.ts +8 -14
- package/src/protocol/ProtocolHandler.ts +7 -0
- package/src/protocol/ProtocolStatusMessage.ts +26 -10
- package/src/securechannel/SecureChannelMessenger.ts +3 -3
- package/src/securechannel/SecureChannelProtocol.ts +2 -2
- package/src/securechannel/SecureChannelStatusMessageSchema.ts +3 -3
- package/src/session/NodeSession.ts +4 -0
- package/src/session/Session.ts +6 -42
- package/src/session/SessionIntervals.ts +57 -0
- package/src/session/SessionManager.ts +9 -13
- package/src/session/pase/PaseMessages.ts +1 -1
- package/dist/cjs/common/InstanceBroadcaster.d.ts.map +0 -1
- package/dist/cjs/common/InstanceBroadcaster.js.map +0 -6
- package/dist/cjs/mdns/MdnsBroadcaster.d.ts +0 -34
- package/dist/cjs/mdns/MdnsBroadcaster.d.ts.map +0 -1
- package/dist/cjs/mdns/MdnsBroadcaster.js +0 -365
- package/dist/cjs/mdns/MdnsBroadcaster.js.map +0 -6
- package/dist/cjs/mdns/MdnsInstanceBroadcaster.d.ts +0 -28
- package/dist/cjs/mdns/MdnsInstanceBroadcaster.d.ts.map +0 -1
- package/dist/cjs/mdns/MdnsInstanceBroadcaster.js +0 -87
- package/dist/cjs/mdns/MdnsInstanceBroadcaster.js.map +0 -6
- package/dist/cjs/mdns/MdnsScanner.d.ts.map +0 -1
- package/dist/cjs/mdns/MdnsScanner.js.map +0 -6
- package/dist/esm/common/InstanceBroadcaster.d.ts.map +0 -1
- package/dist/esm/mdns/MdnsBroadcaster.d.ts +0 -34
- package/dist/esm/mdns/MdnsBroadcaster.d.ts.map +0 -1
- package/dist/esm/mdns/MdnsBroadcaster.js +0 -378
- package/dist/esm/mdns/MdnsBroadcaster.js.map +0 -6
- package/dist/esm/mdns/MdnsInstanceBroadcaster.d.ts +0 -28
- package/dist/esm/mdns/MdnsInstanceBroadcaster.d.ts.map +0 -1
- package/dist/esm/mdns/MdnsInstanceBroadcaster.js +0 -67
- package/dist/esm/mdns/MdnsInstanceBroadcaster.js.map +0 -6
- package/dist/esm/mdns/MdnsScanner.d.ts.map +0 -1
- package/dist/esm/mdns/MdnsScanner.js.map +0 -6
- package/src/mdns/MdnsBroadcaster.ts +0 -451
- package/src/mdns/MdnsInstanceBroadcaster.ts +0 -88
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
import { CommissioningMode } from "#advertisement/CommissioningMode.js";
|
|
8
|
+
import { ServiceDescription } from "#advertisement/ServiceDescription.js";
|
|
7
9
|
import { AdministratorCommissioning } from "#clusters/administrator-commissioning";
|
|
8
10
|
import { FailsafeContext } from "#common/FailsafeContext.js";
|
|
9
|
-
import { CommissioningMode } from "#common/InstanceBroadcaster.js";
|
|
10
11
|
import { FabricManager } from "#fabric/FabricManager.js";
|
|
11
12
|
import {
|
|
12
|
-
Diagnostic,
|
|
13
13
|
Environment,
|
|
14
14
|
Environmental,
|
|
15
15
|
InternalError,
|
|
@@ -18,11 +18,13 @@ import {
|
|
|
18
18
|
MatterFlowError,
|
|
19
19
|
MaybePromise,
|
|
20
20
|
ObserverGroup,
|
|
21
|
+
Time,
|
|
22
|
+
Timer,
|
|
21
23
|
} from "#general";
|
|
22
24
|
import { SecureChannelProtocol } from "#securechannel/SecureChannelProtocol.js";
|
|
23
25
|
import { PaseServer } from "#session/pase/PaseServer.js";
|
|
24
26
|
import { SessionManager } from "#session/SessionManager.js";
|
|
25
|
-
import { CommissioningOptions, StatusCode, StatusResponseError } from "#types";
|
|
27
|
+
import { CommissioningOptions, STANDARD_COMMISSIONING_TIMEOUT_S, StatusCode, StatusResponseError } from "#types";
|
|
26
28
|
import type { ControllerCommissioner } from "../peer/ControllerCommissioner.js";
|
|
27
29
|
import { DeviceAdvertiser } from "./DeviceAdvertiser.js";
|
|
28
30
|
|
|
@@ -59,52 +61,16 @@ export class DeviceCommissioner {
|
|
|
59
61
|
#activeDiscriminator?: number;
|
|
60
62
|
#activeCommissioningEndCallback?: () => MaybePromise;
|
|
61
63
|
#observers = new ObserverGroup(this);
|
|
64
|
+
#commissioningTimeout?: Timer;
|
|
62
65
|
|
|
63
66
|
constructor(context: DeviceCommissionerContext) {
|
|
64
67
|
this.#context = context;
|
|
65
68
|
|
|
66
|
-
this.#observers.on(this.#context.advertiser.timedOut, this.endCommissioning);
|
|
67
|
-
|
|
68
|
-
// If a commissioning window is open then we re-announce this because it was ended as fabric got added
|
|
69
|
-
this.#observers.on(this.#context.fabrics.events.deleted, async () => {
|
|
70
|
-
// If a commissioning window is open, or we removed the last fabric, then we re-announce this
|
|
71
|
-
// because it was ended as fabric got added
|
|
72
|
-
if (
|
|
73
|
-
this.#context.fabrics.length === 0 ||
|
|
74
|
-
this.#windowStatus !== AdministratorCommissioning.CommissioningWindowStatus.WindowNotOpen
|
|
75
|
-
) {
|
|
76
|
-
this.reactivateAdvertiser();
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
// No fabric paired yet, so announce as "ready for commissioning"
|
|
81
|
-
this.#observers.on(this.#context.advertiser.operationalModeEnded, this.allowBasicCommissioning);
|
|
82
|
-
|
|
83
69
|
// Cancel commissioning when there are too many PASE errors
|
|
84
70
|
this.#observers.on(this.#context.secureChannelProtocol.tooManyPaseErrors, async () => {
|
|
85
71
|
logger.info("Maximum number of PASE pairing errors reached, canceling commissioning");
|
|
86
72
|
await this.endCommissioning();
|
|
87
73
|
});
|
|
88
|
-
|
|
89
|
-
this.#observers.on(this.#context.sessions.sessions.deleted, session => {
|
|
90
|
-
const currentFabricIndex = session.fabric?.fabricIndex;
|
|
91
|
-
|
|
92
|
-
// Verify if the session associated fabric still exists
|
|
93
|
-
const existingSessionFabric =
|
|
94
|
-
currentFabricIndex === undefined
|
|
95
|
-
? undefined
|
|
96
|
-
: this.#context.fabrics.findByIndex(currentFabricIndex)?.fabricIndex;
|
|
97
|
-
|
|
98
|
-
// When a session closes, announce existing fabrics again so that controller can detect the device again.
|
|
99
|
-
// When session was closed and no fabric exist anymore then this is triggering a factory reset in upper
|
|
100
|
-
// layer and it would be not good to announce a commissionable device and then reset that again with the
|
|
101
|
-
// factory reset
|
|
102
|
-
if (this.#context.fabrics.length > 0 || session.isPase || !existingSessionFabric) {
|
|
103
|
-
this.#context.advertiser
|
|
104
|
-
.startAdvertising()
|
|
105
|
-
.catch(error => logger.warn(`Error while announcing`, error));
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
74
|
}
|
|
109
75
|
|
|
110
76
|
static [Environmental.create](env: Environment) {
|
|
@@ -131,12 +97,12 @@ export class DeviceCommissioner {
|
|
|
131
97
|
) {
|
|
132
98
|
if (this.#windowStatus === AdministratorCommissioning.CommissioningWindowStatus.BasicWindowOpen) {
|
|
133
99
|
throw new MatterFlowError(
|
|
134
|
-
"Basic commissioning window is already open! Cannot set
|
|
100
|
+
"Basic commissioning window is already open! Cannot set enhanced commissioning mode.",
|
|
135
101
|
);
|
|
136
102
|
}
|
|
137
103
|
|
|
138
104
|
this.#context.secureChannelProtocol.setPaseCommissioner(paseServer);
|
|
139
|
-
|
|
105
|
+
this.#becomeCommissionable(
|
|
140
106
|
AdministratorCommissioning.CommissioningWindowStatus.EnhancedWindowOpen,
|
|
141
107
|
commissioningEndCallback,
|
|
142
108
|
discriminator,
|
|
@@ -146,7 +112,7 @@ export class DeviceCommissioner {
|
|
|
146
112
|
async allowBasicCommissioning(commissioningEndCallback?: () => MaybePromise) {
|
|
147
113
|
if (this.#windowStatus === AdministratorCommissioning.CommissioningWindowStatus.EnhancedWindowOpen) {
|
|
148
114
|
throw new MatterFlowError(
|
|
149
|
-
"Enhanced commissioning window is already open! Cannot set
|
|
115
|
+
"Enhanced commissioning window is already open! Cannot set basic commissioning mode.",
|
|
150
116
|
);
|
|
151
117
|
}
|
|
152
118
|
|
|
@@ -157,7 +123,7 @@ export class DeviceCommissioner {
|
|
|
157
123
|
}),
|
|
158
124
|
);
|
|
159
125
|
|
|
160
|
-
|
|
126
|
+
this.#becomeCommissionable(
|
|
161
127
|
AdministratorCommissioning.CommissioningWindowStatus.BasicWindowOpen,
|
|
162
128
|
commissioningEndCallback,
|
|
163
129
|
);
|
|
@@ -166,16 +132,6 @@ export class DeviceCommissioner {
|
|
|
166
132
|
beginTimed(failsafeContext: FailsafeContext) {
|
|
167
133
|
this.#failsafeContext = failsafeContext;
|
|
168
134
|
|
|
169
|
-
this.#context.fabrics.events.added.on(fabric => {
|
|
170
|
-
const fabrics = this.#context.fabrics.fabrics;
|
|
171
|
-
this.#context.advertiser
|
|
172
|
-
.advertiseFabrics(fabrics, true)
|
|
173
|
-
.catch(error =>
|
|
174
|
-
logger.warn(`Error sending Fabric announcement for Index ${fabric.fabricIndex}`, error),
|
|
175
|
-
);
|
|
176
|
-
logger.info("Announce done", Diagnostic.dict({ fabric: fabric.fabricId, fabricIndex: fabric.fabricIndex }));
|
|
177
|
-
});
|
|
178
|
-
|
|
179
135
|
failsafeContext.commissioned.on(async () => await this.endCommissioning());
|
|
180
136
|
|
|
181
137
|
failsafeContext.construction.change.on(status => {
|
|
@@ -197,55 +153,79 @@ export class DeviceCommissioner {
|
|
|
197
153
|
);
|
|
198
154
|
}
|
|
199
155
|
|
|
200
|
-
|
|
201
|
-
if (this.#windowStatus === AdministratorCommissioning.CommissioningWindowStatus.WindowNotOpen) {
|
|
202
|
-
return;
|
|
203
|
-
}
|
|
204
|
-
this.#enterCommissioningMode(this.#windowStatus, this.#activeDiscriminator).catch(error =>
|
|
205
|
-
logger.warn("Error sending announcement:", error),
|
|
206
|
-
);
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
async #enterCommissioningMode(
|
|
156
|
+
#enterCommissioningMode(
|
|
210
157
|
windowStatus: AdministratorCommissioning.CommissioningWindowStatus,
|
|
211
158
|
discriminator?: number,
|
|
212
159
|
) {
|
|
160
|
+
this.#cancelTimeout();
|
|
161
|
+
|
|
213
162
|
this.#windowStatus = windowStatus;
|
|
214
163
|
const commissioningConfig = this.#context.commissioningConfig.values;
|
|
215
|
-
|
|
164
|
+
const advertisementWindowS = commissioningConfig.advertisementWindowS ?? STANDARD_COMMISSIONING_TIMEOUT_S;
|
|
165
|
+
|
|
166
|
+
const mode =
|
|
216
167
|
windowStatus === AdministratorCommissioning.CommissioningWindowStatus.EnhancedWindowOpen
|
|
217
168
|
? CommissioningMode.Enhanced
|
|
218
|
-
: CommissioningMode.Basic
|
|
219
|
-
|
|
169
|
+
: CommissioningMode.Basic;
|
|
170
|
+
|
|
171
|
+
this.#context.advertiser.enterCommissioningMode(
|
|
172
|
+
ServiceDescription.Commissionable({
|
|
220
173
|
...commissioningConfig.productDescription,
|
|
174
|
+
mode,
|
|
221
175
|
discriminator: discriminator ?? commissioningConfig.discriminator,
|
|
222
|
-
},
|
|
176
|
+
}),
|
|
177
|
+
);
|
|
178
|
+
|
|
179
|
+
this.#commissioningTimeout = Time.getTimer(
|
|
180
|
+
"Commissioning timeout",
|
|
181
|
+
advertisementWindowS,
|
|
182
|
+
this.endCommissioning.bind(this),
|
|
223
183
|
);
|
|
224
184
|
}
|
|
225
185
|
|
|
226
|
-
|
|
227
|
-
windowStatus:
|
|
186
|
+
#becomeCommissionable(
|
|
187
|
+
windowStatus:
|
|
188
|
+
| AdministratorCommissioning.CommissioningWindowStatus.EnhancedWindowOpen
|
|
189
|
+
| AdministratorCommissioning.CommissioningWindowStatus.BasicWindowOpen,
|
|
228
190
|
activeCommissioningEndCallback?: () => MaybePromise,
|
|
229
191
|
discriminator?: number,
|
|
230
192
|
) {
|
|
193
|
+
if (this.#windowStatus !== AdministratorCommissioning.CommissioningWindowStatus.WindowNotOpen) {
|
|
194
|
+
if (this.#windowStatus !== windowStatus) {
|
|
195
|
+
throw new InternalError(
|
|
196
|
+
`Commissioning mode ${windowStatus} request but already in mode ${this.#windowStatus}`,
|
|
197
|
+
);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
if (
|
|
201
|
+
this.#activeCommissioningEndCallback &&
|
|
202
|
+
this.#activeCommissioningEndCallback !== activeCommissioningEndCallback
|
|
203
|
+
) {
|
|
204
|
+
throw new InternalError(`Already in commissioning mode with a different callback`);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
231
208
|
if (
|
|
232
209
|
this.#windowStatus === windowStatus &&
|
|
233
210
|
(discriminator === undefined || discriminator === this.#activeDiscriminator)
|
|
234
211
|
) {
|
|
235
|
-
|
|
236
|
-
return
|
|
212
|
+
this.#enterCommissioningMode(this.#windowStatus, this.#activeDiscriminator);
|
|
213
|
+
return;
|
|
237
214
|
}
|
|
215
|
+
|
|
238
216
|
if (this.#windowStatus !== AdministratorCommissioning.CommissioningWindowStatus.WindowNotOpen) {
|
|
239
217
|
throw new InternalError(`Commissioning window already open with different mode (${this.#windowStatus})!`);
|
|
240
218
|
}
|
|
219
|
+
|
|
241
220
|
if (this.#activeCommissioningEndCallback !== undefined) {
|
|
242
221
|
throw new InternalError("Commissioning window already open with different callback!");
|
|
243
222
|
}
|
|
223
|
+
|
|
244
224
|
this.#activeCommissioningEndCallback = activeCommissioningEndCallback;
|
|
245
225
|
this.#activeDiscriminator = discriminator;
|
|
246
226
|
|
|
247
227
|
// MDNS is sent in parallel
|
|
248
|
-
|
|
228
|
+
this.#enterCommissioningMode(windowStatus, discriminator);
|
|
249
229
|
}
|
|
250
230
|
|
|
251
231
|
async endCommissioning() {
|
|
@@ -253,7 +233,7 @@ export class DeviceCommissioner {
|
|
|
253
233
|
return;
|
|
254
234
|
}
|
|
255
235
|
|
|
256
|
-
|
|
236
|
+
this.#cancelTimeout();
|
|
257
237
|
|
|
258
238
|
this.#context.secureChannelProtocol.removePaseCommissioner();
|
|
259
239
|
|
|
@@ -267,10 +247,11 @@ export class DeviceCommissioner {
|
|
|
267
247
|
|
|
268
248
|
await this.#context.advertiser.exitCommissioningMode();
|
|
269
249
|
|
|
270
|
-
logger.
|
|
250
|
+
logger.debug("No longer commissioning");
|
|
271
251
|
}
|
|
272
252
|
|
|
273
253
|
async close() {
|
|
254
|
+
this.#cancelTimeout();
|
|
274
255
|
this.#observers.close();
|
|
275
256
|
await this.endCommissioning();
|
|
276
257
|
if (this.#failsafeContext) {
|
|
@@ -278,4 +259,13 @@ export class DeviceCommissioner {
|
|
|
278
259
|
this.#failsafeContext = undefined;
|
|
279
260
|
}
|
|
280
261
|
}
|
|
262
|
+
|
|
263
|
+
#cancelTimeout() {
|
|
264
|
+
if (!this.#commissioningTimeout) {
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
this.#commissioningTimeout.stop();
|
|
269
|
+
this.#commissioningTimeout = undefined;
|
|
270
|
+
}
|
|
281
271
|
}
|
|
@@ -422,7 +422,7 @@ export class ExchangeManager {
|
|
|
422
422
|
return {
|
|
423
423
|
channel,
|
|
424
424
|
localSessionParameters: this.#sessionManager.sessionParameters,
|
|
425
|
-
|
|
425
|
+
retry: number => this.#sessionManager.retry.emit(channel.session, number),
|
|
426
426
|
};
|
|
427
427
|
}
|
|
428
428
|
|
|
@@ -26,12 +26,8 @@ import {
|
|
|
26
26
|
MRP,
|
|
27
27
|
} from "#protocol/MessageChannel.js";
|
|
28
28
|
import { GroupSession } from "#session/GroupSession.js";
|
|
29
|
-
import {
|
|
30
|
-
|
|
31
|
-
SESSION_ACTIVE_THRESHOLD_MS,
|
|
32
|
-
SESSION_IDLE_INTERVAL_MS,
|
|
33
|
-
SessionParameters,
|
|
34
|
-
} from "#session/Session.js";
|
|
29
|
+
import { SessionParameters } from "#session/Session.js";
|
|
30
|
+
import { SessionIntervals } from "#session/SessionIntervals.js";
|
|
35
31
|
import {
|
|
36
32
|
GroupId,
|
|
37
33
|
NodeId,
|
|
@@ -103,7 +99,7 @@ export const MATTER_MESSAGE_OVERHEAD = 26 + 12 + CRYPTO_AEAD_MIC_LENGTH_BYTES;
|
|
|
103
99
|
*/
|
|
104
100
|
export interface MessageExchangeContext {
|
|
105
101
|
channel: MessageChannel;
|
|
106
|
-
|
|
102
|
+
retry(number: number): void;
|
|
107
103
|
localSessionParameters: SessionParameters;
|
|
108
104
|
}
|
|
109
105
|
|
|
@@ -191,10 +187,10 @@ export class MessageExchange {
|
|
|
191
187
|
this.#exchangeId = exchangeId;
|
|
192
188
|
this.#protocolId = protocolId;
|
|
193
189
|
|
|
194
|
-
const { activeIntervalMs, idleIntervalMs, activeThresholdMs } = session.parameters;
|
|
195
|
-
this.#activeIntervalMs = activeIntervalMs
|
|
196
|
-
this.#idleIntervalMs = idleIntervalMs
|
|
197
|
-
this.#activeThresholdMs = activeThresholdMs
|
|
190
|
+
const { activeIntervalMs, idleIntervalMs, activeThresholdMs } = SessionIntervals(session.parameters);
|
|
191
|
+
this.#activeIntervalMs = activeIntervalMs;
|
|
192
|
+
this.#idleIntervalMs = idleIntervalMs;
|
|
193
|
+
this.#activeThresholdMs = activeThresholdMs;
|
|
198
194
|
|
|
199
195
|
this.#used = !isInitiator; // If we are the initiator then exchange was not used yet, so track it
|
|
200
196
|
|
|
@@ -534,9 +530,7 @@ export class MessageExchange {
|
|
|
534
530
|
|
|
535
531
|
this.session.notifyActivity(false);
|
|
536
532
|
|
|
537
|
-
|
|
538
|
-
this.context.resubmissionStarted();
|
|
539
|
-
}
|
|
533
|
+
this.context.retry(this.#retransmissionCounter);
|
|
540
534
|
const resubmissionBackoffTime = this.channel.getMrpResubmissionBackOffTime(this.#retransmissionCounter);
|
|
541
535
|
logger.debug(
|
|
542
536
|
`Resubmit message ${message.packetHeader.messageId} (retransmission attempt ${this.#retransmissionCounter}, backoff time ${resubmissionBackoffTime}ms))`,
|
|
@@ -8,8 +8,15 @@ import { Message } from "../codec/MessageCodec.js";
|
|
|
8
8
|
import { MessageExchange } from "./MessageExchange.js";
|
|
9
9
|
|
|
10
10
|
export interface ProtocolHandler {
|
|
11
|
+
/** Protocol ID that this handler implements */
|
|
11
12
|
readonly id: number;
|
|
13
|
+
|
|
14
|
+
/** Indicates whether this protocol requires a secure session to be established before it can be used */
|
|
12
15
|
readonly requiresSecureSession: boolean;
|
|
16
|
+
|
|
17
|
+
/** Called on a new exchange that uses this protocol. The message is the first message of the exchange. */
|
|
13
18
|
onNewExchange(exchange: MessageExchange, message: Message): Promise<void>;
|
|
19
|
+
|
|
20
|
+
/** Called when the protocol handler is no longer needed and can clean up resources. */
|
|
14
21
|
close(): Promise<void>;
|
|
15
22
|
}
|
|
@@ -5,33 +5,41 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { DataReader, DataWriter, Endian } from "#general";
|
|
8
|
-
import { GeneralStatusCode, Schema } from "#types";
|
|
8
|
+
import { GeneralStatusCode, Schema, VendorId } from "#types";
|
|
9
9
|
|
|
10
10
|
export type ProtocolStatusMessage<T> = {
|
|
11
11
|
generalStatus: GeneralStatusCode;
|
|
12
12
|
protocolId: number;
|
|
13
|
+
vendorId: VendorId;
|
|
13
14
|
protocolStatus: T;
|
|
14
15
|
protocolData?: Uint8Array;
|
|
15
16
|
};
|
|
16
17
|
|
|
17
18
|
export abstract class ProtocolStatusMessageSchema<T extends ProtocolStatusMessage<any>> extends Schema<T, Uint8Array> {
|
|
18
19
|
#protocolId: number;
|
|
20
|
+
#vendorId: number;
|
|
19
21
|
#protocolSpecificDataAllowed: boolean;
|
|
20
22
|
|
|
21
|
-
constructor(protocolId: number, protocolSpecificDataAllowed = true) {
|
|
23
|
+
constructor(protocol: number | { protocolId: number; vendorId: number }, protocolSpecificDataAllowed = true) {
|
|
22
24
|
super();
|
|
23
|
-
|
|
25
|
+
if (typeof protocol === "number") {
|
|
26
|
+
this.#protocolId = protocol;
|
|
27
|
+
this.#vendorId = 0;
|
|
28
|
+
} else {
|
|
29
|
+
this.#protocolId = protocol.protocolId;
|
|
30
|
+
this.#vendorId = protocol.vendorId;
|
|
31
|
+
}
|
|
24
32
|
this.#protocolSpecificDataAllowed = protocolSpecificDataAllowed;
|
|
25
33
|
}
|
|
26
34
|
|
|
27
|
-
override encode(message: Omit<T, "protocolId">): Uint8Array {
|
|
28
|
-
return super.encode({ ...message, protocolId: this.#protocolId } as T);
|
|
35
|
+
override encode(message: Omit<T, "protocolId" | "vendorId">): Uint8Array {
|
|
36
|
+
return super.encode({ ...message, protocolId: this.#protocolId, vendorId: this.#vendorId } as T);
|
|
29
37
|
}
|
|
30
38
|
|
|
31
|
-
encodeInternal({ generalStatus, protocolStatus, protocolId, protocolData }: T) {
|
|
39
|
+
encodeInternal({ generalStatus, protocolStatus, protocolId, protocolData, vendorId }: T) {
|
|
32
40
|
const writer = new DataWriter(Endian.Little);
|
|
33
41
|
writer.writeUInt16(generalStatus);
|
|
34
|
-
writer.writeUInt32(protocolId);
|
|
42
|
+
writer.writeUInt32((vendorId << 16) | protocolId);
|
|
35
43
|
writer.writeUInt16(protocolStatus);
|
|
36
44
|
if (this.#protocolSpecificDataAllowed && protocolData !== undefined && protocolData.length > 0) {
|
|
37
45
|
writer.writeByteArray(protocolData);
|
|
@@ -42,10 +50,18 @@ export abstract class ProtocolStatusMessageSchema<T extends ProtocolStatusMessag
|
|
|
42
50
|
decodeInternal(bytes: Uint8Array) {
|
|
43
51
|
const reader = new DataReader(bytes, Endian.Little);
|
|
44
52
|
const generalStatus = reader.readUInt16();
|
|
45
|
-
const
|
|
53
|
+
const vendorProtocolId = reader.readUInt32();
|
|
46
54
|
const protocolStatus = reader.readUInt16();
|
|
47
|
-
const
|
|
55
|
+
const protocolData = reader.remainingBytesCount > 0 ? reader.remainingBytes : undefined;
|
|
48
56
|
|
|
49
|
-
|
|
57
|
+
const protocolId = vendorProtocolId & 0xffff;
|
|
58
|
+
const vendorId = VendorId(vendorProtocolId >>> 16);
|
|
59
|
+
return {
|
|
60
|
+
generalStatus,
|
|
61
|
+
protocolId,
|
|
62
|
+
protocolStatus,
|
|
63
|
+
protocolData,
|
|
64
|
+
vendorId,
|
|
65
|
+
} as unknown as T;
|
|
50
66
|
}
|
|
51
67
|
}
|
|
@@ -8,7 +8,7 @@ import { Diagnostic, MatterError, UnexpectedDataError } from "#general";
|
|
|
8
8
|
import { GeneralStatusCode, SecureChannelStatusCode, SecureMessageType, TlvSchema } from "#types";
|
|
9
9
|
import { Message } from "../codec/MessageCodec.js";
|
|
10
10
|
import { ExchangeSendOptions, MessageExchange } from "../protocol/MessageExchange.js";
|
|
11
|
-
import {
|
|
11
|
+
import { SecureChannelStatusMessage } from "./SecureChannelStatusMessageSchema.js";
|
|
12
12
|
|
|
13
13
|
/** Error base Class for all errors related to the status response messages. */
|
|
14
14
|
export class ChannelStatusResponseError extends MatterError {
|
|
@@ -150,7 +150,7 @@ export class SecureChannelMessenger {
|
|
|
150
150
|
) {
|
|
151
151
|
await this.exchange.send(
|
|
152
152
|
SecureMessageType.StatusReport,
|
|
153
|
-
|
|
153
|
+
SecureChannelStatusMessage.encode({
|
|
154
154
|
generalStatus,
|
|
155
155
|
protocolStatus,
|
|
156
156
|
}),
|
|
@@ -171,7 +171,7 @@ export class SecureChannelMessenger {
|
|
|
171
171
|
} = message;
|
|
172
172
|
if (messageType !== SecureMessageType.StatusReport) return;
|
|
173
173
|
|
|
174
|
-
const { generalStatus, protocolId, protocolStatus } =
|
|
174
|
+
const { generalStatus, protocolId, protocolStatus } = SecureChannelStatusMessage.decode(payload);
|
|
175
175
|
if (generalStatus !== GeneralStatusCode.Success) {
|
|
176
176
|
throw new ChannelStatusResponseError(
|
|
177
177
|
`Received general error status for protocol ${protocolId}${logHint ? ` (${logHint})` : ""}`,
|
|
@@ -23,7 +23,7 @@ import { SecureSession } from "../session/SecureSession.js";
|
|
|
23
23
|
import { CaseServer } from "../session/case/CaseServer.js";
|
|
24
24
|
import { MaximumPasePairingErrorsReachedError, PaseServer } from "../session/pase/PaseServer.js";
|
|
25
25
|
import { ChannelStatusResponseError, SecureChannelMessenger } from "./SecureChannelMessenger.js";
|
|
26
|
-
import {
|
|
26
|
+
import { SecureChannelStatusMessage } from "./SecureChannelStatusMessageSchema.js";
|
|
27
27
|
|
|
28
28
|
const logger = Logger.get("SecureChannelProtocol");
|
|
29
29
|
|
|
@@ -62,7 +62,7 @@ export class StatusReportOnlySecureChannelProtocol implements ProtocolHandler {
|
|
|
62
62
|
);
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
const { generalStatus, protocolId, protocolStatus } =
|
|
65
|
+
const { generalStatus, protocolId, protocolStatus } = SecureChannelStatusMessage.decode(payload);
|
|
66
66
|
if (generalStatus !== GeneralStatusCode.Success) {
|
|
67
67
|
throw new ChannelStatusResponseError(
|
|
68
68
|
`Received general error status (${protocolId})`,
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
import { ProtocolStatusMessage, ProtocolStatusMessageSchema } from "#protocol/ProtocolStatusMessage.js";
|
|
8
8
|
import { SECURE_CHANNEL_PROTOCOL_ID, SecureChannelStatusCode } from "#types";
|
|
9
9
|
|
|
10
|
-
export type
|
|
10
|
+
export type SecureChannelStatus = ProtocolStatusMessage<SecureChannelStatusCode>;
|
|
11
11
|
|
|
12
|
-
export class SecureChannelStatusMessageSchema extends ProtocolStatusMessageSchema<
|
|
12
|
+
export class SecureChannelStatusMessageSchema extends ProtocolStatusMessageSchema<SecureChannelStatus> {}
|
|
13
13
|
|
|
14
|
-
export const
|
|
14
|
+
export const SecureChannelStatusMessage = new SecureChannelStatusMessageSchema(SECURE_CHANNEL_PROTOCOL_ID);
|
|
@@ -300,6 +300,10 @@ export class NodeSession extends SecureSession {
|
|
|
300
300
|
return this.#peerNodeId;
|
|
301
301
|
}
|
|
302
302
|
|
|
303
|
+
get hasAssociatedFabric() {
|
|
304
|
+
return this.#fabric !== undefined;
|
|
305
|
+
}
|
|
306
|
+
|
|
303
307
|
get associatedFabric(): Fabric {
|
|
304
308
|
if (this.#fabric === undefined) {
|
|
305
309
|
throw new NoAssociatedFabricError(
|
package/src/session/Session.ts
CHANGED
|
@@ -4,30 +4,16 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
import { SupportedTransportsBitmap } from "#common/SupportedTransportsBitmap.js";
|
|
7
8
|
import { AsyncObservable, DataWriter, Endian, InternalError, Time } from "#general";
|
|
8
9
|
import { NodeId, TypeFromPartialBitSchema } from "#types";
|
|
9
10
|
import { DecodedMessage, DecodedPacket, Message, Packet, SessionType } from "../codec/MessageCodec.js";
|
|
10
|
-
import { SupportedTransportsBitmap } from "../common/Scanner.js";
|
|
11
11
|
import { Fabric } from "../fabric/Fabric.js";
|
|
12
12
|
import { MessageCounter } from "../protocol/MessageCounter.js";
|
|
13
13
|
import { MessageReceptionState } from "../protocol/MessageReceptionState.js";
|
|
14
|
+
import { SessionIntervals } from "./SessionIntervals.js";
|
|
14
15
|
import { type SessionManager } from "./SessionManager.js";
|
|
15
16
|
|
|
16
|
-
/**
|
|
17
|
-
* Minimum amount of time between sender retries when the destination node is Active. This SHALL be greater than or
|
|
18
|
-
* equal to the maximum amount of time a node may be non-responsive to incoming messages when Active.
|
|
19
|
-
*/
|
|
20
|
-
export const SESSION_ACTIVE_INTERVAL_MS = 300;
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Minimum amount of time between sender retries when the destination node is Idle. This SHALL be greater than or equal
|
|
24
|
-
* to the maximum amount of time a node may be non-responsive to incoming messages when Idle.
|
|
25
|
-
*/
|
|
26
|
-
export const SESSION_IDLE_INTERVAL_MS = 500;
|
|
27
|
-
|
|
28
|
-
/** Minimum amount of time the node SHOULD stay active after network activity. */
|
|
29
|
-
export const SESSION_ACTIVE_THRESHOLD_MS = 4000;
|
|
30
|
-
|
|
31
17
|
/** Fallback value for Data Model Revision when not provided in Session parameters. We use Matter 1.2 as assumption. */
|
|
32
18
|
export const FALLBACK_DATAMODEL_REVISION = 17;
|
|
33
19
|
|
|
@@ -48,29 +34,7 @@ export const FALLBACK_MAX_PATHS_PER_INVOKE = 1;
|
|
|
48
34
|
|
|
49
35
|
export const FALLBACK_MAX_TCP_MESSAGE_SIZE = 64000;
|
|
50
36
|
|
|
51
|
-
export interface SessionParameters {
|
|
52
|
-
/**
|
|
53
|
-
* Minimum amount of time between sender retries when the destination node is Idle.
|
|
54
|
-
* This SHALL be greater than or equal to the maximum amount of time a node may be
|
|
55
|
-
* non-responsive to incoming messages when Idle.
|
|
56
|
-
* Default: 500ms
|
|
57
|
-
*/
|
|
58
|
-
idleIntervalMs: number;
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Minimum amount of time between sender retries when the destination node is Active.
|
|
62
|
-
* This SHALL be greater than or equal to the maximum amount of time a node may be
|
|
63
|
-
* non-responsive to incoming messages when Active.
|
|
64
|
-
* Default: 300ms
|
|
65
|
-
*/
|
|
66
|
-
activeIntervalMs: number;
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Minimum amount of time the node SHOULD stay active after network activity.
|
|
70
|
-
* Default: 4000ms
|
|
71
|
-
*/
|
|
72
|
-
activeThresholdMs: number;
|
|
73
|
-
|
|
37
|
+
export interface SessionParameters extends SessionIntervals {
|
|
74
38
|
/** Version of Data Model for the Session parameters side where it appears. */
|
|
75
39
|
dataModelRevision: number;
|
|
76
40
|
|
|
@@ -136,9 +100,9 @@ export abstract class Session {
|
|
|
136
100
|
messageCounter,
|
|
137
101
|
messageReceptionState,
|
|
138
102
|
sessionParameters: {
|
|
139
|
-
idleIntervalMs =
|
|
140
|
-
activeIntervalMs =
|
|
141
|
-
activeThresholdMs =
|
|
103
|
+
idleIntervalMs = SessionIntervals.defaults.idleIntervalMs,
|
|
104
|
+
activeIntervalMs = SessionIntervals.defaults.activeIntervalMs,
|
|
105
|
+
activeThresholdMs = SessionIntervals.defaults.activeThresholdMs,
|
|
142
106
|
dataModelRevision = FALLBACK_DATAMODEL_REVISION,
|
|
143
107
|
interactionModelRevision = FALLBACK_INTERACTIONMODEL_REVISION,
|
|
144
108
|
specificationVersion = FALLBACK_SPECIFICATION_VERSION,
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022-2025 Matter.js Authors
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { ImplementationError } from "@matter/general";
|
|
8
|
+
|
|
9
|
+
export interface SessionIntervals {
|
|
10
|
+
/**
|
|
11
|
+
* Minimum amount of time between sender retries when the destination node is idle. This SHALL be greater than or
|
|
12
|
+
* equal to the maximum amount of time a node may be non-responsive to incoming messages when idle.
|
|
13
|
+
*
|
|
14
|
+
* Default: 500ms
|
|
15
|
+
*/
|
|
16
|
+
idleIntervalMs: number;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Minimum amount of time between sender retries when the destination node is active. This SHALL be greater than or
|
|
20
|
+
* equal to the maximum amount of time a node may be non-responsive to incoming messages when active.
|
|
21
|
+
*
|
|
22
|
+
* Default: 300ms
|
|
23
|
+
*/
|
|
24
|
+
activeIntervalMs: number;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Minimum amount of time the node SHOULD stay active after network activity.
|
|
28
|
+
*
|
|
29
|
+
* Default: 4000ms
|
|
30
|
+
*/
|
|
31
|
+
activeThresholdMs: number;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function SessionIntervals(intervals?: Partial<SessionIntervals>): SessionIntervals {
|
|
35
|
+
const reified = { ...SessionIntervals.defaults, ...intervals };
|
|
36
|
+
const { idleIntervalMs, activeIntervalMs, activeThresholdMs } = reified;
|
|
37
|
+
|
|
38
|
+
if (idleIntervalMs !== undefined && idleIntervalMs > 3600000) {
|
|
39
|
+
throw new ImplementationError("Session Idle Interval must be less than 1 hour");
|
|
40
|
+
}
|
|
41
|
+
if (activeIntervalMs !== undefined && activeIntervalMs > 3600000) {
|
|
42
|
+
throw new ImplementationError("Session Active Interval must be less than 1 hour");
|
|
43
|
+
}
|
|
44
|
+
if (activeThresholdMs !== undefined && activeThresholdMs > 65535) {
|
|
45
|
+
throw new ImplementationError("Session Active Threshold must be less than 65535 seconds");
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return reified;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export namespace SessionIntervals {
|
|
52
|
+
export const defaults = {
|
|
53
|
+
idleIntervalMs: 500,
|
|
54
|
+
activeIntervalMs: 300,
|
|
55
|
+
activeThresholdMs: 4000,
|
|
56
|
+
};
|
|
57
|
+
}
|