-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding singleton pattern to notification manager (ROSI-AP/rosi-ap_com…
…mercial/cag/rmf_scheduler!28) * Fix inaccurate connection status Signed-off-by: Chen Bainian <[email protected]> * Add factory pattern to notification manager Signed-off-by: Chen Bainian <[email protected]> Co-authored-by: Chen Bainian <[email protected]> * Adding singleton pattern to notification manager Co-authored-by: Chen Bainian <[email protected]>
- Loading branch information
Showing
10 changed files
with
667 additions
and
346 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// Copyright 2023 ROS Industrial Consortium Asia Pacific | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#ifndef RMF_NOTIFICATION__HTTP_CLIENT_HPP_ | ||
#define RMF_NOTIFICATION__HTTP_CLIENT_HPP_ | ||
|
||
#include <memory> | ||
#include <string> | ||
|
||
#include "rmf_notification/notification_client_base.hpp" | ||
|
||
namespace rmf_notification | ||
{ | ||
|
||
class HTTPClient : public NotificationClientBase | ||
{ | ||
public: | ||
HTTPClient(); | ||
virtual ~HTTPClient(); | ||
void init(const std::string & endpoint_uri) override; | ||
|
||
bool is_connected() const override; | ||
|
||
void publish( | ||
const Message & message) override; | ||
|
||
void shutdown() override; | ||
|
||
class Impl; | ||
|
||
private: | ||
std::unique_ptr<Impl> impl_ptr_; | ||
}; | ||
|
||
} // namespace rmf_notification | ||
|
||
#endif // RMF_NOTIFICATION__HTTP_CLIENT_HPP_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
rmf_notification/include/rmf_notification/notification_client_base.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Copyright 2023 ROS Industrial Consortium Asia Pacific | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#ifndef RMF_NOTIFICATION__NOTIFICATION_CLIENT_BASE_HPP_ | ||
#define RMF_NOTIFICATION__NOTIFICATION_CLIENT_BASE_HPP_ | ||
|
||
#include <string> | ||
#include "rmf_notification/message.hpp" | ||
|
||
namespace rmf_notification | ||
{ | ||
|
||
class NotificationClientBase | ||
{ | ||
public: | ||
virtual ~NotificationClientBase() {} | ||
virtual void init( | ||
const std::string & endpoint_uri) = 0; | ||
|
||
virtual bool is_connected() const = 0; | ||
|
||
virtual void publish( | ||
const Message & message) = 0; | ||
|
||
virtual void shutdown() = 0; | ||
}; | ||
} // namespace rmf_notification | ||
|
||
#endif // RMF_NOTIFICATION__NOTIFICATION_CLIENT_BASE_HPP_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
rmf_notification/include/rmf_notification/websocket_client.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// Copyright 2023 ROS Industrial Consortium Asia Pacific | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#ifndef RMF_NOTIFICATION__WEBSOCKET_CLIENT_HPP_ | ||
#define RMF_NOTIFICATION__WEBSOCKET_CLIENT_HPP_ | ||
|
||
#include <memory> | ||
#include <string> | ||
|
||
#include "rmf_notification/notification_client_base.hpp" | ||
|
||
namespace rmf_notification | ||
{ | ||
|
||
class WebsocketClient : public NotificationClientBase | ||
{ | ||
public: | ||
WebsocketClient(); | ||
virtual ~WebsocketClient(); | ||
void init(const std::string & endpoint_uri) override; | ||
|
||
bool is_connected() const override; | ||
|
||
void publish( | ||
const Message & message) override; | ||
|
||
void shutdown() override; | ||
|
||
class Impl; | ||
|
||
private: | ||
std::unique_ptr<Impl> impl_ptr_; | ||
}; | ||
|
||
} // namespace rmf_notification | ||
|
||
#endif // RMF_NOTIFICATION__WEBSOCKET_CLIENT_HPP_ |
Oops, something went wrong.