Skip to content

Commit

Permalink
https://telecominfraproject.atlassian.net/browse/WIFI-13110
Browse files Browse the repository at this point in the history
Signed-off-by: stephb9959 <[email protected]>
  • Loading branch information
stephb9959 committed Nov 13, 2023
1 parent 227ec2d commit 531c51d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion build
Original file line number Diff line number Diff line change
@@ -1 +1 @@
52
53
6 changes: 3 additions & 3 deletions src/GWKafkaEvents.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,17 @@ namespace OpenWifi {
class DeviceConfigurationChangeKafkaEvent : public GWKafkaEvents {
public:
DeviceConfigurationChangeKafkaEvent(std::uint64_t serialNumber,
std::uint64_t timestamp, const std::string config)
std::uint64_t timestamp, const Poco::JSON::Object::Ptr config)
: GWKafkaEvents(serialNumber, "unit.configuration_change", timestamp), config_(config) {
}

~DeviceConfigurationChangeKafkaEvent() {
payload_->set("configuration", config_);
payload_->set("configuration", *config_);
Send();
}

private:
std::string config_;
Poco::JSON::Object::Ptr config_;
};

class DeviceBlacklistedKafkaEvent : public GWKafkaEvents {
Expand Down
6 changes: 4 additions & 2 deletions src/RESTAPI/RESTAPI_RPC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,12 @@ namespace OpenWifi::RESTAPI_RPC {

if (Cmd.ErrorCode == 0 && Cmd.Command == uCentralProtocol::CONFIGURE) {
// we need to post a kafka event for this.
if (Params.has(uCentralProtocol::CONFIG)) {
if (Params.has(uCentralProtocol::CONFIG) && Params.isObject(uCentralProtocol::CONFIG)) {
auto Config = Params.get(uCentralProtocol::CONFIG)
.extract<Poco::JSON::Object::Ptr>();
DeviceConfigurationChangeKafkaEvent KEvent(
Utils::SerialNumberToInt(Cmd.SerialNumber), Utils::Now(),
Params.get(uCentralProtocol::CONFIG).toString());
Config);
}
}

Expand Down

0 comments on commit 531c51d

Please sign in to comment.