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.
This commit is contained in:
Aleksander Morgado
2011-09-15 20:09:07 +02:00
committed by Aleksander Morgado
parent a935cd9fb6
commit 8f95a2d78d
2 changed files with 21 additions and 0 deletions

View File

@@ -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;
@@ -1733,6 +1744,15 @@ mm_plugin_base_class_init (MMPluginBaseClass *klass)
"finished with 'NULL'",
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,

View File

@@ -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;