Showing the changes to Source/Libraries/TimeSeriesPlatformLibrary/Samples/AdvancedSubscribe.cpp (1 of 4 files). Show all
Unified · Split
| @@ -40,9 +40,9 @@ SubscriptionInfo CreateSubscriptionInfo(); · 39 unmodified lines | |||
| 40 | 40 | ||
| 41 | // Handlers for subscriber callbacks. | 41 | // Handlers for subscriber callbacks. |
| 42 | void Resubscribe(DataSubscriber* source); | 42 | void Resubscribe(DataSubscriber* source); |
| 43 | void ProcessMeasurements(DataSubscriber* source, vector<Measurement> newMeasurements); | 43 | void ProcessMeasurements(DataSubscriber* source, const vector<MeasurementPtr>& newMeasurements); |
| 44 | void DisplayStatusMessage(DataSubscriber* source, string message); | 44 | void DisplayStatusMessage(DataSubscriber* source, const string& message); |
| 45 | void DisplayErrorMessage(DataSubscriber* source, string message); | 45 | void DisplayErrorMessage(DataSubscriber* source, const string& message); |
| 46 | 46 | ||
| 47 | // Runs the subscriber. | 47 | // Runs the subscriber. |
| 48 | void RunSubscriber(string hostname, uint16_t port); | 48 | void RunSubscriber(string hostname, uint16_t port); |
| @@ -189,7 +189,7 @@ SubscriberConnector CreateSubscriberConnector(string hostname, uint16_t port) · 140 unmodified lines | |||
| 189 | 189 | ||
| 190 | // Callback which is called when the subscriber has | 190 | // Callback which is called when the subscriber has |
| 191 | // received a new packet of measurements from the publisher. | 191 | // received a new packet of measurements from the publisher. |
| 192 | void ProcessMeasurements(DataSubscriber* source, vector<Measurement> newMeasurements) | 192 | void ProcessMeasurements(DataSubscriber* source, const vector<MeasurementPtr>& newMeasurements) |
| 193 | { | 193 | { |
| 194 | const string TimestampFormat = "%Y-%m-%d %H:%M:%S.%f"; | 194 | const string TimestampFormat = "%Y-%m-%d %H:%M:%S.%f"; |
| 195 | const size_t MaxTimestampSize = 80; | 195 | const size_t MaxTimestampSize = 80; |
| @@ -203,17 +203,17 @@ void ProcessMeasurements(DataSubscriber* source, vector<Measurement> newMeasurem · 7 unmodified lines | |||
| 203 | // seconds (assuming 30 calls per second). | 203 | // seconds (assuming 30 calls per second). |
| 204 | if (processCount % 150 == 0) | 204 | if (processCount % 150 == 0) |
| 205 | { | 205 | { |
| 206 | cout << Subscriber.GetTotalMeasurementsReceived() << " measurements received so far..." << endl; | 206 | cout << source->GetTotalMeasurementsReceived() << " measurements received so far..." << endl; |
| 207 | 207 | ||
| 208 | if (!newMeasurements.empty()) | 208 | if (!newMeasurements.empty()) |
| 209 | { | 209 | { |
| 210 | if (TicksToString(timestamp, MaxTimestampSize, TimestampFormat, newMeasurements[0].Timestamp)) | 210 | if (TicksToString(timestamp, MaxTimestampSize, TimestampFormat, newMeasurements[0]->Timestamp)) |
| 211 | cout << "Timestamp: " << string(timestamp) << endl; | 211 | cout << "Timestamp: " << string(timestamp) << endl; |
| 212 | 212 | ||
| 213 | cout << "Point\tValue" << endl; | 213 | cout << "Point\tValue" << endl; |
| 214 | 214 | ||
| 215 | for (i = 0; i < newMeasurements.size(); ++i) | 215 | for (i = 0; i < newMeasurements.size(); ++i) |
| 216 | cout << newMeasurements[i].ID << '\t' << newMeasurements[i].Value << endl; | 216 | cout << newMeasurements[i]->ID << '\t' << newMeasurements[i]->Value << endl; |
| 217 | 217 | ||
| 218 | cout << endl; | 218 | cout << endl; |
| 219 | } | 219 | } |