clients: add support for Bluetooth NAP type

This commit is contained in:
Lubomir Rintel 2017-05-22 20:33:29 +02:00
parent ab46c9c70c
commit aedeb3cbf4
4 changed files with 15 additions and 13 deletions

View file

@ -301,7 +301,7 @@ usage_connection_add (void)
" [parent <ifname>]\n" " [parent <ifname>]\n"
" [p-key <IPoIB P_Key>]\n\n" " [p-key <IPoIB P_Key>]\n\n"
" bluetooth: [addr <bluetooth address>]\n" " bluetooth: [addr <bluetooth address>]\n"
" [bt-type panu|dun-gsm|dun-cdma]\n\n" " [bt-type panu|nap|dun-gsm|dun-cdma]\n\n"
" vlan: dev <parent device (connection UUID, ifname, or MAC)>\n" " vlan: dev <parent device (connection UUID, ifname, or MAC)>\n"
" id <VLAN ID>\n" " id <VLAN ID>\n"
" [flags <VLAN flags>]\n" " [flags <VLAN flags>]\n"
@ -3769,7 +3769,7 @@ gen_func_bool_values_l10n (const char *text, int state)
static char * static char *
gen_func_bt_type (const char *text, int state) gen_func_bt_type (const char *text, int state)
{ {
const char *words[] = { "panu", "dun-gsm", "dun-cdma", NULL }; const char *words[] = { "panu", "nap", "dun-gsm", "dun-cdma", NULL };
return nmc_rl_gen_func_basic (text, state, words); return nmc_rl_gen_func_basic (text, state, words);
} }
@ -3991,13 +3991,14 @@ set_bluetooth_type (NmCli *nmc, NMConnection *con, const OptionInfo *option, con
value = NM_SETTING_BLUETOOTH_TYPE_DUN; value = NM_SETTING_BLUETOOTH_TYPE_DUN;
setting = nm_setting_cdma_new (); setting = nm_setting_cdma_new ();
nm_connection_add_setting (con, setting); nm_connection_add_setting (con, setting);
} else if (!strcmp (value, NM_SETTING_BLUETOOTH_TYPE_PANU)) { } else if (!strcmp (value, NM_SETTING_BLUETOOTH_TYPE_PANU) || !strcmp (value, NM_SETTING_BLUETOOTH_TYPE_NAP)) {
/* no op */ /* no op */
} else { } else {
g_set_error (error, NMCLI_ERROR, NMC_RESULT_ERROR_USER_INPUT, g_set_error (error, NMCLI_ERROR, NMC_RESULT_ERROR_USER_INPUT,
_("Error: 'bt-type': '%s' not valid; use [%s, %s (%s), %s]."), _("Error: 'bt-type': '%s' not valid; use [%s, %s, %s (%s), %s]."),
value, NM_SETTING_BLUETOOTH_TYPE_PANU, NM_SETTING_BLUETOOTH_TYPE_DUN, value, NM_SETTING_BLUETOOTH_TYPE_PANU, NM_SETTING_BLUETOOTH_TYPE_NAP,
NM_SETTING_BLUETOOTH_TYPE_DUN"-gsm", NM_SETTING_BLUETOOTH_TYPE_DUN"-cdma"); NM_SETTING_BLUETOOTH_TYPE_DUN, NM_SETTING_BLUETOOTH_TYPE_DUN"-gsm",
NM_SETTING_BLUETOOTH_TYPE_DUN"-cdma");
return FALSE; return FALSE;
} }

View file

