#include </opt/build/repo/nap/system_modules/napportal/src/portalevent.h>
Public Types | |
using | APIEventList = std::vector< APIEventPtr > |
using | APIEventConstIterator = utility::UniquePtrConstVectorWrapper< APIEventList, APIEvent * > |
Public Member Functions | |
PortalEvent (const PortalEventHeader &header) | |
PortalEvent (const PortalEventHeader &header, const WebSocketConnection &connection) | |
const std::string & | getID () const |
const std::string & | getPortalID () const |
const EPortalEventType & | getType () const |
bool | hasConnection () const |
const WebSocketConnection & | getConnection () const |
bool | toAPIMessageJSON (std::string &outJSON, utility::ErrorState &error) |
void | addAPIEvent (APIEventPtr apiEvent) |
int | getCount () const |
const APIEventConstIterator | getAPIEvents () const |
const APIEvent * | getAPIEvent (int index) const |
APIEvent * | getAPIEvent (int index) |
APIEvent & | operator[] (std::size_t idx) |
const APIEvent & | operator[] (std::size_t idx) const |
![]() | |
virtual | ~Event ()=default |
Event ()=default | |
Event (const Event &)=delete | |
Event & | operator= (const Event &)=delete |
Used for communication between the client and server side of NAP portals. Contains all the information for the app to decide where to route the event and how to handle it. EPortalEventType::Request events are sent by clients to request a full description of the portal. EPortalEventType::Response events are then sent by the server as a response to request events. EPortalEventType::Update events can be sent both ways and indicate that portal items should be updated.
using APIEventList = std::vector<APIEventPtr> |
PortalEvent | ( | const PortalEventHeader & | header | ) |
Default constructor
header | the portal event header containing information about the objective of the event |
PortalEvent | ( | const PortalEventHeader & | header, |
const WebSocketConnection & | connection | ||
) |
Construct portal event with websocket connection
header | the portal event header containing information about the objective of the event |
connection | the WebSocket connection used for sending the event |
void addAPIEvent | ( | APIEventPtr | apiEvent | ) |
Adds an API event to the portal event, relating to a portal item
apiEvent | the API event to add to the portal event |
APIEvent* getAPIEvent | ( | int | index | ) |
index | the index of the API event |
const APIEvent* getAPIEvent | ( | int | index | ) | const |
index | the index of the API event |
const APIEventConstIterator getAPIEvents | ( | ) | const |
const WebSocketConnection& getConnection | ( | ) | const |
int getCount | ( | ) | const |
const std::string& getID | ( | ) | const |
const std::string& getPortalID | ( | ) | const |
const EPortalEventType& getType | ( | ) | const |
bool hasConnection | ( | ) | const |
APIEvent& operator[] | ( | std::size_t | idx | ) |
Array [] subscript operator
const APIEvent& operator[] | ( | std::size_t | idx | ) | const |
Array [] subscript operator
bool toAPIMessageJSON | ( | std::string & | outJSON, |
utility::ErrorState & | error | ||
) |
Converts the portal event to a JSON string of API messages used for sending over the WebSocket server.
outJSON | the string that will contain the JSON after converting |
error | should hold the error message when conversion fails |