iceoryx_binding_c/listener.h🔗
Types🔗
Name | |
---|---|
typedef CLASS Listener * | iox_listener_t |
Functions🔗
Name | |
---|---|
iox_listener_t | iox_listener_init(iox_listener_storage_t * self) initializes a listener struct from a storage struct pointer |
void | iox_listener_deinit(iox_listener_t const self) after using an iox_listener_t it must be cleaned up with this function |
ENUM iox_ListenerResult | iox_listener_attach_subscriber_event(iox_listener_t const self, iox_sub_t const subscriber, const ENUM iox_SubscriberEvent subscriberEvent, void(*)(iox_sub_t) callback) Attaches a subscriber event to the listener. |
ENUM iox_ListenerResult | iox_listener_attach_subscriber_event_with_context_data(iox_listener_t const self, iox_sub_t const subscriber, const ENUM iox_SubscriberEvent subscriberEvent, void()(iox_sub_t, void ) callback, void *const contextData) Attaches a subscriber event to the listener. The callback has an additional contextData argument to provide access to user defined data. |
ENUM iox_ListenerResult | iox_listener_attach_user_trigger_event(iox_listener_t const self, iox_user_trigger_t const userTrigger, void(*)(iox_user_trigger_t) callback) Attaches a user trigger to the listener. |
ENUM iox_ListenerResult | iox_listener_attach_user_trigger_event_with_context_data(iox_listener_t const self, iox_user_trigger_t const userTrigger, void()(iox_user_trigger_t, void ) callback, void *const contextData) Attaches a user trigger to the listener. The callback has an additional contextData argument to provide access to user defined data. |
void | iox_listener_detach_subscriber_event(iox_listener_t const self, iox_sub_t const subscriber, const ENUM iox_SubscriberEvent subscriberEvent) Detaches a subscriber event from the listener. |
void | iox_listener_detach_user_trigger_event(iox_listener_t const self, iox_user_trigger_t const userTrigger) Detaches a user trigger from the listener. |
uint64_t | iox_listener_size(iox_listener_t const self) Returns the size, the number of attached events of a listener. |
uint64_t | iox_listener_capacity(iox_listener_t const self) Returns the capacity of a listener (how many events can be attached). |
ENUM iox_ListenerResult | iox_listener_attach_client_event(iox_listener_t const self, iox_client_t const client, const ENUM iox_ClientEvent clientEvent, void(*)(iox_client_t) callback) Attaches a client event to the listener. |
ENUM iox_ListenerResult | iox_listener_attach_client_event_with_context_data(iox_listener_t const self, iox_client_t const client, const ENUM iox_ClientEvent clientEvent, void()(iox_client_t, void ) callback, void *const contextData) Attaches a client event to the listener. The callback has an additional contextData argument to provide access to user defined data. |
void | iox_listener_detach_client_event(iox_listener_t const self, iox_client_t const client, const ENUM iox_ClientEvent clientEvent) Detaches a client from the listener. |
ENUM iox_ListenerResult | iox_listener_attach_server_event(iox_listener_t const self, iox_server_t const server, const ENUM iox_ServerEvent serverEvent, void(*)(iox_server_t) callback) Attaches a server event to the listener. |
ENUM iox_ListenerResult | iox_listener_attach_server_event_with_context_data(iox_listener_t const self, iox_server_t const server, const ENUM iox_ServerEvent serverEvent, void()(iox_server_t, void ) callback, void *const contextData) Attaches a server event to the listener. The callback has an additional contextData argument to provide access to user defined data. |
void | iox_listener_detach_server_event(iox_listener_t const self, iox_server_t const server, const ENUM iox_ServerEvent serverEvent) Detaches a server from the listener. |
ENUM iox_ListenerResult | iox_listener_attach_service_discovery_event(iox_listener_t const self, iox_service_discovery_t const serviceDiscovery, const ENUM iox_ServiceDiscoveryEvent serviceDiscoveryEvent, void(*)(iox_service_discovery_t) callback) Attaches a service discovery event to the listener. |
ENUM iox_ListenerResult | iox_listener_attach_service_discovery_event_with_context_data(iox_listener_t const self, iox_service_discovery_t const serviceDiscovery, const ENUM iox_ServiceDiscoveryEvent serviceDiscoveryEvent, void()(iox_service_discovery_t, void ) callback, void *const contextData) Attaches a service discovery event to the listener. The callback has an additional contextData argument to provide access to user defined data. |
void | iox_listener_detach_service_discovery_event(iox_listener_t const self, iox_service_discovery_t const serviceDiscovery, const ENUM iox_ServiceDiscoveryEvent serviceDiscoveryEvent) Detaches a service discovery event from the listener. |
Types Documentation🔗
typedef iox_listener_t🔗
typedef CLASS Listener* iox_listener_t;
Functions Documentation🔗
function iox_listener_init🔗
iox_listener_t iox_listener_init(
iox_listener_storage_t * self
)
initializes a listener struct from a storage struct pointer
Parameters:
- self pointer to raw memory which can hold a listener
Return: an initialized iox_listener_t
function iox_listener_deinit🔗
void iox_listener_deinit(
iox_listener_t const self
)
after using an iox_listener_t it must be cleaned up with this function
Parameters:
- self the listener which should be deinitialized
function iox_listener_attach_subscriber_event🔗
ENUM iox_ListenerResult iox_listener_attach_subscriber_event(
iox_listener_t const self,
iox_sub_t const subscriber,
const ENUM iox_SubscriberEvent subscriberEvent,
void(*)(iox_sub_t) callback
)
Attaches a subscriber event to the listener.
Parameters:
- self listener to which the event should be attached to
- subscriber subscriber which emits the event
- subscriberEvent the event which should trigger the listener
- callback the callback which is called when an event triggers the listener
Return: when successful iox_ListenerResult::ListenerResult_SUCCESS otherwise an enum which describes the error
function iox_listener_attach_subscriber_event_with_context_data🔗
ENUM iox_ListenerResult iox_listener_attach_subscriber_event_with_context_data(
iox_listener_t const self,
iox_sub_t const subscriber,
const ENUM iox_SubscriberEvent subscriberEvent,
void(*)(iox_sub_t, void *) callback,
void *const contextData
)
Attaches a subscriber event to the listener. The callback has an additional contextData argument to provide access to user defined data.
Parameters:
- self listener to which the event should be attached to
- subscriber subscriber which emits the event
- subscriberEvent the event which should trigger the listener
- callback the callback which is called when an event triggers the listener
- contextData a void pointer which is provided as second argument to the callback
Return: when successful iox_ListenerResult::ListenerResult_SUCCESS otherwise an enum which describes the error
function iox_listener_attach_user_trigger_event🔗
ENUM iox_ListenerResult iox_listener_attach_user_trigger_event(
iox_listener_t const self,
iox_user_trigger_t const userTrigger,
void(*)(iox_user_trigger_t) callback
)
Attaches a user trigger to the listener.
Parameters:
- self listener to which the event should be attached to
- userTrigger user trigger which emits the event
- callback the callback which is called when the user trigger triggers the listener
Return: when successful iox_ListenerResult::ListenerResult_SUCCESS otherwise an enum which describes the error
function iox_listener_attach_user_trigger_event_with_context_data🔗
ENUM iox_ListenerResult iox_listener_attach_user_trigger_event_with_context_data(
iox_listener_t const self,
iox_user_trigger_t const userTrigger,
void(*)(iox_user_trigger_t, void *) callback,
void *const contextData
)
Attaches a user trigger to the listener. The callback has an additional contextData argument to provide access to user defined data.
Parameters:
- self listener to which the event should be attached to
- userTrigger user trigger which emits the event
- callback the callback which is called when the user trigger triggers the listener
- contextData a void pointer which is provided as second argument to the callback
Return: when successful iox_ListenerResult::ListenerResult_SUCCESS otherwise an enum which describes the error
function iox_listener_detach_subscriber_event🔗
void iox_listener_detach_subscriber_event(
iox_listener_t const self,
iox_sub_t const subscriber,
const ENUM iox_SubscriberEvent subscriberEvent
)
Detaches a subscriber event from the listener.
Parameters:
- self listener from which the event should be detached
- subscriber the subscriber which emits the event
- subscriberEvent the subscriber event which is registered at the listener
function iox_listener_detach_user_trigger_event🔗
void iox_listener_detach_user_trigger_event(
iox_listener_t const self,
iox_user_trigger_t const userTrigger
)
Detaches a user trigger from the listener.
Parameters:
- self listener from which the event should be detached
- userTrigger the user trigger which emits the event
function iox_listener_size🔗
uint64_t iox_listener_size(
iox_listener_t const self
)
Returns the size, the number of attached events of a listener.
Parameters:
- self listener where the size should be acquired
Return: the size of the listener
function iox_listener_capacity🔗
uint64_t iox_listener_capacity(
iox_listener_t const self
)
Returns the capacity of a listener (how many events can be attached).
Parameters:
- self listener where the capacity should be acquired
Return: the capacity of the listener
function iox_listener_attach_client_event🔗
ENUM iox_ListenerResult iox_listener_attach_client_event(
iox_listener_t const self,
iox_client_t const client,
const ENUM iox_ClientEvent clientEvent,
void(*)(iox_client_t) callback
)
Attaches a client event to the listener.
Parameters:
- self listener to which the event should be attached to
- client client which emits the event
- clientEvent the event which should trigger the listener
- callback the callback which is called when an event triggers the listener
Return: when successful iox_ListenerResult::ListenerResult_SUCCESS otherwise an enum which describes the error
function iox_listener_attach_client_event_with_context_data🔗
ENUM iox_ListenerResult iox_listener_attach_client_event_with_context_data(
iox_listener_t const self,
iox_client_t const client,
const ENUM iox_ClientEvent clientEvent,
void(*)(iox_client_t, void *) callback,
void *const contextData
)
Attaches a client event to the listener. The callback has an additional contextData argument to provide access to user defined data.
Parameters:
- self listener to which the event should be attached to
- client client which emits the event
- clientEvent the event which should trigger the listener
- callback the callback which is called when an event triggers the listener
- contextData a void pointer which is provided as second argument to the callback
Return: when successful iox_ListenerResult::ListenerResult_SUCCESS otherwise an enum which describes the error
function iox_listener_detach_client_event🔗
void iox_listener_detach_client_event(
iox_listener_t const self,
iox_client_t const client,
const ENUM iox_ClientEvent clientEvent
)
Detaches a client from the listener.
Parameters:
- self listener from which the event should be detached
- client the client which emits the event
- clientEvent the event which should be removed from the listener
function iox_listener_attach_server_event🔗
ENUM iox_ListenerResult iox_listener_attach_server_event(
iox_listener_t const self,
iox_server_t const server,
const ENUM iox_ServerEvent serverEvent,
void(*)(iox_server_t) callback
)
Attaches a server event to the listener.
Parameters:
- self listener to which the event should be attached to
- server the server which emits the event
- serverEvent the event which should trigger the listener
- callback the callback which is called when an event triggers the listener
Return: when successful iox_ListenerResult::ListenerResult_SUCCESS otherwise an enum which describes the error
function iox_listener_attach_server_event_with_context_data🔗
ENUM iox_ListenerResult iox_listener_attach_server_event_with_context_data(
iox_listener_t const self,
iox_server_t const server,
const ENUM iox_ServerEvent serverEvent,
void(*)(iox_server_t, void *) callback,
void *const contextData
)
Attaches a server event to the listener. The callback has an additional contextData argument to provide access to user defined data.
Parameters:
- self listener to which the event should be attached to
- server the server which emits the event
- serverEvent the event which should trigger the listener
- callback the callback which is called when an event triggers the listener
- contextData a void pointer which is provided as second argument to the callback
Return: when successful iox_ListenerResult::ListenerResult_SUCCESS otherwise an enum which describes the error
function iox_listener_detach_server_event🔗
void iox_listener_detach_server_event(
iox_listener_t const self,
iox_server_t const server,
const ENUM iox_ServerEvent serverEvent
)
Detaches a server from the listener.
Parameters:
- self listener from which the event should be detached
- server the server which emits the event
- serverEvent the event which should be removed from the listener
function iox_listener_attach_service_discovery_event🔗
ENUM iox_ListenerResult iox_listener_attach_service_discovery_event(
iox_listener_t const self,
iox_service_discovery_t const serviceDiscovery,
const ENUM iox_ServiceDiscoveryEvent serviceDiscoveryEvent,
void(*)(iox_service_discovery_t) callback
)
Attaches a service discovery event to the listener.
Parameters:
- self listener to which the event should be attached to
- serviceDiscovery service discovery which emits the event
- serviceDiscoveryEvent the event which should trigger the listener
- callback the callback which is called when an event triggers the listener
Return: when successful iox_ListenerResult::ListenerResult_SUCCESS otherwise an enum which describes the error
function iox_listener_attach_service_discovery_event_with_context_data🔗
ENUM iox_ListenerResult iox_listener_attach_service_discovery_event_with_context_data(
iox_listener_t const self,
iox_service_discovery_t const serviceDiscovery,
const ENUM iox_ServiceDiscoveryEvent serviceDiscoveryEvent,
void(*)(iox_service_discovery_t, void *) callback,
void *const contextData
)
Attaches a service discovery event to the listener. The callback has an additional contextData argument to provide access to user defined data.
Parameters:
- self listener to which the event should be attached to
- serviceDiscovery service discovery which emits the event
- serviceDiscoveryEvent the event which should trigger the listener
- callback the callback which is called when an event triggers the listener
- contextData a void pointer which is provided as second argument to the callback
Return: when successful iox_ListenerResult::ListenerResult_SUCCESS otherwise an enum which describes the error
function iox_listener_detach_service_discovery_event🔗
void iox_listener_detach_service_discovery_event(
iox_listener_t const self,
iox_service_discovery_t const serviceDiscovery,
const ENUM iox_ServiceDiscoveryEvent serviceDiscoveryEvent
)
Detaches a service discovery event from the listener.
Parameters:
- self listener from which the event should be detached
- serviceDiscovery the service discovery which emits the event
- serviceDiscoveryEvent the service discovery event which should be removed from the listener
Source code🔗
// Copyright (c) 2021 - 2022 Apex.AI Inc. All rights reserved.
//
// 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.
//
// SPDX-License-Identifier: Apache-2.0
#ifndef IOX_BINDING_C_LISTENER_H
#define IOX_BINDING_C_LISTENER_H
#include "iceoryx_binding_c/client.h"
#include "iceoryx_binding_c/enums.h"
#include "iceoryx_binding_c/internal/c2cpp_binding.h"
#include "iceoryx_binding_c/server.h"
#include "iceoryx_binding_c/service_discovery.h"
#include "iceoryx_binding_c/subscriber.h"
#include "iceoryx_binding_c/types.h"
#include "iceoryx_binding_c/user_trigger.h"
typedef CLASS Listener* iox_listener_t;
iox_listener_t iox_listener_init(iox_listener_storage_t* self);
void iox_listener_deinit(iox_listener_t const self);
ENUM iox_ListenerResult iox_listener_attach_subscriber_event(iox_listener_t const self,
iox_sub_t const subscriber,
const ENUM iox_SubscriberEvent subscriberEvent,
void (*callback)(iox_sub_t));
ENUM iox_ListenerResult
iox_listener_attach_subscriber_event_with_context_data(iox_listener_t const self,
iox_sub_t const subscriber,
const ENUM iox_SubscriberEvent subscriberEvent,
void (*callback)(iox_sub_t, void*),
void* const contextData);
ENUM iox_ListenerResult iox_listener_attach_user_trigger_event(iox_listener_t const self,
iox_user_trigger_t const userTrigger,
void (*callback)(iox_user_trigger_t));
ENUM iox_ListenerResult iox_listener_attach_user_trigger_event_with_context_data(iox_listener_t const self,
iox_user_trigger_t const userTrigger,
void (*callback)(iox_user_trigger_t,
void*),
void* const contextData);
void iox_listener_detach_subscriber_event(iox_listener_t const self,
iox_sub_t const subscriber,
const ENUM iox_SubscriberEvent subscriberEvent);
void iox_listener_detach_user_trigger_event(iox_listener_t const self, iox_user_trigger_t const userTrigger);
uint64_t iox_listener_size(iox_listener_t const self);
uint64_t iox_listener_capacity(iox_listener_t const self);
ENUM iox_ListenerResult iox_listener_attach_client_event(iox_listener_t const self,
iox_client_t const client,
const ENUM iox_ClientEvent clientEvent,
void (*callback)(iox_client_t));
ENUM iox_ListenerResult iox_listener_attach_client_event_with_context_data(iox_listener_t const self,
iox_client_t const client,
const ENUM iox_ClientEvent clientEvent,
void (*callback)(iox_client_t, void*),
void* const contextData);
void iox_listener_detach_client_event(iox_listener_t const self,
iox_client_t const client,
const ENUM iox_ClientEvent clientEvent);
ENUM iox_ListenerResult iox_listener_attach_server_event(iox_listener_t const self,
iox_server_t const server,
const ENUM iox_ServerEvent serverEvent,
void (*callback)(iox_server_t));
ENUM iox_ListenerResult iox_listener_attach_server_event_with_context_data(iox_listener_t const self,
iox_server_t const server,
const ENUM iox_ServerEvent serverEvent,
void (*callback)(iox_server_t, void*),
void* const contextData);
void iox_listener_detach_server_event(iox_listener_t const self,
iox_server_t const server,
const ENUM iox_ServerEvent serverEvent);
ENUM iox_ListenerResult
iox_listener_attach_service_discovery_event(iox_listener_t const self,
iox_service_discovery_t const serviceDiscovery,
const ENUM iox_ServiceDiscoveryEvent serviceDiscoveryEvent,
void (*callback)(iox_service_discovery_t));
ENUM iox_ListenerResult iox_listener_attach_service_discovery_event_with_context_data(
iox_listener_t const self,
iox_service_discovery_t const serviceDiscovery,
const ENUM iox_ServiceDiscoveryEvent serviceDiscoveryEvent,
void (*callback)(iox_service_discovery_t, void*),
void* const contextData);
void iox_listener_detach_service_discovery_event(iox_listener_t const self,
iox_service_discovery_t const serviceDiscovery,
const ENUM iox_ServiceDiscoveryEvent serviceDiscoveryEvent);
#endif
Updated on 18 December 2023 at 13:11:43 CET