Files
MuditaOS/module-sys/Service/Bus.hpp
Alek Rudnik 09cf520c12 Egd 558 adjust volume during a call (#283)
* [EGD-558][fix] change error to info

* [EGD-558] added volume control of currently active audio operation

* [EGD-558] added ringing on incoming call

* [EGD-558] mini clean up in callwindow

* [EGD-558] removed reinterpret_casts and added some logging

* [EGD-558] rewritten methods to increment/decrement volume

* [EGD-558] clean up

* [EGD-558] moved volume control to application class
added nullptr checks

* [EGD-558] fixed types

* [EGD-558] added some audio debug logs

* [EGD-558] left a comment why ringing sound is currently disabled

* [EGD-558] PR fixes

* [EGD-558] PR fix

* [EGD-558] added propper error codes on pointer checking in Audio.cpp
2020-04-10 11:00:17 +02:00

55 lines
1.6 KiB
C++

#pragma once
#include <memory>
#include <map>
#include <queue>
#include "Channel.hpp"
#include "Common.hpp"
#include "Message.hpp"
namespace sys
{
class Service;
class Message;
constexpr uint32_t defaultCmdTimeout = 5000;
class Bus
{
public:
// Send message directly to specified service (unicast type)
static bool SendUnicast(std::shared_ptr<Message> msg, const std::string &service, Service *s);
// Send message directly to specified service with timeout
static MessageRet_t SendUnicast(std::shared_ptr<Message> msg,
const std::string &service,
Service *s,
uint32_t timeout);
// Send message to specific channel
static void SendMulticast(std::shared_ptr<Message> msg, BusChannels channel, Service *s);
// Send message to all registered services ()
static void SendBroadcast(std::shared_ptr<Message> msg, Service *s);
// Register new service
static void Add(std::shared_ptr<Service> service);
// Unregister specified service
static void Remove(std::shared_ptr<Service> service);
static void SendResponse(std::shared_ptr<Message> msg, std::shared_ptr<Message> receivedMsg, Service *s);
private:
Bus();
~Bus();
static std::map<BusChannels, Channel> channels;
static std::map<std::string, std::shared_ptr<Service>> servicesRegistered;
static uint64_t uniqueMsgId;
static uint64_t unicastMsgId;
};
} // namespace sys