| | |
| | | private final String adapterCode; |
| | | private final BtsTransport transport; |
| | | private final BtsXmlCodec codec; |
| | | private final AdapterCapabilities capabilities; |
| | | |
| | | public BtsDeviceAdapter(String adapterCode, BtsTransport transport, BtsXmlCodec codec) |
| | | { |
| | | this(adapterCode, transport, codec, AdapterCapabilities.observeOnly()); |
| | | } |
| | | |
| | | public BtsDeviceAdapter(String adapterCode, BtsTransport transport, BtsXmlCodec codec, |
| | | AdapterCapabilities capabilities) |
| | | { |
| | | this.adapterCode = adapterCode; |
| | | this.transport = transport; |
| | | this.codec = codec; |
| | | this.capabilities = capabilities; |
| | | } |
| | | |
| | | @Override |
| | |
| | | @Override |
| | | public AdapterCapabilities capabilities() |
| | | { |
| | | return AdapterCapabilities.observeOnly(); |
| | | return capabilities; |
| | | } |
| | | |
| | | @Override |
| | |
| | | @Override |
| | | public List<HistoryAvailability> inquireHistory(Set<ChannelIdentity> channels) |
| | | { |
| | | if (!capabilities.historyDownload()) throw new UnsupportedOperationException("History download is not supported"); |
| | | if (channels == null || channels.isEmpty()) return List.of(); |
| | | return codec.parseHistoryAvailability(transport.exchange(codec.inquireHistoryRequest(channels))); |
| | | } |
| | |
| | | @Override |
| | | public HistoryPage downloadHistory(ChannelIdentity channel, String btsTestId, long startPosition, int limit) |
| | | { |
| | | if (!capabilities.historyDownload()) throw new UnsupportedOperationException("History download is not supported"); |
| | | return codec.parseHistory(transport.exchange(codec.downloadRequest(channel, btsTestId, startPosition, limit)), |
| | | channel, btsTestId, startPosition); |
| | | } |