generic_message_device hpi
API Reference Manual  /  4 Model-to-Model Interfaces  / 

generic_message_link

Description
SIM_INTERFACE(generic_message_link) {
#ifndef PYWRAP
        int  (*connect_device)(conf_object_t *_obj, conf_object_t *dev,
                               int *new_connection, uint32 address);
        void (*disconnect_device)(conf_object_t *_obj, conf_object_t *dev);
#endif
        void (*send_frame)(conf_object_t *_obj, int id, uint32 address,
                           dbuffer_t *frame, nano_secs_t delay);
};

#define GENERIC_MESSAGE_LINK_INTERFACE "generic_message_link"

Note: This interface is used for gml-link which is based on the link library. Refer to the Link Library for more information.
This interface is implemented by generic message link objects that provide a data link layer interface for frame delivery. It is used by the device object to talk to the link object. The device must implement the generic_message_device interface.

The connect_device function attaches a generic link device to the link. The return value is an identification number that should be used in subsequent calls to the link to identify the device. The address parameter sets the address of the device on the link. Currently the new_connection parameter is not in use, a NULL pointer can be passed as the parameter.

The disconnect_device function detaches a generic link device from the link. It will not receive any more frames from the link and may not call any functions in the interface, except connect_device.

The send_frame function is used by a device to send a generic device frame onto the link to be delivered to another device connected to the same link. The frame should be a dbuffer_t containing a data frame. The address parameter is the address to sent the frame to. The delay makes it possible to add a small delay to the frame. This can be used when a device wants to send multiple frames at once, but want them to be delivered in a specific sequence. Instead of using an event handler to send each frame, they can be sent at once, with an increasing delay for each frame. The delay is given in nanoseconds.

Execution Context
connect_deviceGlobal Context
disconnect_deviceGlobal Context
send_frameCell Context

generic_message_device hpi