@ -4817,7 +4817,6 @@ static const NMMetaPropertyInfo *const property_infos_BLUETOOTH[] = {
PROPERTY_INFO_WITH_DESC (NM_SETTING_BLUETOOTH_BDADDR, PROPERTY_INFO_WITH_DESC (NM_SETTING_BLUETOOTH_BDADDR,
.is_cli_option = TRUE, .is_cli_option = TRUE,
.property_alias = "addr", .property_alias = "addr",
.inf_flags = NM_META_PROPERTY_INF_FLAG_REQD,
.prompt = N_("Bluetooth device address"), .prompt = N_("Bluetooth device address"),
.property_type = &_pt_gobject_mac, .property_type = &_pt_gobject_mac,
), ),
@ -4829,7 +4828,8 @@ static const NMMetaPropertyInfo *const property_infos_BLUETOOTH[] = {
.property_type = &_pt_gobject_string, .property_type = &_pt_gobject_string,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA ( .property_typ_data = DEFINE_PROPERTY_TYP_DATA (
.values_static = VALUES_STATIC (NM_SETTING_BLUETOOTH_TYPE_DUN, .values_static = VALUES_STATIC (NM_SETTING_BLUETOOTH_TYPE_DUN,
NM_SETTING_BLUETOOTH_TYPE_PANU), NM_SETTING_BLUETOOTH_TYPE_PANU,
NM_SETTING_BLUETOOTH_TYPE_NAP),
), ),
), ),
NULL NULL

View file

@ -44,9 +44,10 @@ struct _NMDevice;
#define NM_META_TEXT_PROMPT_BT_TYPE N_("Bluetooth type") #define NM_META_TEXT_PROMPT_BT_TYPE N_("Bluetooth type")
#define NM_META_TEXT_WORD_PANU "panu" #define NM_META_TEXT_WORD_PANU "panu"
#define NM_META_TEXT_WORD_NAP "nap"
#define NM_META_TEXT_WORD_DUN_GSM "dun-gsm" #define NM_META_TEXT_WORD_DUN_GSM "dun-gsm"
#define NM_META_TEXT_WORD_DUN_CDMA "dun-cdma" #define NM_META_TEXT_WORD_DUN_CDMA "dun-cdma"
#define NM_META_TEXT_PROMPT_BT_TYPE_CHOICES "(" NM_META_TEXT_WORD_PANU "/" NM_META_TEXT_WORD_DUN_GSM "/" NM_META_TEXT_WORD_DUN_CDMA ") [" NM_META_TEXT_WORD_PANU "]" #define NM_META_TEXT_PROMPT_BT_TYPE_CHOICES "(" NM_META_TEXT_WORD_PANU "/" NM_META_TEXT_WORD_NAP "/" NM_META_TEXT_WORD_DUN_GSM "/" NM_META_TEXT_WORD_DUN_CDMA ") [" NM_META_TEXT_WORD_PANU "]"
#define NM_META_TEXT_PROMPT_BOND_MODE N_("Bonding mode") #define NM_META_TEXT_PROMPT_BOND_MODE N_("Bonding mode")

View file

@ -1804,10 +1804,10 @@ property as well.
<row> <row>
<entry align="left">bt-type</entry> <entry align="left">bt-type</entry>
<entry align="left"><link linkend="nm-settings.property.bluetooth.type">bluetooth.type</link></entry> <entry align="left"><link linkend="nm-settings.property.bluetooth.type">bluetooth.type</link></entry>
<entry align="left" valign="top">Apart from the usual <literal>dun</literal> and <entry align="left" valign="top">Apart from the usual <literal>panu</literal>,
<literal>panu</literal> options, the values of <literal>dun-gsm</literal> <literal>nap</literal> and <literal>dun</literal> options, the values of
and <literal>dun-cdma</literal> can be used for compatibility with older <literal>dun-gsm</literal> and <literal>dun-cdma</literal> can be used for compatibility
versions. They are equivalent to using <literal>dun</literal> and setting with older versions. They are equivalent to using <literal>dun</literal> and setting
appropriate <literal>gsm.*</literal> or <literal>cdma.*</literal> properties.</entry> appropriate <literal>gsm.*</literal> or <literal>cdma.*</literal> properties.</entry>
</row> </row>
</tbody> </tbody>