/** * @license * Copyright 2022-2026 Matter.js Authors * SPDX-License-Identifier: Apache-2.0 */ import { SecureSession } from "#session/SecureSession.js"; import { AsyncObservable, Observable } from "@matter/general"; import { BdxMessenger } from "./BdxMessenger.js"; import { BdxSessionConfiguration } from "./BdxSessionConfiguration.js"; import { Flow } from "./flow/Flow.js"; import type { BdxInit } from "./schema/BdxInitMessagesSchema.js"; /** * Class to manage one BDX session. * * Matter BDX protocol is used to transfer files between devices. * * Notes: * * Even though Matter allows 64bit values for size and offset, we do not use them, as they make no sense for now. * We support up to MAX_SAFE_INTEGER for size and offset (which basically is 2^53 - 1 and so far enough for us). * * We support partial transfers (startOffset or shorter dataLength) only when we act as the sender. As a receiver, * only full transfers are supported. * * We do not use BlockQueryWithSkip when requesting data ourselves */ export declare class BdxSession { #private; /** Initializes a BdxSession as a sender, means that we upload data to the peer. */ static asSender(messenger: BdxMessenger, options: BdxSessionConfiguration.SenderInitiatorOptions): BdxSession; /** Initializes a BdxSession as a receiver, means that we download data from the peer. */ static asReceiver(messenger: BdxMessenger, options: BdxSessionConfiguration.InitiatorOptions): BdxSession; /** * Initializes a BdxSession from an incoming *Init message. The message determines the direction of the transfer. * The provided storages allow to map the file designator to a storage context depending on the path prefix in the * file designator. */ static fromMessage(messenger: BdxMessenger, options: BdxSessionConfiguration.ReceiverOptions): BdxSession; private constructor(); get progressInfo(): Observable<[bytesTransferred: number, totalBytesLength: number | undefined], void>; /** * Bytes transferred so far, 0 until the transfer flow is negotiated. Skipped ranges count as transferred, so a * transfer using BlockQueryWithSkip can report more than {@link dataLength}. */ get transferredBytes(): number; /** Size of the transfer, undefined while unknown. */ get dataLength(): number | undefined; /** * The *Init this session received, for a responder; undefined for an initiator, whose own *Init * `bdxSessionInitiator` composes on the wire rather than recording here. * * A copy: `BdxProtocol` announces a session before it negotiates, and negotiation reads this message, so * handing out the live one would let an observer change what the responder goes on to accept. */ get initMessage(): Readonly | undefined; /** * What the transfer settled on, undefined until the *Accept has been exchanged. * * For a responder these are what its own *Accept granted, which is how an observer reads back what this node * answered without decoding the wire. */ get transferParameters(): Flow.NegotiatedParameters | undefined; get progressFinished(): Observable<[totalBytesTransferred: number], void>; get progressCancelled(): Observable; /** Method called to start the session. It will end with a successful Transfer or with an error */ processTransfer(): Promise; get closed(): AsyncObservable; get peerAddress(): import("../index.js").PeerAddress; get session(): SecureSession; close(error?: unknown): Promise; } export declare namespace BdxSession { } //# sourceMappingURL=BdxSession.d.ts.map