@bbc/sofie-server-core-integration
Version:
Library for connecting to Core
77 lines • 3.71 kB
TypeScript
import { EventEmitter } from 'events';
import { PeripheralDeviceStatusObject, PeripheralDeviceSubType } from '@bbc/sofie-shared-lib/dist/peripheralDevice/peripheralDeviceAPI';
import { PeripheralDeviceAPIMethods } from '@bbc/sofie-shared-lib/dist/peripheralDevice/methodsAPI';
import { DDPConnector } from './ddpConnector.js';
import { Observer } from './ddpClient.js';
import { PeripheralDeviceId } from '@bbc/sofie-shared-lib/dist/core/model/Ids';
import { ExternalPeripheralDeviceAPI } from './methods.js';
import { PeripheralDeviceForDevice } from '@bbc/sofie-shared-lib/dist/core/model/peripheralDevice';
import { CoreConnection, Collection, CoreOptions, CollectionDocCheck } from './coreConnection.js';
import { ParametersOfFunctionOrNever, SubscriptionId } from './subscriptions.js';
import { PeripheralDevicePubSubCollections, PeripheralDevicePubSubTypes } from '@bbc/sofie-shared-lib/dist/pubsub/peripheralDevice';
export interface ChildCoreOptions {
deviceId: PeripheralDeviceId;
/**
* SubType of the connection
*/
deviceSubType: PeripheralDeviceSubType;
/**
* Name of the device
* eg 'MOS Gateway'
*/
deviceName: string;
}
export type ChildCoreConnectionEvents = {
error: [err: Error | string];
};
export declare class CoreConnectionChild<PubSubTypes = PeripheralDevicePubSubTypes, PubSubCollections = PeripheralDevicePubSubCollections> extends EventEmitter<ChildCoreConnectionEvents> {
private _parent;
private _parentOptions;
private _coreOptions;
private _methodQueue;
private _subscriptions;
private _pinger;
private _destroyed;
private _peripheralDeviceApi;
private _peripheralDeviceApiLowPriority;
constructor(coreOptions: ChildCoreOptions);
private doTriggerPing;
init(parent: CoreConnection<PubSubTypes, PubSubCollections>, parentOptions: CoreOptions): Promise<PeripheralDeviceId>;
destroy(): Promise<void>;
get parent(): CoreConnection<PubSubTypes, PubSubCollections>;
get ddp(): DDPConnector;
get connected(): boolean;
get deviceId(): PeripheralDeviceId;
get coreMethods(): ExternalPeripheralDeviceAPI;
get coreMethodsLowPriority(): ExternalPeripheralDeviceAPI;
setStatus(status: PeripheralDeviceStatusObject): Promise<PeripheralDeviceStatusObject>;
/**
* This should not be used directly, use the `coreMethods` wrapper instead.
* Call a meteor method
* @param methodName The name of the method to call
* @param attrs Parameters to the method
* @returns Resopnse, if any
*/
callMethodRaw(methodName: string, attrs: Array<any>): Promise<any>;
callMethodLowPrioRaw(methodName: PeripheralDeviceAPIMethods | string, attrs: Array<any>): Promise<any>;
unInitialize(): Promise<PeripheralDeviceId>;
getPeripheralDevice(): Promise<PeripheralDeviceForDevice>;
getCollection<K extends keyof PubSubCollections>(collectionName: K): Collection<CollectionDocCheck<PubSubCollections[K]>>;
/**
* Subscribe to a DDP publication
* Upon reconnecting to Sofie, this publication will be restarted
*/
autoSubscribe<Key extends keyof PubSubTypes>(publicationName: Key, ...params: ParametersOfFunctionOrNever<PubSubTypes[Key]>): Promise<SubscriptionId>;
/**
* Unsubscribe from subscription to a DDP publication
*/
unsubscribe(subscriptionId: SubscriptionId): void;
/**
* Unsubscribe from all subscriptions to DDP publications
*/
unsubscribeAll(): void;
observe<K extends keyof PubSubCollections>(collectionName: K): Observer<CollectionDocCheck<PubSubCollections[K]>>;
private _emitError;
private _sendInit;
}
//# sourceMappingURL=CoreConnectionChild.d.ts.map