UNPKG

dbus-sdk

Version:

A Node.js SDK for interacting with DBus, enabling seamless service calling and exposure with TypeScript support

280 lines (279 loc) 17.9 kB
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.PropertiesInterface = exports.ObjectManagerInterface = exports.PeerInterface = exports.IntrospectableInterface = exports.DBusVariant = exports.DBusUnixFD = exports.DBusUint64 = exports.DBusUint32 = exports.DBusUint16 = exports.DBusStruct = exports.DBusString = exports.DBusSignature = exports.DBusObjectPath = exports.DBusInt64 = exports.DBusInt32 = exports.DBusInt16 = exports.DBusDouble = exports.DBusDictEntry = exports.DBusByte = exports.DBusBoolean = exports.DBusArray = exports.RequestNameResultCode = exports.RequestNameFlags = exports.DBusPropertyAccess = exports.DBusMessageType = exports.DBusMessageFlags = exports.DBusMessageEndianness = exports.Signature = exports.DBusSignedValue = exports.DBusSignalEmitter = exports.DBusMessage = exports.DBusConnection = exports.DBusBufferDecoder = exports.DBusBufferEncoder = exports.CreateDBusError = exports.LocalService = exports.LocalObject = exports.LocalInterface = exports.DBusService = exports.DBusObject = exports.DBusInterface = exports.DBus = void 0; // Core DBus Classes /** * Exports the main DBus class for interacting with a DBus connection. * Provides functionality for connecting to DBus, invoking methods, handling signals, and managing services. */ var DBus_1 = require("./DBus"); Object.defineProperty(exports, "DBus", { enumerable: true, get: function () { return DBus_1.DBus; } }); /** * Exports the DBusInterface class representing a DBus interface. * Allows interaction with specific interfaces on DBus objects for method calls and property access. */ var DBusInterface_1 = require("./DBusInterface"); Object.defineProperty(exports, "DBusInterface", { enumerable: true, get: function () { return DBusInterface_1.DBusInterface; } }); /** * Exports the DBusObject class representing a DBus object. * Provides access to interfaces and manages object-specific operations under a service. */ var DBusObject_1 = require("./DBusObject"); Object.defineProperty(exports, "DBusObject", { enumerable: true, get: function () { return DBusObject_1.DBusObject; } }); /** * Exports the DBusService class representing a DBus service. * Manages interactions with a specific service on the bus, including object retrieval and management. */ var DBusService_1 = require("./DBusService"); Object.defineProperty(exports, "DBusService", { enumerable: true, get: function () { return DBusService_1.DBusService; } }); /** * Exports the LocalInterface class for defining local DBus interfaces. * Used to create custom interfaces for local services with methods, properties, and signals. */ var LocalInterface_1 = require("./LocalInterface"); Object.defineProperty(exports, "LocalInterface", { enumerable: true, get: function () { return LocalInterface_1.LocalInterface; } }); /** * Exports the LocalObject class for defining local DBus objects. * Represents a local object that can host multiple interfaces within a service. */ var LocalObject_1 = require("./LocalObject"); Object.defineProperty(exports, "LocalObject", { enumerable: true, get: function () { return LocalObject_1.LocalObject; } }); /** * Exports the LocalService class for defining local DBus services. * Manages a local service implementation with objects and interfaces exposed on the bus. */ var LocalService_1 = require("./LocalService"); Object.defineProperty(exports, "LocalService", { enumerable: true, get: function () { return LocalService_1.LocalService; } }); // Utility and Low-Level Classes /** * Exports the CreateDBusError utility function for creating DBus-specific errors. * Used to generate errors with DBus error names and messages for protocol compliance. */ var CreateDBusError_1 = require("./lib/CreateDBusError"); Object.defineProperty(exports, "CreateDBusError", { enumerable: true, get: function () { return CreateDBusError_1.CreateDBusError; } }); /** * Exports the DBusBufferEncoder class for encoding data into DBus wire format. * Handles the binary encoding of DBus messages and data types according to the specification. */ var DBusBufferEncoder_1 = require("./lib/DBusBufferEncoder"); Object.defineProperty(exports, "DBusBufferEncoder", { enumerable: true, get: function () { return DBusBufferEncoder_1.DBusBufferEncoder; } }); /** * Exports the DBusBufferDecoder class for decoding data from DBus wire format. * Parses binary DBus messages into structured data and objects for further processing. */ var DBusBufferDecoder_1 = require("./lib/DBusBufferDecoder"); Object.defineProperty(exports, "DBusBufferDecoder", { enumerable: true, get: function () { return DBusBufferDecoder_1.DBusBufferDecoder; } }); /** * Exports the DBusConnection class for low-level DBus connection management. * Manages the underlying stream and handshake process for communicating with the DBus daemon. */ var DBusConnection_1 = require("./lib/DBusConnection"); Object.defineProperty(exports, "DBusConnection", { enumerable: true, get: function () { return DBusConnection_1.DBusConnection; } }); /** * Exports the DBusMessage class for representing and encoding/decoding DBus messages. * Provides functionality to create, serialize, and parse DBus messages including headers and bodies. */ var DBusMessage_1 = require("./lib/DBusMessage"); Object.defineProperty(exports, "DBusMessage", { enumerable: true, get: function () { return DBusMessage_1.DBusMessage; } }); /** * Exports the DBusSignalEmitter class for handling DBus signal events. * Enables subscription to and emission of DBus signals for specific services and interfaces. */ var DBusSignalEmitter_1 = require("./lib/DBusSignalEmitter"); Object.defineProperty(exports, "DBusSignalEmitter", { enumerable: true, get: function () { return DBusSignalEmitter_1.DBusSignalEmitter; } }); /** * Exports the DBusSignedValue class for handling typed values in DBus messages. * Represents a value with a specific DBus type signature for accurate encoding and decoding. */ var DBusSignedValue_1 = require("./lib/DBusSignedValue"); Object.defineProperty(exports, "DBusSignedValue", { enumerable: true, get: function () { return DBusSignedValue_1.DBusSignedValue; } }); /** * Exports the Signature class for working with DBus type signatures. * Provides utilities for parsing and validating DBus type signatures used in message data. */ var Signature_1 = require("./lib/Signature"); Object.defineProperty(exports, "Signature", { enumerable: true, get: function () { return Signature_1.Signature; } }); /** * Exports all custom error classes related to DBus operations. * Includes errors for connection issues, authentication failures, and protocol violations. */ __exportStar(require("./lib/Errors"), exports); // Enums for DBus Protocol Constants /** * Exports the DBusMessageEndianness enum for specifying message byte order. * Defines constants for little-endian (LE) and big-endian (BE) formats used in DBus messages. */ var DBusMessageEndianness_1 = require("./lib/enums/DBusMessageEndianness"); Object.defineProperty(exports, "DBusMessageEndianness", { enumerable: true, get: function () { return DBusMessageEndianness_1.DBusMessageEndianness; } }); /** * Exports the DBusMessageFlags enum for message flag constants. * Defines flags used in DBus messages, such as whether a reply is expected or not. */ var DBusMessageFlags_1 = require("./lib/enums/DBusMessageFlags"); Object.defineProperty(exports, "DBusMessageFlags", { enumerable: true, get: function () { return DBusMessageFlags_1.DBusMessageFlags; } }); /** * Exports the DBusMessageType enum for message type constants. * Defines types of DBus messages, such as method call, method return, signal, and error. */ var DBusMessageType_1 = require("./lib/enums/DBusMessageType"); Object.defineProperty(exports, "DBusMessageType", { enumerable: true, get: function () { return DBusMessageType_1.DBusMessageType; } }); /** * Exports the DBusPropertyAccess enum for property access mode constants. * Defines access permissions for DBus properties (e.g., read-only, write-only, read-write). */ var DBusPropertyAccess_1 = require("./lib/enums/DBusPropertyAccess"); Object.defineProperty(exports, "DBusPropertyAccess", { enumerable: true, get: function () { return DBusPropertyAccess_1.DBusPropertyAccess; } }); /** * Exports the RequestNameFlags enum for bus name request behavior constants. * Defines flags for controlling behavior when requesting ownership of a bus name (e.g., replace existing). */ var RequestNameFlags_1 = require("./lib/enums/RequestNameFlags"); Object.defineProperty(exports, "RequestNameFlags", { enumerable: true, get: function () { return RequestNameFlags_1.RequestNameFlags; } }); /** * Exports the RequestNameResultCode enum for bus name request result constants. * Defines result codes indicating the outcome of a bus name ownership request (e.g., success, already owner). */ var RequestNameResultCode_1 = require("./lib/enums/RequestNameResultCode"); Object.defineProperty(exports, "RequestNameResultCode", { enumerable: true, get: function () { return RequestNameResultCode_1.RequestNameResultCode; } }); /** * Exports the DBusArray class for representing a DBus array data type. * Encapsulates an array of values with a specific element type signature for DBus encoding and decoding. */ var DBusArray_1 = require("./lib/datatypes/DBusArray"); Object.defineProperty(exports, "DBusArray", { enumerable: true, get: function () { return DBusArray_1.DBusArray; } }); /** * Exports the DBusBoolean class for representing a DBus boolean data type. * Encapsulates a boolean value (true/false) for DBus encoding and decoding with signature 'b'. */ var DBusBoolean_1 = require("./lib/datatypes/DBusBoolean"); Object.defineProperty(exports, "DBusBoolean", { enumerable: true, get: function () { return DBusBoolean_1.DBusBoolean; } }); /** * Exports the DBusByte class for representing a DBus byte data type. * Encapsulates an 8-bit unsigned integer (0-255) for DBus encoding and decoding with signature 'y'. */ var DBusByte_1 = require("./lib/datatypes/DBusByte"); Object.defineProperty(exports, "DBusByte", { enumerable: true, get: function () { return DBusByte_1.DBusByte; } }); /** * Exports the DBusDictEntry class for representing a DBus dictionary entry data type. * Encapsulates a key-value pair for use in dictionaries with signature '{' for DBus encoding and decoding. */ var DBusDictEntry_1 = require("./lib/datatypes/DBusDictEntry"); Object.defineProperty(exports, "DBusDictEntry", { enumerable: true, get: function () { return DBusDictEntry_1.DBusDictEntry; } }); /** * Exports the DBusDouble class for representing a DBus double data type. * Encapsulates a 64-bit double-precision floating-point number for DBus encoding and decoding with signature 'd'. */ var DBusDouble_1 = require("./lib/datatypes/DBusDouble"); Object.defineProperty(exports, "DBusDouble", { enumerable: true, get: function () { return DBusDouble_1.DBusDouble; } }); /** * Exports the DBusInt16 class for representing a DBus 16-bit signed integer data type. * Encapsulates a 16-bit signed integer for DBus encoding and decoding with signature 'n'. */ var DBusInt16_1 = require("./lib/datatypes/DBusInt16"); Object.defineProperty(exports, "DBusInt16", { enumerable: true, get: function () { return DBusInt16_1.DBusInt16; } }); /** * Exports the DBusInt32 class for representing a DBus 32-bit signed integer data type. * Encapsulates a 32-bit signed integer for DBus encoding and decoding with signature 'i'. */ var DBusInt32_1 = require("./lib/datatypes/DBusInt32"); Object.defineProperty(exports, "DBusInt32", { enumerable: true, get: function () { return DBusInt32_1.DBusInt32; } }); /** * Exports the DBusInt64 class for representing a DBus 64-bit signed integer data type. * Encapsulates a 64-bit signed integer (bigint) for DBus encoding and decoding with signature 'x'. */ var DBusInt64_1 = require("./lib/datatypes/DBusInt64"); Object.defineProperty(exports, "DBusInt64", { enumerable: true, get: function () { return DBusInt64_1.DBusInt64; } }); /** * Exports the DBusObjectPath class for representing a DBus object path data type. * Encapsulates a string representing a DBus object path for encoding and decoding with signature 'o'. */ var DBusObjectPath_1 = require("./lib/datatypes/DBusObjectPath"); Object.defineProperty(exports, "DBusObjectPath", { enumerable: true, get: function () { return DBusObjectPath_1.DBusObjectPath; } }); /** * Exports the DBusSignature class for representing a DBus signature data type. * Encapsulates a string of type codes for DBus encoding and decoding with signature 'g'. */ var DBusSignature_1 = require("./lib/datatypes/DBusSignature"); Object.defineProperty(exports, "DBusSignature", { enumerable: true, get: function () { return DBusSignature_1.DBusSignature; } }); /** * Exports the DBusString class for representing a DBus string data type. * Encapsulates a UTF-8 encoded string for DBus encoding and decoding with signature 's'. */ var DBusString_1 = require("./lib/datatypes/DBusString"); Object.defineProperty(exports, "DBusString", { enumerable: true, get: function () { return DBusString_1.DBusString; } }); /** * Exports the DBusStruct class for representing a DBus struct data type. * Encapsulates a sequence of fields for DBus encoding and decoding with signature '('. */ var DBusStruct_1 = require("./lib/datatypes/DBusStruct"); Object.defineProperty(exports, "DBusStruct", { enumerable: true, get: function () { return DBusStruct_1.DBusStruct; } }); /** * Exports the DBusUint16 class for representing a DBus 16-bit unsigned integer data type. * Encapsulates a 16-bit unsigned integer for DBus encoding and decoding with signature 'q'. */ var DBusUint16_1 = require("./lib/datatypes/DBusUint16"); Object.defineProperty(exports, "DBusUint16", { enumerable: true, get: function () { return DBusUint16_1.DBusUint16; } }); /** * Exports the DBusUint32 class for representing a DBus 32-bit unsigned integer data type. * Encapsulates a 32-bit unsigned integer for DBus encoding and decoding with signature 'u'. */ var DBusUint32_1 = require("./lib/datatypes/DBusUint32"); Object.defineProperty(exports, "DBusUint32", { enumerable: true, get: function () { return DBusUint32_1.DBusUint32; } }); /** * Exports the DBusUint64 class for representing a DBus 64-bit unsigned integer data type. * Encapsulates a 64-bit unsigned integer (bigint) for DBus encoding and decoding with signature 't'. */ var DBusUint64_1 = require("./lib/datatypes/DBusUint64"); Object.defineProperty(exports, "DBusUint64", { enumerable: true, get: function () { return DBusUint64_1.DBusUint64; } }); /** * Exports the DBusUnixFD class for representing a DBus Unix file descriptor data type. * Encapsulates a file descriptor index for DBus encoding and decoding with signature 'h'. */ var DBusUnixFD_1 = require("./lib/datatypes/DBusUnixFD"); Object.defineProperty(exports, "DBusUnixFD", { enumerable: true, get: function () { return DBusUnixFD_1.DBusUnixFD; } }); /** * Exports the DBusVariant class for representing a DBus variant data type. * Encapsulates a dynamic type container with a signature and value for DBus encoding and decoding with signature 'v'. */ var DBusVariant_1 = require("./lib/datatypes/DBusVariant"); Object.defineProperty(exports, "DBusVariant", { enumerable: true, get: function () { return DBusVariant_1.DBusVariant; } }); // Common DBus Interfaces /** * Exports the IntrospectableInterface class for the standard DBus introspection interface. * Implements 'org.freedesktop.DBus.Introspectable' for querying object structure and capabilities as XML data. */ var IntrospectableInterface_1 = require("./lib/common/IntrospectableInterface"); Object.defineProperty(exports, "IntrospectableInterface", { enumerable: true, get: function () { return IntrospectableInterface_1.IntrospectableInterface; } }); /** * Exports the PeerInterface class for the standard DBus peer interface. * Implements 'org.freedesktop.DBus.Peer' for basic peer operations like ping and retrieving machine ID. */ var PeerInterface_1 = require("./lib/common/PeerInterface"); Object.defineProperty(exports, "PeerInterface", { enumerable: true, get: function () { return PeerInterface_1.PeerInterface; } }); /** * Exports the ObjectManagerInterface class for the standard DBus object manager interface. * Implements 'org.freedesktop.DBus.ObjectManager' for managing object hierarchies and notifying * clients of added or removed interfaces and objects. */ var ObjectManagerInterface_1 = require("./lib/common/ObjectManagerInterface"); Object.defineProperty(exports, "ObjectManagerInterface", { enumerable: true, get: function () { return ObjectManagerInterface_1.ObjectManagerInterface; } }); /** * Exports the PropertiesInterface class for the standard DBus properties interface. * Implements 'org.freedesktop.DBus.Properties' for getting, setting, and monitoring property changes. */ var PropertiesInterface_1 = require("./lib/common/PropertiesInterface"); Object.defineProperty(exports, "PropertiesInterface", { enumerable: true, get: function () { return PropertiesInterface_1.PropertiesInterface; } });