Showing the changes to Source/Libraries/TimeSeriesPlatformLibrary/Transport/SubscriberConnection.h (1 of 28 files). Show all
Unified · Split
| @@ -37,6 +37,9 @@ namespace Transport · 36 unmodified lines | |||
| 37 | class DataPublisher; | 37 | class DataPublisher; |
| 38 | typedef GSF::SharedPtr<DataPublisher> DataPublisherPtr; | 38 | typedef GSF::SharedPtr<DataPublisher> DataPublisherPtr; |
| 39 | 39 | ||
| 40 | class SubscriberConnection; | ||
| 41 | typedef GSF::SharedPtr<SubscriberConnection> SubscriberConnectionPtr; | ||
| 42 | |||
| 40 | // Represents a subscriber connection to a data publisher | 43 | // Represents a subscriber connection to a data publisher |
| 41 | class SubscriberConnection : public GSF::EnableSharedThisPtr<SubscriberConnection> // NOLINT | 44 | class SubscriberConnection : public GSF::EnableSharedThisPtr<SubscriberConnection> // NOLINT |
| 42 | { | 45 | { |
| @@ -49,6 +52,9 @@ namespace Transport · 6 unmodified lines | |||
| 49 | std::string m_subscriptionInfo; | 52 | std::string m_subscriptionInfo; |
| 50 | uint32_t m_operationalModes; | 53 | uint32_t m_operationalModes; |
| 51 | uint32_t m_encoding; | 54 | uint32_t m_encoding; |
| 55 | GSF::datetime_t m_startTimeConstraint; | ||
| 56 | GSF::datetime_t m_stopTimeConstraint; | ||
| 57 | int32_t m_processingInterval; | ||
| 52 | bool m_usePayloadCompression; | 58 | bool m_usePayloadCompression; |
| 53 | bool m_useCompactMeasurementFormat; | 59 | bool m_useCompactMeasurementFormat; |
| 54 | bool m_includeTime; | 60 | bool m_includeTime; |
| @@ -79,17 +85,18 @@ namespace Transport · 24 unmodified lines | |||
| 79 | SignalIndexCachePtr m_signalIndexCache; | 85 | SignalIndexCachePtr m_signalIndexCache; |
| 80 | int32_t m_timeIndex; | 86 | int32_t m_timeIndex; |
| 81 | int64_t m_baseTimeOffsets[2]; | 87 | int64_t m_baseTimeOffsets[2]; |
| 82 | DateTime m_lastPublishTime; | 88 | datetime_t m_lastPublishTime; |
| 83 | //TSSCMeasurementParser m_tsscMeasurementParser; | 89 | //TSSCMeasurementParser m_tsscMeasurementParser; |
| 84 | //bool m_tsscResetRequested; | 90 | //bool m_tsscResetRequested; |
| 85 | //uint16_t m_tsscSequenceNumber; | 91 | //uint16_t m_tsscSequenceNumber; |
| 86 | 92 | ||
| 87 | // Server request handlers | 93 | // Server request handlers |
| 88 | void HandleSubscribe(uint8_t* data, uint32_t length); | 94 | void HandleSubscribe(uint8_t* data, uint32_t length); |
| 95 | void HandleSubscribeFailure(const std::string& message); | ||
| 89 | void HandleUnsubscribe(); | 96 | void HandleUnsubscribe(); |
| 90 | void HandleMetadataRefresh(uint8_t* data, uint32_t length); | 97 | void HandleMetadataRefresh(uint8_t* data, uint32_t length); |
| 91 | void HandleRotateCipherKeys(); | 98 | void HandleRotateCipherKeys(); |
| 92 | void HandleUpdateProcessingInterval(uint8_t* data, uint32_t length); | 99 | void HandleUpdateProcessingInterval(const uint8_t* data, uint32_t length); |
| 93 | void HandleDefineOperationalModes(uint8_t* data, uint32_t length); | 100 | void HandleDefineOperationalModes(uint8_t* data, uint32_t length); |
| 94 | void HandleConfirmNotification(uint8_t* data, uint32_t length); | 101 | void HandleConfirmNotification(uint8_t* data, uint32_t length); |
| 95 | void HandleConfirmBufferBlock(uint8_t* data, uint32_t length); | 102 | void HandleConfirmBufferBlock(uint8_t* data, uint32_t length); |
| @@ -112,43 +119,78 @@ namespace Transport · 16 unmodified lines | |||
| 112 | ~SubscriberConnection(); | 119 | ~SubscriberConnection(); |
| 113 | 120 | ||
| 114 | const DataPublisherPtr& GetParent() const; | 121 | const DataPublisherPtr& GetParent() const; |
| 122 | SubscriberConnectionPtr GetReference(); | ||
| 115 | 123 | ||
| 116 | GSF::TcpSocket& CommandChannelSocket(); | 124 | GSF::TcpSocket& CommandChannelSocket(); |
| 117 | 125 | ||
| 118 | // Gets or sets subscriber identification used when subscriber is known and pre-established | 126 | // Gets or sets subscriber UUID used when subscriber is known and pre-established |
| 119 | const GSF::Guid& GetSubscriberID() const; | 127 | const GSF::Guid& GetSubscriberID() const; |
| 120 | void SetSubscriberID(const GSF::Guid& id); | 128 | void SetSubscriberID(const GSF::Guid& id); |
| 121 | 129 | ||
| 130 | // Gets subscriber connection identification, e.g., remote IP/port, for display and logging references | ||
| 122 | const std::string& GetConnectionID() const; | 131 | const std::string& GetConnectionID() const; |
| 132 | |||
| 133 | // Gets subscriber remote IP address | ||
| 123 | const GSF::IPAddress& GetIPAddress() const; | 134 | const GSF::IPAddress& GetIPAddress() const; |
| 135 | |||
| 136 | // Gets subscriber communications port | ||
| 124 | const std::string& GetHostName() const; | 137 | const std::string& GetHostName() const; |
| 125 | 138 | ||
| 139 | // Gets or sets established subscriber operational modes | ||
| 126 | uint32_t GetOperationalModes() const; | 140 | uint32_t GetOperationalModes() const; |
| 127 | void SetOperationalModes(uint32_t value); | 141 | void SetOperationalModes(uint32_t value); |
| 128 | 142 | ||
| 143 | // Gets established subscriber string encoding | ||
| 129 | uint32_t GetEncoding() const; | 144 | uint32_t GetEncoding() const; |
| 130 | 145 | ||
| 146 | // Gets flags that determines if this subscription is temporal based | ||
| 147 | bool GetIsTemporalSubscription() const; | ||
| 148 | |||
| 149 | // Gets or sets the start time temporal processing constraint | ||
| 150 | const GSF::datetime_t& GetStartTimeConstraint() const; | ||
| 151 | void SetStartTimeConstraint(const GSF::datetime_t& value); | ||
| 152 | |||
| 153 | // Gets or sets the stop time temporal processing constraint | ||
| 154 | const GSF::datetime_t& GetStopTimeConstraint() const; | ||
| 155 | void SetStopTimeConstraint(const GSF::datetime_t& value); | ||
| 156 | |||
| 157 | // Gets or sets the desired temporal processing interval, in milliseconds | ||
| 158 | // With the exception of the values of -1 and 0, this value specifies the desired processing interval for data, i.e., | ||
| 159 | // basically a delay, or timer interval, over which to process data. A value of -1 means to use the default processing | ||
| 160 | // interval while a value of 0 means to process data as fast as possible. | ||
| 161 | int32_t GetProcessingInterval() const; | ||
| 162 | void SetProcessingInterval(int32_t value); | ||
| 163 | |||
| 164 | // Gets or sets flag that determines if payload compression should be enabled in data packets | ||
| 131 | bool GetUsePayloadCompression() const; | 165 | bool GetUsePayloadCompression() const; |
| 132 | void SetUsePayloadCompression(bool value); | 166 | void SetUsePayloadCompression(bool value); |
| 133 | 167 | ||
| 168 | // Gets or sets flag that determines if the compact measurement format should be used in data packets | ||
| 134 | bool GetUseCompactMeasurementFormat() const; | 169 | bool GetUseCompactMeasurementFormat() const; |
| 135 | void SetUseCompactMeasurementFormat(bool value); | 170 | void SetUseCompactMeasurementFormat(bool value); |
| 136 | 171 | ||
| 172 | // Gets or sets flag that determines if time should be included in data packets when the compact measurement format used | ||
| 137 | bool GetIncludeTime() const; | 173 | bool GetIncludeTime() const; |
| 138 | void SetIncludeTime(bool value); | 174 | void SetIncludeTime(bool value); |
| 139 | 175 | ||
| 176 | // Gets or sets flag that determines if time should be restricted to millisecond resolution in data packets when the | ||
| 177 | // compact measurement format used; otherwise, full resolution time will be used | ||
| 140 | bool GetUseMillisecondResolution() const; | 178 | bool GetUseMillisecondResolution() const; |
| 141 | void SetUseMillisecondResolution(bool value); | 179 | void SetUseMillisecondResolution(bool value); |
| 142 | 180 | ||
| 181 | // Gets or sets flag that determines if NaN values should be excluded from data packets | ||
| 143 | bool GetIsNaNFiltered() const; | 182 | bool GetIsNaNFiltered() const; |
| 144 | void SetIsNaNFiltered(bool value); | 183 | void SetIsNaNFiltered(bool value); |
| 145 | 184 | ||
| 185 | // Gets or sets flag that determines if subscriber connection is currently subscribed | ||
| 146 | bool GetIsSubscribed() const; | 186 | bool GetIsSubscribed() const; |
| 147 | void SetIsSubscribed(bool value); | 187 | void SetIsSubscribed(bool value); |
| 148 | 188 | ||
| 189 | // Gets or sets subscription details about subscriber | ||
| 149 | const std::string& GetSubscriptionInfo() const; | 190 | const std::string& GetSubscriptionInfo() const; |
| 150 | void SetSubscriptionInfo(const std::string& value); | 191 | void SetSubscriptionInfo(const std::string& value); |
| 151 | 192 | ||
| 193 | // Gets or sets signal index cache for subscriber representing run-time mappings for subscribed points | ||
| 152 | const SignalIndexCachePtr& GetSignalIndexCache() const; | 194 | const SignalIndexCachePtr& GetSignalIndexCache() const; |
| 153 | void SetSignalIndexCache(SignalIndexCachePtr signalIndexCache); | 195 | void SetSignalIndexCache(SignalIndexCachePtr signalIndexCache); |
| 154 | 196 | ||
| @@ -164,15 +206,16 @@ namespace Transport · 9 unmodified lines | |||
| 164 | void Start(); | 206 | void Start(); |
| 165 | void Stop(); | 207 | void Stop(); |
| 166 | 208 | ||
| 167 | void PublishMeasurements(const std::vector<Measurement>& measurements); | ||
| 168 | void PublishMeasurements(const std::vector<MeasurementPtr>& measurements); | 209 | void PublishMeasurements(const std::vector<MeasurementPtr>& measurements); |
| 210 | void CompleteTemporalSubscription(); | ||
| 169 | 211 | ||
| 170 | void CommandChannelSendAsync(uint8_t* data, uint32_t offset, uint32_t length); | 212 | void CommandChannelSendAsync(uint8_t* data, uint32_t offset, uint32_t length); |
| 171 | void DataChannelSendAsync(uint8_t* data, uint32_t offset, uint32_t length); | 213 | void DataChannelSendAsync(uint8_t* data, uint32_t offset, uint32_t length); |
| 172 | void WriteHandler(const ErrorCode& error, uint32_t bytesTransferred); | 214 | void WriteHandler(const ErrorCode& error, uint32_t bytesTransferred); |
| 173 | 215 | ||
| 216 | bool SendResponse(uint8_t responseCode, uint8_t commandCode); | ||
| 174 | bool SendResponse(uint8_t responseCode, uint8_t commandCode, const std::string& message); | 217 | bool SendResponse(uint8_t responseCode, uint8_t commandCode, const std::string& message); |
| 175 | bool SendResponse(uint8_t responseCode, uint8_t commandCode, const std::vector<uint8_t>& data = {}); | 218 | bool SendResponse(uint8_t responseCode, uint8_t commandCode, const std::vector<uint8_t>& data); |
| 176 | 219 | ||
| 177 | std::string DecodeString(const uint8_t* data, uint32_t offset, uint32_t length) const; | 220 | std::string DecodeString(const uint8_t* data, uint32_t offset, uint32_t length) const; |
| 178 | std::vector<uint8_t> EncodeString(const std::string& value) const; | 221 | std::vector<uint8_t> EncodeString(const std::string& value) const; |