diff options
author | Aleksander Morgado <aleksander@gnu.org> | 2011-09-08 18:22:19 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2012-03-15 14:14:20 +0100 |
commit | 2d8fb51c6b6669afa60594c04244f17653df0fb7 (patch) | |
tree | d375943e8c3a4448f7a0e0616c0403b762da3beb /src/mm-plugin-base.h | |
parent | 806aabd22d725a329bdfe12ac258cb1db293fc3d (diff) |
plugin-base: new 'custom-init' property
The plugins can set this property to provide custom initialization commands that
should be issued to the modem before real probing starts.
The value given to the property should be an array of MMPortProbeAtCommand
variables finished with a last one exposing a NULL command, e.g.:
static gboolean
parse_init (const gchar *response,
const GError *error,
GValue *result,
GError **result_error)
{
if (error)
return FALSE;
/* If we didn't get any error, it is an AT port */
g_value_init (result, G_TYPE_BOOLEAN);
g_value_set_boolean (result, TRUE);
return TRUE;
}
static gboolean
parse_init_last (const gchar *response,
const GError *error,
GValue *result,
GError **result_error)
{
g_value_init (result, G_TYPE_BOOLEAN);
/* On last error, report as not being an AT port */
g_value_set_boolean (result, error ? FALSE : TRUE);
return TRUE;
}
static const MMPortProbeAtCommand custom_init[] = {
{ "ATE1 E0", parse_init },
{ "ATE1 E0", parse_init },
{ "ATE1 E0", parse_init_last },
{ NULL }
};
Diffstat (limited to 'src/mm-plugin-base.h')
-rw-r--r-- | src/mm-plugin-base.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/mm-plugin-base.h b/src/mm-plugin-base.h index 256fad19..7bb0f7de 100644 --- a/src/mm-plugin-base.h +++ b/src/mm-plugin-base.h @@ -112,10 +112,22 @@ void mm_plugin_base_supports_task_add_custom_init_command (MMPluginBaseSupportsT #define MM_IS_PLUBIN_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_PLUGIN_BASE)) #define MM_PLUGIN_BASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_PLUGIN_BASE, MMPluginBaseClass)) +/* Structure defining custom commands that the plugins may need to initialize + * the devices */ +typedef struct { + /* AT command to send to the modem */ + gchar *command; + /* Number of allowed retries (>= 0) */ + guint retries; + /* Callback to call when reply received */ + MMBaseSupportsTaskCustomInitResultFunc callback; +} MMPluginCustomInit; + #define MM_PLUGIN_BASE_NAME "name" #define MM_PLUGIN_BASE_ALLOWED_SUBSYSTEMS "allowed-subsystems" #define MM_PLUGIN_BASE_ALLOWED_VENDOR_IDS "allowed-vendor-ids" #define MM_PLUGIN_BASE_ALLOWED_PRODUCT_IDS "allowed-product-ids" +#define MM_PLUGIN_BASE_CUSTOM_INIT "custom-init" #define MM_PLUGIN_BASE_SORT_LAST "sort-last" typedef struct _MMPluginBase MMPluginBase; |