UNPKG

rxpoweredup

Version:

A Typescript RxJS-based library for controlling LEGO Powered UP hubs & peripherals.

74 lines (73 loc) 5.82 kB
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var __param = (this && this.__param) || function (paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); } }; import { inject, injectable } from 'tsyringe'; import { PortsFeature } from './ports-feature'; import { INBOUND_MESSAGE_LISTENER_FACTORY } from '../../hub'; import { PORT_INFORMATION_REPLY_PARSER } from './port-information-reply-parser'; import { ATTACHED_IO_REPLIES_PARSER } from './attached-io-replies-parser'; import { PORT_MODE_INFORMATION_REPLY_PARSER } from './port-mode-information-reply-parser'; import { PORT_INFORMATION_REQUEST_MESSAGE_FACTORY } from './i-port-information-request-message-factory'; import { PORT_MODE_INFORMATION_REQUEST_MESSAGE_FACTORY } from './i-port-mode-information-request-message-factory'; import { PORT_INPUT_FORMAT_SETUP_MESSAGE_FACTORY } from '../i-port-input-format-setup-message-factory'; import { AttachedIoRepliesCache } from './attached-io-replies-cache'; import { PORT_INPUT_FORMAT_SETUP_SINGLE_HANDSHAKE_REPLY_PARSER } from './port-input-format-setup-single-handshake-reply-parser'; import { PORT_RAW_VALUE_REPLY_PARSER } from './port-value-raw-reply-parser'; import { VIRTUAL_PORT_SETUP_MESSAGE_FACTORY } from './i-virtual-port-setup-message-factory'; let PortsFeatureFactory = class PortsFeatureFactory { portInformationRequestMessageFactory; messageListenerFactory; portInformationRequestReplyParser; attachedIoReplyParser; portInputFormatSetupSingleHandshakeReplyParser; portModeInformationMessageFactory; portInputFormatSetupSingleMessageFactory; portModeInformationReplyParserService; portRawValueReplyParser; virtualPortSetupMessageFactory; constructor(portInformationRequestMessageFactory, messageListenerFactory, portInformationRequestReplyParser, attachedIoReplyParser, portInputFormatSetupSingleHandshakeReplyParser, portModeInformationMessageFactory, portInputFormatSetupSingleMessageFactory, portModeInformationReplyParserService, portRawValueReplyParser, virtualPortSetupMessageFactory) { this.portInformationRequestMessageFactory = portInformationRequestMessageFactory; this.messageListenerFactory = messageListenerFactory; this.portInformationRequestReplyParser = portInformationRequestReplyParser; this.attachedIoReplyParser = attachedIoReplyParser; this.portInputFormatSetupSingleHandshakeReplyParser = portInputFormatSetupSingleHandshakeReplyParser; this.portModeInformationMessageFactory = portModeInformationMessageFactory; this.portInputFormatSetupSingleMessageFactory = portInputFormatSetupSingleMessageFactory; this.portModeInformationReplyParserService = portModeInformationReplyParserService; this.portRawValueReplyParser = portRawValueReplyParser; this.virtualPortSetupMessageFactory = virtualPortSetupMessageFactory; } create(characteristicDataStream, onHubDisconnected, messenger) { const portInformationReplies$ = this.messageListenerFactory.create(characteristicDataStream, this.portInformationRequestReplyParser, onHubDisconnected); const portRawValueReplies = this.messageListenerFactory.create(characteristicDataStream, this.portRawValueReplyParser, onHubDisconnected); const attachedIOReplies$ = this.messageListenerFactory.create(characteristicDataStream, this.attachedIoReplyParser, onHubDisconnected); const portModeInformationReplies$ = this.messageListenerFactory.create(characteristicDataStream, this.portModeInformationReplyParserService, onHubDisconnected); const portInputFormatSetupSingleReplies$ = this.messageListenerFactory.create(characteristicDataStream, this.portInputFormatSetupSingleHandshakeReplyParser, onHubDisconnected); const attachedIOCache = new AttachedIoRepliesCache(attachedIOReplies$, onHubDisconnected); return new PortsFeature(portInformationReplies$, attachedIOReplies$, attachedIOCache.replies$, portModeInformationReplies$, portInputFormatSetupSingleReplies$, this.portInformationRequestMessageFactory, portRawValueReplies, this.portModeInformationMessageFactory, this.portInputFormatSetupSingleMessageFactory, this.virtualPortSetupMessageFactory, messenger); } }; PortsFeatureFactory = __decorate([ injectable(), __param(0, inject(PORT_INFORMATION_REQUEST_MESSAGE_FACTORY)), __param(1, inject(INBOUND_MESSAGE_LISTENER_FACTORY)), __param(2, inject(PORT_INFORMATION_REPLY_PARSER)), __param(3, inject(ATTACHED_IO_REPLIES_PARSER)), __param(4, inject(PORT_INPUT_FORMAT_SETUP_SINGLE_HANDSHAKE_REPLY_PARSER)), __param(5, inject(PORT_MODE_INFORMATION_REQUEST_MESSAGE_FACTORY)), __param(6, inject(PORT_INPUT_FORMAT_SETUP_MESSAGE_FACTORY)), __param(7, inject(PORT_MODE_INFORMATION_REPLY_PARSER)), __param(8, inject(PORT_RAW_VALUE_REPLY_PARSER)), __param(9, inject(VIRTUAL_PORT_SETUP_MESSAGE_FACTORY)), __metadata("design:paramtypes", [Object, Object, Object, Object, Object, Object, Object, Object, Object, Object]) ], PortsFeatureFactory); export { PortsFeatureFactory };