Back to index

unity  6.0.0
Classes | Public Types | Public Member Functions | Static Private Member Functions | Private Attributes
unity::UBusManager Class Reference

#include <UBusWrapper.h>

Collaboration diagram for unity::UBusManager:
Collaboration graph
[legend]

List of all members.

Classes

struct  UBusConnection

Public Types

typedef sigc::slot< void,
GVariant * > 
UBusManagerCallback
typedef std::vector
< UBusConnection::Ptr
Connections

Public Member Functions

 UBusManager ()
 ~UBusManager ()
void RegisterInterest (std::string const &interest_name, UBusManagerCallback slot)
void UnregisterInterest (std::string const &interest_name)
void SendMessage (std::string const &message_name, GVariant *args=NULL)

Static Private Member Functions

static void OnCallback (GVariant *args, gpointer user_data)

Private Attributes

UBusServerserver_
Connections connections_

Detailed Description

Definition at line 33 of file UBusWrapper.h.


Member Typedef Documentation

Definition at line 48 of file UBusWrapper.h.

typedef sigc::slot<void, GVariant*> unity::UBusManager::UBusManagerCallback

Definition at line 36 of file UBusWrapper.h.


Constructor & Destructor Documentation

Definition at line 24 of file UBusWrapper.cpp.

Definition at line 28 of file UBusWrapper.cpp.

{
  for (auto connection: connections_)
  {
    ubus_server_unregister_interest(server_, connection->id);
  }
}

Here is the call graph for this function:


Member Function Documentation

void unity::UBusManager::OnCallback ( GVariant *  args,
gpointer  user_data 
) [static, private]

Definition at line 63 of file UBusWrapper.cpp.

{
  UBusConnection* connection = static_cast<UBusConnection*>(user_data);

  connection->slot(args);
}

Here is the caller graph for this function:

void unity::UBusManager::RegisterInterest ( std::string const &  interest_name,
UBusManagerCallback  slot 
)

Definition at line 36 of file UBusWrapper.cpp.

{
  UBusConnection::Ptr connection (new UBusConnection());
  connection->manager = this;
  connection->name = interest_name;
  connection->slot = slot;
  connection->id = ubus_server_register_interest(server_,
                                                 interest_name.c_str(),
                                                 UBusManager::OnCallback,
                                                 connection.get());
  connections_.push_back(connection);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::UBusManager::SendMessage ( std::string const &  message_name,
GVariant *  args = NULL 
)

Definition at line 70 of file UBusWrapper.cpp.

{
  ubus_server_send_message(server_, message_name.c_str(), args);
}

Here is the call graph for this function:

void unity::UBusManager::UnregisterInterest ( std::string const &  interest_name)

Definition at line 50 of file UBusWrapper.cpp.

{
  for (auto it = connections_.begin(); it != connections_.end(); ++it)
  {
    if ((*it)->name == interest_name)
    {
      ubus_server_unregister_interest(server_, (*it)->id);
      connections_.erase(it);
      break;
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 63 of file UBusWrapper.h.

Definition at line 62 of file UBusWrapper.h.


The documentation for this class was generated from the following files: