diff options
author | Aleksander Morgado <aleksander@gnu.org> | 2011-09-15 20:09:07 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2012-03-15 14:14:20 +0100 |
commit | 8f95a2d78d0f7d94597699095838d69b6f3b50d1 (patch) | |
tree | 4ce50ddf0438db9d800ebec737e8d4591e139b03 | |
parent | a935cd9fb68df10c3b824251a3335e02ba40c322 (diff) |
plugin-base: new 'send-delay' property
The plugins can set this property to provide a custom value for the send delay
used for characters sent to the AT port during probing.
The value given to the property should be a guint64 specifying the delay in
microseconds.
-rw-r--r-- | src/mm-plugin-base.c | 20 | ||||
-rw-r--r-- | src/mm-plugin-base.h | 1 |
2 files changed, 21 insertions, 0 deletions
diff --git a/src/mm-plugin-base.c b/src/mm-plugin-base.c index effb45c4..d42dc3ef 100644 --- a/src/mm-plugin-base.c +++ b/src/mm-plugin-base.c @@ -77,6 +77,7 @@ typedef struct { const gchar **vendor_strings; const gchar **product_strings; const MMPortProbeAtCommand *custom_init; + guint64 send_delay; } MMPluginBasePrivate; enum { @@ -89,6 +90,7 @@ enum { PROP_ALLOWED_VENDOR_STRINGS, PROP_ALLOWED_PRODUCT_STRINGS, PROP_CUSTOM_INIT, + PROP_SEND_DELAY, PROP_SORT_LAST, LAST_PROP }; @@ -1548,6 +1550,8 @@ mm_plugin_base_init (MMPluginBase *self) g_str_equal, g_free, (GDestroyNotify) g_object_unref); + /* Defaults */ + priv->send_delay = 100000; } static void @@ -1589,6 +1593,10 @@ set_property (GObject *object, guint prop_id, /* Construct only */ priv->custom_init = (const MMPortProbeAtCommand *)g_value_get_pointer (value); break; + case PROP_SEND_DELAY: + /* Construct only */ + priv->send_delay = (guint64)g_value_get_uint64 (value); + break; case PROP_SORT_LAST: /* Construct only */ priv->sort_last = g_value_get_boolean (value); @@ -1630,6 +1638,9 @@ get_property (GObject *object, guint prop_id, case PROP_CUSTOM_INIT: g_value_set_pointer (value, (gpointer)priv->custom_init); break; + case PROP_SEND_DELAY: + g_value_set_uint64 (value, priv->send_delay); + break; case PROP_SORT_LAST: g_value_set_boolean (value, priv->sort_last); break; @@ -1734,6 +1745,15 @@ mm_plugin_base_class_init (MMPluginBaseClass *klass) G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property + (object_class, PROP_SEND_DELAY, + g_param_spec_uint64 (MM_PLUGIN_BASE_SEND_DELAY, + "Send delay", + "Send delay for characters in the AT port, " + "in microseconds", + 0, G_MAXUINT64, 100000, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); + + g_object_class_install_property (object_class, PROP_SORT_LAST, g_param_spec_boolean (MM_PLUGIN_BASE_SORT_LAST, "Sort Last", diff --git a/src/mm-plugin-base.h b/src/mm-plugin-base.h index 055af991..66f288f0 100644 --- a/src/mm-plugin-base.h +++ b/src/mm-plugin-base.h @@ -131,6 +131,7 @@ typedef struct { #define MM_PLUGIN_BASE_ALLOWED_VENDOR_STRINGS "allowed-vendor-strings" #define MM_PLUGIN_BASE_ALLOWED_PRODUCT_STRINGS "allowed-product-strings" #define MM_PLUGIN_BASE_CUSTOM_INIT "custom-init" +#define MM_PLUGIN_BASE_SEND_DELAY "send-delay" #define MM_PLUGIN_BASE_SORT_LAST "sort-last" typedef struct _MMPluginBase MMPluginBase; |