Tizen Native API
|
Functions | |
Ecore_Fd_Handler * | ecore_main_fd_handler_add (int fd, Ecore_Fd_Handler_Flags flags, Ecore_Fd_Cb func, const void *data, Ecore_Fd_Cb buf_func, const void *buf_data) |
Adds a callback for activity on the given file descriptor. | |
Ecore_Fd_Handler * | ecore_main_fd_handler_file_add (int fd, Ecore_Fd_Handler_Flags flags, Ecore_Fd_Cb func, const void *data, Ecore_Fd_Cb buf_func, const void *buf_data) |
Adds a callback for activity on the given file descriptor. | |
void | ecore_main_fd_handler_prepare_callback_set (Ecore_Fd_Handler *fd_handler, Ecore_Fd_Prep_Cb func, const void *data) |
Sets the prepare callback with data for a given Ecore_Fd_Handler. | |
void * | ecore_main_fd_handler_del (Ecore_Fd_Handler *fd_handler) |
Marks an FD handler for deletion. | |
int | ecore_main_fd_handler_fd_get (Ecore_Fd_Handler *fd_handler) |
Retrieves the file descriptor that the given handler is handling. | |
Eina_Bool | ecore_main_fd_handler_active_get (Ecore_Fd_Handler *fd_handler, Ecore_Fd_Handler_Flags flags) |
Gets which flags are active on an FD handler. | |
void | ecore_main_fd_handler_active_set (Ecore_Fd_Handler *fd_handler, Ecore_Fd_Handler_Flags flags) |
Sets what active streams the given FD handler should be monitoring. | |
Typedefs | |
typedef struct _Ecore_Fd_Handler | Ecore_Fd_Handler |
typedef to struct _Ecore_Fd_Handler | |
typedef enum _Ecore_Fd_Handler_Flags | Ecore_Fd_Handler_Flags |
typedef to enum _Ecore_Fd_Handler_Flags | |
typedef Eina_Bool(* | Ecore_Fd_Cb )(void *data, Ecore_Fd_Handler *fd_handler) |
The boolean type for a callback used by an Ecore_Fd_Handler. | |
typedef void(* | Ecore_Fd_Prep_Cb )(void *data, Ecore_Fd_Handler *fd_handler) |
Called to be used by an Ecore_Fd_Handler. |
This group discusses functions that deal with file descriptor handlers.
File descriptor handlers facilitate reading, writing, and checking for errors without blocking the program or doing expensive pooling. This can be used to monitor a socket, pipe, or some other stream for which an FD can be present.
File descriptor handlers can't be used to monitor file creation, modification, or deletion,
One common FD to be monitored is the standard input(stdin), monitoring it for reading requires a single call:
static Eina_Bool _my_cb_func(void *data, Ecore_Fd_Handler *handler) { char c; scanf("%c", &c); //Guaranteed not to block ... do stuff with c ... } ecore_main_fd_handler_add(STDIN_FILENO, ECORE_FD_READ, _my_cb_func, NULL, NULL, NULL);
When using a socket, pipe, or some other stream it's important to remember that errors may occur and we must monitor not only for reading/writing, but also for errors using the ECORE_FD_ERROR flag.
typedef struct _Ecore_Fd_Handler Ecore_Fd_Handler |
typedef to struct _Ecore_Fd_Handler
A handle for FD handlers
Eina_Bool ecore_main_fd_handler_active_get | ( | Ecore_Fd_Handler * | fd_handler, |
Ecore_Fd_Handler_Flags | flags | ||
) |
Gets which flags are active on an FD handler.
[in] | fd_handler | The given fd handler |
[in] | flags | The flags, ECORE_FD_READ , ECORE_FD_WRITE , or ECORE_FD_ERROR to query |
EINA_FALSE
void ecore_main_fd_handler_active_set | ( | Ecore_Fd_Handler * | fd_handler, |
Ecore_Fd_Handler_Flags | flags | ||
) |
Sets what active streams the given FD handler should be monitoring.
[in] | fd_handler | The given fd handler |
[in] | flags | The flags to be watching |
Ecore_Fd_Handler* ecore_main_fd_handler_add | ( | int | fd, |
Ecore_Fd_Handler_Flags | flags, | ||
Ecore_Fd_Cb | func, | ||
const void * | data, | ||
Ecore_Fd_Cb | buf_func, | ||
const void * | buf_data | ||
) |
Adds a callback for activity on the given file descriptor.
ECORE_CALLBACK_CANCEL
, it indicates that the handler should be marked for deletion (identical to calling ecore_main_fd_handler_del).ECORE_CALLBACK_CANCEL
, it indicates that func shouldn't be called, and when it returns ECORE_CALLBACK_RENEW
it indicates func should be called. The return value of buf_func does not cause the FD handler to get deleted.[in] | fd | The file descriptor to watch |
[in] | flags | The flags to monitor it, for reading use ECORE_FD_READ , for writing use ECORE_FD_WRITE , and for error use ECORE_FD_ERROR Values by |(ored). |
[in] | func | The callback function |
[in] | data | The data to pass to the callback |
[in] | buf_func | The function to call to check if any data has been buffered and already read from the fd May be NULL . |
[in] | buf_data | The data to pass to the buf_func function |
NULL
on failure void* ecore_main_fd_handler_del | ( | Ecore_Fd_Handler * | fd_handler | ) |
Marks an FD handler for deletion.
This function marks an fd handler to be deleted during an iteration of the main loop. It does NOT close the associated fd.
[in] | fd_handler | The fd handler |
NULL
on failure int ecore_main_fd_handler_fd_get | ( | Ecore_Fd_Handler * | fd_handler | ) |
Retrieves the file descriptor that the given handler is handling.
[in] | fd_handler | The given fd handler |
Ecore_Fd_Handler* ecore_main_fd_handler_file_add | ( | int | fd, |
Ecore_Fd_Handler_Flags | flags, | ||
Ecore_Fd_Cb | func, | ||
const void * | data, | ||
Ecore_Fd_Cb | buf_func, | ||
const void * | buf_data | ||
) |
Adds a callback for activity on the given file descriptor.
ECORE_FD_ERROR
, otherwise it calls the fd handler constantly. [in] | fd | The file descriptor to watch |
[in] | flags | The flags to monitor it, for reading use ECORE_FD_READ , for writing use ECORE_FD_WRITE , and for error use ECORE_FD_ERROR Values by |(ored). |
[in] | func | The callback function |
[in] | data | The data to pass to the callback |
[in] | buf_func | The function to call to check if any data has been buffered and already read from the fd May be NULL . |
[in] | buf_data | The data to pass to the buf_func function. |
NULL
on failure void ecore_main_fd_handler_prepare_callback_set | ( | Ecore_Fd_Handler * | fd_handler, |
Ecore_Fd_Prep_Cb | func, | ||
const void * | data | ||
) |
Sets the prepare callback with data for a given Ecore_Fd_Handler.
[in] | fd_handler | The fd handler |
[in] | func | The prep function |
[in] | data | The data to pass to the prep function |