1
1
/* !
2
2
* @file ws_offline_pico_v2.h
3
3
*
4
- * This is a driver for using the Raspberry Pi Pi Pico/Pico2
5
- * without a network interface with Adafruit IO Wippersnapper.
4
+ * This is a stub class for using the RP2040/RP2350 without a network interface
6
5
*
7
6
* Adafruit invests time and resources providing this open source code,
8
7
* please support Adafruit and open-source hardware by purchasing
9
8
* products from Adafruit!
10
9
*
11
- * Copyright (c) Brent Rubell 2024- 2025 for Adafruit Industries.
10
+ * Copyright (c) Brent Rubell 2025 for Adafruit Industries.
12
11
*
13
12
* MIT license, all text here must be included in any redistribution.
14
13
*
22
21
#define PICO_CONNECT_TIMEOUT_MS 20000 /* !< Connection timeout (in ms) */
23
22
#define PICO_CONNECT_RETRY_DELAY_MS 200 /* !< delay time between retries. */
24
23
25
- #include " Wippersnapper_V2.h"
26
24
#include " Arduino.h"
25
+ #include " Wippersnapper_V2.h"
27
26
28
27
extern Wippersnapper_V2 WsV2;
29
28
@@ -41,8 +40,7 @@ class ws_offline_pico_v2 : public Wippersnapper_V2 {
41
40
*/
42
41
/* *************************************************************************/
43
42
ws_offline_pico_v2 () : Wippersnapper_V2() {
44
-
45
- // No-op
43
+ // Do-nothing
46
44
}
47
45
48
46
/* *************************************************************************/
@@ -51,7 +49,7 @@ class ws_offline_pico_v2 : public Wippersnapper_V2 {
51
49
*/
52
50
/* *************************************************************************/
53
51
~ws_offline_pico_v2 () {
54
- // No-op
52
+ // Do-nothing - this class has no resources to release
55
53
}
56
54
57
55
/* *******************************************************/
@@ -64,8 +62,8 @@ class ws_offline_pico_v2 : public Wippersnapper_V2 {
64
62
*/
65
63
/* *******************************************************/
66
64
void set_ssid_pass (const char *ssid, const char *ssidPassword) {
67
- // No-op
68
- WS_DEBUG_PRINTLN ( " Code should not get here !" );
65
+ WS_DEBUG_PRINTLN ( " [ws_offline_pico] Error: set_ssid_pass() is not "
66
+ " supported in this implementation !" );
69
67
}
70
68
71
69
/* *********************************************************/
@@ -74,7 +72,8 @@ class ws_offline_pico_v2 : public Wippersnapper_V2 {
74
72
*/
75
73
/* *********************************************************/
76
74
void set_ssid_pass () {
77
- WS_DEBUG_PRINTLN (" Code should not get here!" );
75
+ WS_DEBUG_PRINTLN (" [ws_offline_pico] Error: set_ssid_pass() is not "
76
+ " supported in this implementation!" );
78
77
}
79
78
80
79
/* **********************************************************/
@@ -84,8 +83,9 @@ class ws_offline_pico_v2 : public Wippersnapper_V2 {
84
83
*/
85
84
/* **********************************************************/
86
85
bool check_valid_ssid () {
87
- WS_DEBUG_PRINTLN (" Code should not get here!" );
88
- return false ;
86
+ WS_DEBUG_PRINTLN (" [ws_offline_pico] Error: check_valid_ssid() is not "
87
+ " supported in this implementation!" );
88
+ return false ; // return an invalid value
89
89
}
90
90
91
91
/* *******************************************************/
@@ -95,7 +95,8 @@ class ws_offline_pico_v2 : public Wippersnapper_V2 {
95
95
*/
96
96
/* *******************************************************/
97
97
void getMacAddr () {
98
- WS_DEBUG_PRINTLN (" Code should not get here!" );
98
+ WS_DEBUG_PRINTLN (" [ws_offline_pico] Error: getMacAddr() is not supported "
99
+ " in this implementation!" );
99
100
}
100
101
101
102
/* *******************************************************/
@@ -104,9 +105,11 @@ class ws_offline_pico_v2 : public Wippersnapper_V2 {
104
105
@return int32_t RSSI value
105
106
*/
106
107
/* *******************************************************/
107
- int32_t getRSSI () {
108
- WS_DEBUG_PRINTLN (" Code should not get here!" );
109
- return 0 ; }
108
+ int32_t getRSSI () {
109
+ WS_DEBUG_PRINTLN (" [ws_offline_pico] Error: getRSSI() is not supported in "
110
+ " this implementation!" );
111
+ return -9999 ; // return an invalid value
112
+ }
110
113
111
114
/* *******************************************************/
112
115
/* !
@@ -116,8 +119,8 @@ class ws_offline_pico_v2 : public Wippersnapper_V2 {
116
119
*/
117
120
/* *******************************************************/
118
121
void setupMQTTClient (const char *clientID) {
119
- // No-op
120
- WS_DEBUG_PRINTLN ( " Code should not get here !" );
122
+ WS_DEBUG_PRINTLN ( " [ws_offline_pico] Error: setupMQTTClient() is not "
123
+ " supported in this implementation !" );
121
124
}
122
125
123
126
/* *******************************************************/
@@ -127,8 +130,10 @@ class ws_offline_pico_v2 : public Wippersnapper_V2 {
127
130
*/
128
131
/* *******************************************************/
129
132
ws_status_t networkStatus () {
130
- WS_DEBUG_PRINTLN (" Code should not get here!" );
131
- return WS_NET_DISCONNECTED;
133
+ WS_DEBUG_PRINTLN (" [ws_offline_pico] Error: networkStatus() is not "
134
+ " supported in this implementation!" );
135
+ return WS_NET_DISCONNECTED; // this value is valid, we are not connected to
136
+ // a network
132
137
}
133
138
134
139
/* ******************************************************************/
@@ -137,9 +142,11 @@ class ws_offline_pico_v2 : public Wippersnapper_V2 {
137
142
@return Pico
138
143
*/
139
144
/* ******************************************************************/
140
- const char *connectionType () {
141
- WS_DEBUG_PRINTLN (" Code should not get here!" );
142
- return " Pico-Nonet-v2" ; }
145
+ const char *connectionType () {
146
+ WS_DEBUG_PRINTLN (" [ws_offline_pico] Error: connectionType() is not "
147
+ " supported in this implementation!" );
148
+ return " ws-offline-pico" ;
149
+ }
143
150
144
151
protected:
145
152
/* *************************************************************************/
@@ -148,8 +155,8 @@ class ws_offline_pico_v2 : public Wippersnapper_V2 {
148
155
*/
149
156
/* *************************************************************************/
150
157
void _connect () {
151
- // No-op
152
- WS_DEBUG_PRINTLN ( " Code should not get here !" );
158
+ WS_DEBUG_PRINTLN ( " [ws_offline_pico] Error: _connect() is not supported in "
159
+ " this implementation !" );
153
160
}
154
161
155
162
/* *************************************************************************/
@@ -158,8 +165,8 @@ class ws_offline_pico_v2 : public Wippersnapper_V2 {
158
165
*/
159
166
/* *************************************************************************/
160
167
void _disconnect () {
161
- // No-op
162
- WS_DEBUG_PRINTLN ( " Code should not get here !" );
168
+ WS_DEBUG_PRINTLN ( " [ws_offline_pico] Error: _disconnect() is not supported "
169
+ " in this implementation !" );
163
170
}
164
171
};
165
172
0 commit comments