Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
arduino-esp32
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
arduino-esp32
Commits
dcff2e97
Unverified
Commit
dcff2e97
authored
Nov 19, 2020
by
Sweety
Committed by
GitHub
Nov 19, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Separate Provisioning library from WiFi library (#4547)
parent
6d256b64
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
42 additions
and
29 deletions
+42
-29
CMakeLists.txt
CMakeLists.txt
+2
-1
libraries/WiFi/src/WiFi.cpp
libraries/WiFi/src/WiFi.cpp
+10
-0
libraries/WiFi/src/WiFi.h
libraries/WiFi/src/WiFi.h
+10
-2
libraries/WiFiProv/examples/WiFiProv/README.md
libraries/WiFiProv/examples/WiFiProv/README.md
+0
-0
libraries/WiFiProv/examples/WiFiProv/WiFiProv.ino
libraries/WiFiProv/examples/WiFiProv/WiFiProv.ino
+3
-3
libraries/WiFiProv/library.properties
libraries/WiFiProv/library.properties
+9
-0
libraries/WiFiProv/src/WiFiProv.cpp
libraries/WiFiProv/src/WiFiProv.cpp
+5
-11
libraries/WiFiProv/src/WiFiProv.h
libraries/WiFiProv/src/WiFiProv.h
+3
-12
No files found.
CMakeLists.txt
View file @
dcff2e97
...
...
@@ -72,11 +72,11 @@ set(LIBRARY_SRCS
libraries/WiFi/src/WiFi.cpp
libraries/WiFi/src/WiFiGeneric.cpp
libraries/WiFi/src/WiFiMulti.cpp
libraries/WiFi/src/WiFiProv.cpp
libraries/WiFi/src/WiFiScan.cpp
libraries/WiFi/src/WiFiServer.cpp
libraries/WiFi/src/WiFiSTA.cpp
libraries/WiFi/src/WiFiUdp.cpp
libraries/WiFiProv/src/WiFiProv.cpp
libraries/Wire/src/Wire.cpp
)
...
...
@@ -202,6 +202,7 @@ set(COMPONENT_ADD_INCLUDEDIRS
libraries/WebServer/src
libraries/WiFiClientSecure/src
libraries/WiFi/src
libraries/WiFiProv/src
libraries/Wire/src
)
...
...
libraries/WiFi/src/WiFi.cpp
View file @
dcff2e97
...
...
@@ -88,4 +88,14 @@ void WiFiClass::printDiag(Print& p)
p
.
println
(
conf
.
sta
.
bssid_set
);
}
void
WiFiClass
::
enableProv
(
bool
status
)
{
prov_enable
=
status
;
}
bool
WiFiClass
::
isProvEnabled
()
{
return
prov_enable
;
}
WiFiClass
WiFi
;
libraries/WiFi/src/WiFi.h
View file @
dcff2e97
...
...
@@ -37,11 +37,17 @@
#include "WiFiClient.h"
#include "WiFiServer.h"
#include "WiFiUdp.h"
#include "WiFiProv.h"
class
WiFiClass
:
public
WiFiGenericClass
,
public
WiFiSTAClass
,
public
WiFiScanClass
,
public
WiFiAPClass
,
public
WiFiProvClass
class
WiFiClass
:
public
WiFiGenericClass
,
public
WiFiSTAClass
,
public
WiFiScanClass
,
public
WiFiAPClass
{
private:
bool
prov_enable
;
public:
WiFiClass
()
{
prov_enable
=
false
;
}
using
WiFiGenericClass
::
channel
;
using
WiFiSTAClass
::
SSID
;
...
...
@@ -60,6 +66,8 @@ public:
friend
class
WiFiClient
;
friend
class
WiFiServer
;
friend
class
WiFiUDP
;
void
enableProv
(
bool
status
);
bool
isProvEnabled
();
};
extern
WiFiClass
WiFi
;
...
...
libraries/WiFi/examples/WiFiProv/README.md
→
libraries/WiFi
Prov
/examples/WiFiProv/README.md
View file @
dcff2e97
File moved
libraries/WiFi/examples/WiFiProv/WiFiProv.ino
→
libraries/WiFi
Prov
/examples/WiFiProv/WiFiProv.ino
View file @
dcff2e97
#include "WiFi.h"
#include "WiFi
Prov
.h"
void
SysProvEvent
(
system_event_t
*
sys_event
,
wifi_prov_event_t
*
prov_event
)
{
if
(
sys_event
)
{
...
...
@@ -56,8 +56,8 @@ void setup() {
/* uint8_t uuid[16] = {0xb4, 0xdf, 0x5a, 0x1c, 0x3f, 0x6b, 0xf4, 0xbf,
0xea, 0x4a, 0x82, 0x03, 0x04, 0x90, 0x1a, 0x02 };*/
WiFi
.
onEvent
(
SysProvEvent
);
//WiFi.beginProvision(provSchemeBLE, WIFI_PROV_SCHEME_BLE_EVENT_HANDLER_FREE_BTDM, WIFI_PROV_SECURITY_1, "abcd1234", "PROV_XXX", NULL, NULL);
WiFi
.
beginProvision
(
provSchemeSoftAP
,
WIFI_PROV_EVENT_HANDLER_NONE
,
WIFI_PROV_SECURITY_1
,
"abcd1234"
,
NULL
,
NULL
,
NULL
);
//WiFi
Prov
.beginProvision(provSchemeBLE, WIFI_PROV_SCHEME_BLE_EVENT_HANDLER_FREE_BTDM, WIFI_PROV_SECURITY_1, "abcd1234", "PROV_XXX", NULL, NULL);
WiFi
Prov
.
beginProvision
(
provSchemeSoftAP
,
WIFI_PROV_EVENT_HANDLER_NONE
,
WIFI_PROV_SECURITY_1
,
"abcd1234"
,
NULL
,
NULL
,
NULL
);
}
void
loop
()
{
...
...
libraries/WiFiProv/library.properties
0 → 100644
View file @
dcff2e97
name
=
WiFiProv
version
=
1.0
author
=
Switi Mhaiske <sweetymhaiske@gmail.com>
maintainer
=
Hristo Gochkov <hristo@espressif.com>
sentence
=
Enables provisioning.
paragraph
=
With this library you can perform provisioning on esp32 via SoftAP or BLE.
category
=
url
=
architectures
=
esp32
libraries/WiFi/src/WiFiProv.cpp
→
libraries/WiFi
Prov
/src/WiFiProv.cpp
View file @
dcff2e97
...
...
@@ -31,7 +31,8 @@
#include <wifi_provisioning/scheme_softap.h>
#include <wifi_provisioning/manager.h>
#undef IPADDR_NONE
#include "WiFi.h"
#include "WiFiProv.h"
#include "SimpleBLE.h"
extern
esp_err_t
postToSysQueue
(
system_prov_event_t
*
);
...
...
@@ -42,13 +43,6 @@ static const uint8_t custom_service_uuid[16] = { 0xb4, 0xdf, 0x5a, 0x1c, 0x3f,
#define SERV_NAME_PREFIX_PROV "PROV_"
bool
WiFiProvClass
::
prov_enable
=
true
;
bool
WiFiProvClass
::
isProvEnabled
()
{
return
prov_enable
;
}
void
provSchemeBLE
()
{
prov_scheme
=
WIFI_PROV_SCHEME_BLE
;
...
...
@@ -109,7 +103,7 @@ static void get_device_service_name(char *service_name, size_t max)
void
WiFiProvClass
::
beginProvision
(
void
(
*
scheme_cb
)(),
wifi_prov_event_handler_t
scheme_event_handler
,
wifi_prov_security_t
security
,
const
char
*
pop
,
const
char
*
service_name
,
const
char
*
service_key
,
uint8_t
*
uuid
)
{
prov_enable
=
true
;
WiFi
.
enableProv
(
true
)
;
bool
provisioned
=
false
;
scheme_cb
();
config
.
scheme_event_handler
=
scheme_event_handler
;
...
...
@@ -152,7 +146,7 @@ void WiFiProvClass :: beginProvision(void (*scheme_cb)(), wifi_prov_event_handle
}
else
{
wifi_prov_mgr_deinit
();
WiFi
.
mode
(
WIFI_MODE_STA
);
log_i
(
"Al
ear
dy Provisioned, starting Wi-Fi STA"
);
log_i
(
"Al
rea
dy Provisioned, starting Wi-Fi STA"
);
#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO
wifi_config_t
conf
;
esp_wifi_get_config
(
WIFI_IF_STA
,
&
conf
);
...
...
@@ -162,4 +156,4 @@ void WiFiProvClass :: beginProvision(void (*scheme_cb)(), wifi_prov_event_handle
WiFi
.
begin
();
}
}
WiFiProvClass
WiFiProv
;
libraries/WiFi/src/WiFiProv.h
→
libraries/WiFi
Prov
/src/WiFiProv.h
View file @
dcff2e97
...
...
@@ -17,10 +17,9 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "WiFi.h"
#include "wifi_provisioning/manager.h"
#include "wifi_provisioning/scheme_ble.h"
#include "nvs_flash.h"
#include "SimpleBLE.h"
//Select the scheme using which you want to provision
typedef
enum
{
...
...
@@ -34,19 +33,11 @@ extern void provSchemeBLE();
//Provisioning class
class
WiFiProvClass
{
protected:
static
bool
prov_enable
;
public:
WiFiProvClass
()
{
prov_enable
=
false
;
}
bool
isProvEnabled
();
void
beginProvision
(
void
(
*
scheme_cb
)()
=
provSchemeSoftAP
,
wifi_prov_event_handler_t
scheme_event_handler
=
WIFI_PROV_EVENT_HANDLER_NONE
,
wifi_prov_security_t
security
=
WIFI_PROV_SECURITY_1
,
const
char
*
pop
=
"abcd1234"
,
const
char
*
service_name
=
NULL
,
const
char
*
service_key
=
NULL
,
uint8_t
*
uuid
=
NULL
);
void
beginProvision
(
void
(
*
scheme_cb
)()
=
provSchemeSoftAP
,
wifi_prov_event_handler_t
scheme_event_handler
=
WIFI_PROV_EVENT_HANDLER_NONE
,
wifi_prov_security_t
security
=
WIFI_PROV_SECURITY_1
,
const
char
*
pop
=
"abcd1234"
,
const
char
*
service_name
=
NULL
,
const
char
*
service_key
=
NULL
,
uint8_t
*
uuid
=
NULL
);
};
extern
WiFiProvClass
WiFiProv
;
/*
Event Handler for BLE
- WIFI_PROV_SCHEME_BLE_EVENT_HANDLER_FREE_BTDM
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment