Hi Julien,
NACK about that patch
---
include/network.h | 3 ++-
src/network.c | 25 +++++++++++++++++++++++++
2 files changed, 27 insertions(+), 1 deletions(-)
diff --git a/include/network.h b/include/network.h
index 91154c8..2f79163 100644
--- a/include/network.h
+++ b/include/network.h
@@ -126,7 +126,8 @@ connman_uint16_t connman_network_get_frequency(struct
connman_network *network);
int connman_network_set_wifi_channel(struct connman_network *network,
connman_uint16_t channel);
connman_uint16_t connman_network_get_wifi_channel(struct connman_network
*network);
-
+int connman_network_set_wpspin(struct connman_network *network,
+ const char *wpspin);
int connman_network_set_string(struct connman_network *network,
const char *key, const char *value);
const char *connman_network_get_string(struct connman_network *network,
diff --git a/src/network.c b/src/network.c
index 5ae5a12..9b81be6 100644
--- a/src/network.c
+++ b/src/network.c
@@ -33,6 +33,7 @@
#include<errno.h>
#include<string.h>
+#include<ctype.h>
#include "connman.h"
@@ -1766,6 +1767,30 @@ connman_uint16_t connman_network_get_wifi_channel(struct
connman_network *networ
return network->wifi.channel;
}
+int connman_network_set_wpspin(struct connman_network *network,
+ const char *wpspin)
+{
+ guint i;
+ int err = 0;
+
+ /* A WPS PIN is always 8 chars length,
+ * its content is in digit representation.
+ */
+ if (strlen(wpspin) == 8) {
+ for (i = 0; i< 8; i++)
+ if (!isdigit((unsigned char) wpspin[i]))
+ err = -ENOKEY;
+ } else
+ err = -ENOKEY;
+
+ if (err>= 0) {
+ g_free(network->wifi.pin_wps);
+ network->wifi.pin_wps = g_strdup(wpspin);
+ }
+
+ return err;
+}
+
The function is nice, but not in the right place. Put it in service.c
(you could even merge this check code directly in your patch 6)
network.c is not meant to do checks or whatever, it's a gateway between
service and the technology plugin below, that's why this code should not
be here.
/**
* connman_network_set_string:
* @network: network structure
_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman