plugin-base: new 'allowed-vendor-strings' and 'allowed-product-strings' properties
The plugins can set these properties to filter support check requests by AT-reported Vendor string and Product string. The value given to the properties should be a NULL-terminated array of strings, e.g., static const gchar *vendor_strings[] = { "cinterion" , NULL };
This commit is contained in:

committed by
Aleksander Morgado

parent
2d8fb51c6b
commit
8ccb222978
@@ -73,6 +73,8 @@ typedef struct {
|
|||||||
const gchar **subsystems;
|
const gchar **subsystems;
|
||||||
const guint16 *vendor_ids;
|
const guint16 *vendor_ids;
|
||||||
const guint16 *product_ids;
|
const guint16 *product_ids;
|
||||||
|
const gchar **vendor_strings;
|
||||||
|
const gchar **product_strings;
|
||||||
const MMPortProbeAtCommand *custom_init;
|
const MMPortProbeAtCommand *custom_init;
|
||||||
} MMPluginBasePrivate;
|
} MMPluginBasePrivate;
|
||||||
|
|
||||||
@@ -82,6 +84,8 @@ enum {
|
|||||||
PROP_ALLOWED_SUBSYSTEMS,
|
PROP_ALLOWED_SUBSYSTEMS,
|
||||||
PROP_ALLOWED_VENDOR_IDS,
|
PROP_ALLOWED_VENDOR_IDS,
|
||||||
PROP_ALLOWED_PRODUCT_IDS,
|
PROP_ALLOWED_PRODUCT_IDS,
|
||||||
|
PROP_ALLOWED_VENDOR_STRINGS,
|
||||||
|
PROP_ALLOWED_PRODUCT_STRINGS,
|
||||||
PROP_CUSTOM_INIT,
|
PROP_CUSTOM_INIT,
|
||||||
PROP_SORT_LAST,
|
PROP_SORT_LAST,
|
||||||
LAST_PROP
|
LAST_PROP
|
||||||
@@ -1567,6 +1571,14 @@ set_property (GObject *object, guint prop_id,
|
|||||||
/* Construct only */
|
/* Construct only */
|
||||||
priv->product_ids = (const guint16 *)g_value_get_pointer (value);
|
priv->product_ids = (const guint16 *)g_value_get_pointer (value);
|
||||||
break;
|
break;
|
||||||
|
case PROP_ALLOWED_VENDOR_STRINGS:
|
||||||
|
/* Construct only */
|
||||||
|
priv->vendor_strings = (const gchar **)g_value_get_pointer (value);
|
||||||
|
break;
|
||||||
|
case PROP_ALLOWED_PRODUCT_STRINGS:
|
||||||
|
/* Construct only */
|
||||||
|
priv->product_strings = (const gchar **)g_value_get_pointer (value);
|
||||||
|
break;
|
||||||
case PROP_CUSTOM_INIT:
|
case PROP_CUSTOM_INIT:
|
||||||
/* Construct only */
|
/* Construct only */
|
||||||
priv->custom_init = (const MMPortProbeAtCommand *)g_value_get_pointer (value);
|
priv->custom_init = (const MMPortProbeAtCommand *)g_value_get_pointer (value);
|
||||||
@@ -1600,6 +1612,12 @@ get_property (GObject *object, guint prop_id,
|
|||||||
case PROP_ALLOWED_PRODUCT_IDS:
|
case PROP_ALLOWED_PRODUCT_IDS:
|
||||||
g_value_set_pointer (value, (gpointer)priv->product_ids);
|
g_value_set_pointer (value, (gpointer)priv->product_ids);
|
||||||
break;
|
break;
|
||||||
|
case PROP_ALLOWED_VENDOR_STRINGS:
|
||||||
|
g_value_set_pointer (value, (gpointer)priv->vendor_strings);
|
||||||
|
break;
|
||||||
|
case PROP_ALLOWED_PRODUCT_STRINGS:
|
||||||
|
g_value_set_pointer (value, (gpointer)priv->product_strings);
|
||||||
|
break;
|
||||||
case PROP_CUSTOM_INIT:
|
case PROP_CUSTOM_INIT:
|
||||||
g_value_set_pointer (value, (gpointer)priv->custom_init);
|
g_value_set_pointer (value, (gpointer)priv->custom_init);
|
||||||
break;
|
break;
|
||||||
@@ -1672,6 +1690,23 @@ mm_plugin_base_class_init (MMPluginBaseClass *klass)
|
|||||||
"should be an array of guint16 finished with '0'",
|
"should be an array of guint16 finished with '0'",
|
||||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||||
|
|
||||||
|
|
||||||
|
g_object_class_install_property
|
||||||
|
(object_class, PROP_ALLOWED_VENDOR_STRINGS,
|
||||||
|
g_param_spec_pointer (MM_PLUGIN_BASE_ALLOWED_VENDOR_STRINGS,
|
||||||
|
"Allowed vendor strings",
|
||||||
|
"List of vendor strings this plugin can support, "
|
||||||
|
"should be an array of strings finished with 'NULL'",
|
||||||
|
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||||
|
|
||||||
|
g_object_class_install_property
|
||||||
|
(object_class, PROP_ALLOWED_PRODUCT_STRINGS,
|
||||||
|
g_param_spec_pointer (MM_PLUGIN_BASE_ALLOWED_PRODUCT_STRINGS,
|
||||||
|
"Allowed product strings",
|
||||||
|
"List of product strings this plugin can support, "
|
||||||
|
"should be an array of strings finished with 'NULL'",
|
||||||
|
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||||
|
|
||||||
g_object_class_install_property
|
g_object_class_install_property
|
||||||
(object_class, PROP_CUSTOM_INIT,
|
(object_class, PROP_CUSTOM_INIT,
|
||||||
g_param_spec_pointer (MM_PLUGIN_BASE_CUSTOM_INIT,
|
g_param_spec_pointer (MM_PLUGIN_BASE_CUSTOM_INIT,
|
||||||
|
@@ -123,12 +123,14 @@ typedef struct {
|
|||||||
MMBaseSupportsTaskCustomInitResultFunc callback;
|
MMBaseSupportsTaskCustomInitResultFunc callback;
|
||||||
} MMPluginCustomInit;
|
} MMPluginCustomInit;
|
||||||
|
|
||||||
#define MM_PLUGIN_BASE_NAME "name"
|
#define MM_PLUGIN_BASE_NAME "name"
|
||||||
#define MM_PLUGIN_BASE_ALLOWED_SUBSYSTEMS "allowed-subsystems"
|
#define MM_PLUGIN_BASE_ALLOWED_SUBSYSTEMS "allowed-subsystems"
|
||||||
#define MM_PLUGIN_BASE_ALLOWED_VENDOR_IDS "allowed-vendor-ids"
|
#define MM_PLUGIN_BASE_ALLOWED_VENDOR_IDS "allowed-vendor-ids"
|
||||||
#define MM_PLUGIN_BASE_ALLOWED_PRODUCT_IDS "allowed-product-ids"
|
#define MM_PLUGIN_BASE_ALLOWED_PRODUCT_IDS "allowed-product-ids"
|
||||||
#define MM_PLUGIN_BASE_CUSTOM_INIT "custom-init"
|
#define MM_PLUGIN_BASE_ALLOWED_VENDOR_STRINGS "allowed-vendor-strings"
|
||||||
#define MM_PLUGIN_BASE_SORT_LAST "sort-last"
|
#define MM_PLUGIN_BASE_ALLOWED_PRODUCT_STRINGS "allowed-product-strings"
|
||||||
|
#define MM_PLUGIN_BASE_CUSTOM_INIT "custom-init"
|
||||||
|
#define MM_PLUGIN_BASE_SORT_LAST "sort-last"
|
||||||
|
|
||||||
typedef struct _MMPluginBase MMPluginBase;
|
typedef struct _MMPluginBase MMPluginBase;
|
||||||
typedef struct _MMPluginBaseClass MMPluginBaseClass;
|
typedef struct _MMPluginBaseClass MMPluginBaseClass;
|
||||||
|
Reference in New Issue
Block a user