import { EventEmitter } from '../eventemitter'; import { SecurityPolicy } from '../secure-channel/security_policy'; import { MessageSecurityMode } from '../secure-channel'; import { ObjectRegistry } from '../object-registry/objectRegistry'; import * as endpoints_service from '../service-endpoints'; import { ClientSecureChannelLayer, ConnectionStrategy } from '../secure-channel/client_secure_channel_layer'; import { RequestHeader, ResponseHeader } from '../service-secure-channel'; import { ClientSession } from './client_session'; import { EndpointDescription } from '../service-endpoints'; import { IGetEndpointsRequest } from '../generated/GetEndpointsRequest'; import { IFindServersOnNetworkRequest, ServerOnNetwork, IRequestHeader, ChannelSecurityToken } from '../generated'; import { IEncodable } from '../factory/factories_baseobject'; import { OPCUAClientOptions } from '../common/client_options'; import { CertificateStore } from '../common/certificate_store'; export type ErrorCallback = (err?: Error | null) => void; export interface OpcUaResponse extends IEncodable { responseHeader: ResponseHeader; } export interface OpcUaRequest extends IEncodable { requestHeader: RequestHeader; } export type ResponseCallback = (err: Error | null, response?: R1, arg2?: R2) => void; export interface IFindServersOptions { endpointUrl?: string; localeIds?: string[]; serverUris?: string[]; } export interface OPCUAClientEvents { close: ErrorCallback; backoff: (number: number, delay: number) => void; abort: () => void; start_reconnection: () => void; send_chunk: (messageChunk: ArrayBufferLike | ArrayBufferView) => void; after_reconnection: ErrorCallback; send_request: (requestMessage: IEncodable & { requestHeader: IRequestHeader; }) => void; receive_chunk: (message_chunk: DataView) => void; receive_response: (response: OpcUaResponse) => void; lifetime_75: (token: ChannelSecurityToken) => void; security_token_renewed: (channel: ClientSecureChannelLayer, token: ChannelSecurityToken) => void; connection_lost: () => void; connection_reestablished: () => void; timed_out_request: (requestMessage: IEncodable & { requestHeader: IRequestHeader; }) => void; } /** * @class OPCUAClientBase * @extends EventEmitter * @param options * @param options.defaultSecureTokenLifeTime {Number} default secure token lifetime in ms * @param [options.securityMode=MessageSecurityMode.None] {MessageSecurityMode} the default security mode. * @param [options.securityPolicy =SecurityPolicy.NONE] {SecurityPolicy} the security mode. * @param [options.serverCertificate=null] {Certificate} the server certificate. * @param [options.certificateFile="certificates/client_selfsigned_cert_1024.pem"] {String} client certificate pem file. * @param [options.privateKeyFile="certificates/client_key_1024.pem"] {String} client private key pem file. * @param [options.connectionStrategy] {Object} * @param [options.keepSessionAlive=false]{Boolean} * @param [options.keepPendingSessionsOnDisconnect=false] if set to true, pending session will not be automatically closed * * when disconnect is called * @constructor */ export declare class OPCUAClientBase extends EventEmitter { endpoint: any; protected clientCertificateStore: CertificateStore; /** * @property securityMode * @type MessageSecurityMode */ securityMode: MessageSecurityMode; /** * */ securityPolicy: SecurityPolicy; /** * */ serverCertificate?: Uint8Array; protected protocolVersion: number; protected registry: ObjectRegistry; protected _sessions: ClientSession[]; protected defaultSecureTokenLifetime: number; protected tokenRenewalInterval: number; protected keepPendingSessionsOnDisconnect: boolean; protected _endpointUrl: string; protected connectionStrategy: ConnectionStrategy; readonly encoding: 'opcua+uacp' | 'opcua+uajson'; /** * true if session shall periodically probe the server to keep the session alive and prevent timeout * @property keepSessionAlive * @type {boolean} */ protected keepSessionAlive: boolean; protected _byteRead: number; protected _byteWritten: number; protected _transactionsPerformed: number; protected _timedOutRequestCount: number; protected _secureChannel: ClientSecureChannelLayer | null; protected _server_endpoints: EndpointDescription[]; protected _clientName: string; protected _applicationName: string; /** * total number of bytes read by the client * @property bytesRead * @type {Number} */ get bytesRead(): number; /** * total number of bytes written by the client * @property bytesWritten * @type {Number} */ get bytesWritten(): number; /** * total number of transactions performed by the client * @property transactionsPerformed * @type {Number} */ get transactionsPerformed(): number; get timedOutRequestCount(): number; /** * is true when the client has already requested the server end points. * @property knowsServerEndpoint * @type boolean */ get knowsServerEndpoint(): boolean; /** * @property isReconnecting * @type {Boolean} true if the client is trying to reconnect to the server after a connection break. */ get isReconnecting(): boolean; /** * true if the connection strategy is set to automatically try to reconnect in case of failure * @property reconnectOnFailure * @type {Boolean} */ get reconnectOnFailure(): boolean; get secureChannel(): ClientSecureChannelLayer | null; get endpointUrl(): string; get sessions(): ClientSession[]; get clientName(): string; get applicationName(): string; constructor(options?: OPCUAClientOptions); closeSession(session: ClientSession, deleteSubscriptions: boolean, callback: ErrorCallback): any; /** * * connect the OPC-UA client to a server end point. * @param options * @param callback */ connect(endpointUrl: string, callback: ErrorCallback): void; /** * @method connectAsync * @param endpointUrl {string} * @async * @return {Promise} */ connectP(endpointUrl: string): Promise; disconnect(callback: ErrorCallback): void; /** * @method disconnectAsync * disconnect client from server * @return {Promise} * @async */ disconnectP(): Promise; performMessageTransaction(request: IEncodable & { requestHeader: RequestHeader; }, callback: ResponseCallback): void; /** * @method findServers * @param options * @param [options.endpointUrl] * @param [options.localeIds] Array * @param [options.serverUris] Array * @param callback */ findServers(options: IFindServersOptions | null, callback: ResponseCallback): void; findServersP(options: IFindServersOptions): Promise; findServersOnNetwork(options: IFindServersOnNetworkRequest | null, callback: (error: Error | null, servers?: ServerOnNetwork[]) => void): void; findServersOnNetworkP(options: IFindServersOnNetworkRequest): Promise; protected _close_pending_sessions(callback: ErrorCallback): void; /** * @method getEndpoints * @async * @async * * @param [options] * @param [options.endpointUrl] {String} the network address that the Client used to access the Discovery Endpoint . * @param [options.localeIds} {Array} List of locales to use. * @param [options.profileUris} {Array} List of transport profiles that the returned Endpoints shall support. * @param callback {(err: Error, endpoints?: EndpointDescription[]) => void} * @param callback.err {Error|null} * @param callback.serverEndpoints {Array} the array of endpoint descriptions * */ getEndpoints(options: IGetEndpointsRequest | null, callback: ResponseCallback): void; getEndpointsP(options: IGetEndpointsRequest | null): Promise; protected _on_connection_reestablished(callback: ErrorCallback): void; protected _addSession(session: ClientSession): void; protected _removeSession(session: ClientSession): void; /** * * return the endpoint information matching the specified url , security mode and security policy. * @method findEndpoint * @return {EndPoint} */ findEndpoint(endpointUrl: string, securityMode: MessageSecurityMode, securityPolicy: string): endpoints_service.EndpointDescription | undefined; toString(): string; protected _destroy_secure_channel(): void; private static __findEndpoint; protected _cancel_reconnection(callback: ErrorCallback): void; protected _recreate_secure_channel(callback: ErrorCallback): void; protected _getApplicationUri(): Promise; protected _internal_create_secure_channel(callback: ResponseCallback): void; private static _install_secure_channel_event_handlers; getClientNonce(): Uint8Array | null | undefined; getPrivateKey(): import("../crypto").PrivateKey | undefined; getCertificate(): Uint8Array | undefined; getCertificateChain(): Uint8Array | undefined; /** * * return the endpoint information matching security mode and security policy. * @method findEndpoint * @return {EndPoint} */ findEndpointForSecurity(securityMode: MessageSecurityMode, securityPolicy: SecurityPolicy): endpoints_service.EndpointDescription | undefined; } //# sourceMappingURL=client_base.d.ts.map