|
Files | |
file | benedettelli-nxt2wifi.h |
Dani's WiFi Sensor. | |
Defines | |
#define | WS_WEBLABEL 1 |
#define | WS_WEBBUTTON 2 |
#define | WS_WEBCHECKBOX 3 |
#define | WS_WEBSLIDER 4 |
#define | WS_WEBBARGRAPH 5 |
#define | WF_SEC_OPEN 0 |
#define | WF_SEC_WEP_40 1 |
#define | WF_SEC_WEP_104 2 |
#define | WF_SEC_WPA_KEY 3 |
#define | WF_SEC_WPA_PASSPHRASE 4 |
#define | WF_SEC_WPA2_KEY 5 |
#define | WF_SEC_WPA2_PASSPHRASE 6 |
#define | WF_SEC_WPA_AUTO_KEY 7 |
#define | WF_SEC_WPA_AUTO_PASSPHRASE 8 |
#define | AD_HOC 1 |
#define | INFRASTRUCTURE 0 |
#define | N2WchillOut() wait1Msec(50) |
#define | N2WsetIPAddress(X) _N2WsetPar("IPAD", X) |
#define | N2WsetMask(X) _N2WsetPar("MASK", X) |
#define | N2WsetGateway(X) _N2WsetPar("GWAY", X) |
#define | N2WsetDNS1(X) _N2WsetPar("DNS1", X) |
#define | N2WsetDNS2(X) _N2WsetPar("DNS2", X) |
#define | N2WsetSSID(X) _N2WsetPar("SSID", X) |
#define | N2WsetNetbiosName(X) _N2WsetPar("NAME", X) |
Functions | |
intrinsic int | StringFind (const char *sSrce, const char *pzFindString) asm(opcdStringOps |
intrinsic int | variableRefCharPtr (sSrce) |
intrinsic int | variableRefCharPtr (pzFindString)) |
int | N2WgetNumericResponse (tMassiveArray &buf) |
void | N2WgetStringResponse (const tMassiveArray &buf, string &response) |
bool | N2WsetDebug (bool en) |
bool | N2WConnect (bool custom) |
bool | N2WDisconnect () |
bool | N2WStopConnecting () |
bool | N2WDelete () |
bool | N2WSave () |
bool | N2WLoad () |
void | N2WReset () |
bool | N2WSecurity (int mode, const ubyte *pKeypass, int keylen, int keyind) |
bool | N2WSecurityWPA2Key (tBigByteArray &key, int len) |
bool | N2WSecurityWPA2Passphrase (const string passphrase) |
bool | N2WSecurityWPAKey (tBigByteArray &key, int len) |
bool | N2WSecurityWPAPassphrase (const string &passphrase) |
bool | N2WSecurityWEP104 (const string &passphrase) |
bool | N2WSecurityOpen () |
bool | N2WsetAdHoc (bool adhoc) |
bool | _N2WsetPar (const string type, const string param) |
bool | N2WsetDHCP (bool yes) |
bool | N2WsetDefaultProfile (ubyte profile) |
bool | N2WCustomExist () |
bool | N2WsetHibernate (bool hibernate) |
bool | N2WsetPowerSave (bool powersave) |
int | N2WStatus () |
bool | N2WConnected () |
bool | N2WgetIP (string &IP) |
void | N2WgetMAC (string &mac) |
bool | N2WUDPOpenClient (int id, string ip, int port) |
bool | N2WUDPOpenServer (int id, int port) |
int | N2WUDPAvail (int id) |
int | N2WUDPRead (int id, int datalen) |
bool | N2WUDPWrite (int id, tHugeByteArray &data, int datalen) |
bool | N2WUDPClose (int id) |
bool | N2WUDPFlush (int id) |
bool | N2WTCPOpenClient (int id, string host, int port) |
bool | N2WTCPOpenClient (int id, char *host, int port) |
bool | N2WTCPOpenServer (int id, int port) |
bool | N2WTCPDetachClient (int id) |
bool | N2WTCPClose (int id) |
bool | N2WTCPFlush (int id) |
int | N2WTCPAvail (int id) |
int | N2WTCPRead (int id, int datalen) |
int | N2WTCPWrite (int id, tHugeByteArray &data, int datalen) |
void | N2WTCPClientIP (int id, string &ip) |
void | N2WTCPClientMAC (int id, string &mac) |
bool | N2WenableWS (bool enable) |
bool | N2WreadWS (ubyte &type, ubyte &ID, ubyte &state, ubyte &value) |
bool | N2WwriteWS (ubyte type, ubyte id, tHugeByteArray &wsmessage, ubyte wsmsglen) |
bool | N2WclearFields () |
Variables | |
string | N2WscratchString |
intrinsic int | strOpFind |
intrinsic int | functionReturn |
Dani's WiFi Sensor
#define AD_HOC 1 |
Definition at line 64 of file benedettelli-nxt2wifi.h.
#define INFRASTRUCTURE 0 |
Definition at line 65 of file benedettelli-nxt2wifi.h.
#define N2WchillOut | ( | ) | wait1Msec(50) |
Wait 50ms between messages, this allows transmission to be done
Definition at line 67 of file benedettelli-nxt2wifi.h.
#define N2WsetDNS1 | ( | X ) | _N2WsetPar("DNS1", X) |
Macro for setting the first DNS server IP address
Definition at line 71 of file benedettelli-nxt2wifi.h.
#define N2WsetDNS2 | ( | X ) | _N2WsetPar("DNS2", X) |
Macro for setting the second DNS server IP address
Definition at line 72 of file benedettelli-nxt2wifi.h.
#define N2WsetGateway | ( | X ) | _N2WsetPar("GWAY", X) |
Macro for setting the gateway IP address
Definition at line 70 of file benedettelli-nxt2wifi.h.
#define N2WsetIPAddress | ( | X ) | _N2WsetPar("IPAD", X) |
Macro for setting the IP address
Definition at line 68 of file benedettelli-nxt2wifi.h.
#define N2WsetMask | ( | X ) | _N2WsetPar("MASK", X) |
Macro for setting the netmask
Definition at line 69 of file benedettelli-nxt2wifi.h.
#define N2WsetNetbiosName | ( | X ) | _N2WsetPar("NAME", X) |
Macro for setting the Netbios Name
Definition at line 74 of file benedettelli-nxt2wifi.h.
#define N2WsetSSID | ( | X ) | _N2WsetPar("SSID", X) |
Macro for setting the SSID to connect to
Definition at line 73 of file benedettelli-nxt2wifi.h.
#define WF_SEC_OPEN 0 |
Open Security (none)
Definition at line 54 of file benedettelli-nxt2wifi.h.
#define WF_SEC_WEP_104 2 |
104 bit WEP
Definition at line 56 of file benedettelli-nxt2wifi.h.
#define WF_SEC_WEP_40 1 |
40 bit WEP
Definition at line 55 of file benedettelli-nxt2wifi.h.
#define WF_SEC_WPA2_KEY 5 |
WPA2 using key
Definition at line 59 of file benedettelli-nxt2wifi.h.
#define WF_SEC_WPA2_PASSPHRASE 6 |
WPA2 using passphrase
Definition at line 60 of file benedettelli-nxt2wifi.h.
#define WF_SEC_WPA_AUTO_KEY 7 |
Automatically determine WPA type and use key
Definition at line 61 of file benedettelli-nxt2wifi.h.
#define WF_SEC_WPA_AUTO_PASSPHRASE 8 |
Automatically determine WPA type and use passphrase
Definition at line 62 of file benedettelli-nxt2wifi.h.
#define WF_SEC_WPA_KEY 3 |
WPA using key
Definition at line 57 of file benedettelli-nxt2wifi.h.
#define WF_SEC_WPA_PASSPHRASE 4 |
WPA using passphrase
Definition at line 58 of file benedettelli-nxt2wifi.h.
#define WS_WEBBARGRAPH 5 |
Web page widget: bargraph
Definition at line 52 of file benedettelli-nxt2wifi.h.
#define WS_WEBBUTTON 2 |
Web page widget: button
Definition at line 49 of file benedettelli-nxt2wifi.h.
#define WS_WEBCHECKBOX 3 |
Web page widget: checkbox
Definition at line 50 of file benedettelli-nxt2wifi.h.
#define WS_WEBLABEL 1 |
Web page widget: label
Definition at line 48 of file benedettelli-nxt2wifi.h.
#define WS_WEBSLIDER 4 |
Web page widget: slider
Definition at line 51 of file benedettelli-nxt2wifi.h.
bool _N2WsetPar | ( | const string | type, |
const string | param | ||
) |
Set a specific parameter.
Note: this is an internal function and should not be used directly.
type | the parameter type |
param | the value to pass to the parameter |
Definition at line 352 of file benedettelli-nxt2wifi.h.
bool N2WclearFields | ( | ) |
Clears all webpage fields. This cannot be used together with normal TCP/UDP operations.
Definition at line 1052 of file benedettelli-nxt2wifi.h.
bool N2WConnect | ( | bool | custom ) |
Connect to the currently configured WiFi network
custom | use the default or custom profile |
Definition at line 146 of file benedettelli-nxt2wifi.h.
bool N2WConnected | ( | ) |
Are we connected to the WiFi network?
Definition at line 465 of file benedettelli-nxt2wifi.h.
bool N2WCustomExist | ( | ) |
Check if a the custom profile exists.
Definition at line 404 of file benedettelli-nxt2wifi.h.
bool N2WDelete | ( | ) |
Delete the currently configured custom profile
Definition at line 195 of file benedettelli-nxt2wifi.h.
bool N2WDisconnect | ( | ) |
Disconnect from the current WiFi network
Definition at line 162 of file benedettelli-nxt2wifi.h.
bool N2WenableWS | ( | bool | enable ) |
Enable the built-in webserver. This cannot be used together with normal TCP/UDP operations.
enable | enables the web server if set to true, disables it if false |
Definition at line 945 of file benedettelli-nxt2wifi.h.
bool N2WgetIP | ( | string & | IP ) |
Get the current IP address. If the address could not be determined 0.0.0.0 is returned.
IP | the string to put the address into |
Definition at line 476 of file benedettelli-nxt2wifi.h.
void N2WgetMAC | ( | string & | mac ) |
Get the NXT2WIFI's MAC address.
mac | string to hold MAC address |
Definition at line 502 of file benedettelli-nxt2wifi.h.
int N2WgetNumericResponse | ( | tMassiveArray & | buf ) |
Parse the buffer and return the number in the NXT2WIFI response
buf | the buffer to pull the number from |
Definition at line 88 of file benedettelli-nxt2wifi.h.
void N2WgetStringResponse | ( | const tMassiveArray & | buf, |
string & | response | ||
) |
Parse the buffer and return the string in the NXT2WIFI response
buf | the buffer to pull the string from |
response | the string to hold the response from the sensor |
Definition at line 111 of file benedettelli-nxt2wifi.h.
bool N2WLoad | ( | ) |
Load the currently configured custom profile
Definition at line 221 of file benedettelli-nxt2wifi.h.
bool N2WreadWS | ( | ubyte & | type, |
ubyte & | ID, | ||
ubyte & | state, | ||
ubyte & | value | ||
) |
Read data from the web server. This cannot be used together with normal TCP/UDP operations.
Type can be one of the following:
type | the type of widget |
ID | ID of the element that was pressed or submitted |
state | additional data from the UI element |
value | the value of the UI element |
Definition at line 969 of file benedettelli-nxt2wifi.h.
void N2WReset | ( | ) |
Reset the NXT2WIFI sensor.
Definition at line 233 of file benedettelli-nxt2wifi.h.
bool N2WSave | ( | ) |
Save the currently configured custom profile
Definition at line 209 of file benedettelli-nxt2wifi.h.
bool N2WSecurity | ( | int | mode, |
const ubyte * | pKeypass, | ||
int | keylen, | ||
int | keyind | ||
) |
Confgure the security settings for the custom profile
Note: this is an internal function and shouldn't be used directly
mode | the security mode to use |
pKeypass | the keypass to use |
keylen | the length of the key |
keyind | used for WEP, usually set to 0 |
Definition at line 248 of file benedettelli-nxt2wifi.h.
bool N2WSecurityOpen | ( | ) |
Use no security at all. Just as effective as WEP but less annoying.
Definition at line 324 of file benedettelli-nxt2wifi.h.
bool N2WSecurityWEP104 | ( | const string & | passphrase ) |
Set the WEP passphrase. Please don't use this, it's very insecure.
passphrase | the WEP passphrase to use |
Definition at line 312 of file benedettelli-nxt2wifi.h.
bool N2WSecurityWPA2Key | ( | tBigByteArray & | key, |
int | len | ||
) |
Set the WPA2 key
key | the WPA2 key to use |
len | the length of the WPA2 key |
Definition at line 267 of file benedettelli-nxt2wifi.h.
bool N2WSecurityWPA2Passphrase | ( | const string | passphrase ) |
Set the WPA2 passphrase
passphrase | the WPA2 passphrase to use |
Definition at line 277 of file benedettelli-nxt2wifi.h.
bool N2WSecurityWPAKey | ( | tBigByteArray & | key, |
int | len | ||
) |
Set the WPA key
key | the WPA key to use |
len | the length of the WPA key |
Definition at line 290 of file benedettelli-nxt2wifi.h.
bool N2WSecurityWPAPassphrase | ( | const string & | passphrase ) |
Set the WPA passphrase
passphrase | the WPA passphrase to use |
Definition at line 300 of file benedettelli-nxt2wifi.h.
bool N2WsetAdHoc | ( | bool | adhoc ) |
Use ad-hoc network or infrastructure
adhoc | if true, use adhoc, otherwise use infrastructure mode |
Definition at line 335 of file benedettelli-nxt2wifi.h.
bool N2WsetDebug | ( | bool | en ) |
Enable debugging
en | whether or not to enable debugging |
Definition at line 129 of file benedettelli-nxt2wifi.h.
bool N2WsetDefaultProfile | ( | ubyte | profile ) |
Set the default profileto connect to after initial startup
profile | The profile to connect to, 0 = none, 1 = custom profile, 2 = default |
Definition at line 386 of file benedettelli-nxt2wifi.h.
bool N2WsetDHCP | ( | bool | yes ) |
Configure to use DHCP.
yes | if set to true, use DHCP |
Definition at line 369 of file benedettelli-nxt2wifi.h.
bool N2WsetHibernate | ( | bool | hibernate ) |
Enter or exit hibernation mode
hibernate | enter hibernation mode if true, exit if false |
Definition at line 420 of file benedettelli-nxt2wifi.h.
bool N2WsetPowerSave | ( | bool | powersave ) |
Enable or disable power saving
powersave | enable powersaving if true, disable if false |
Definition at line 437 of file benedettelli-nxt2wifi.h.
int N2WStatus | ( | ) |
Get the current connection status.
Definition at line 452 of file benedettelli-nxt2wifi.h.
bool N2WStopConnecting | ( | ) |
Stop reconnecting when disconnected
Definition at line 177 of file benedettelli-nxt2wifi.h.
int N2WTCPAvail | ( | int | id ) |
Check if there are bytes available for reading on the specified connection.
id | the connection ID to use, can be 1 to 4 |
Definition at line 809 of file benedettelli-nxt2wifi.h.
void N2WTCPClientIP | ( | int | id, |
string & | ip | ||
) |
Get the remote client's IP address
id | the connection ID to use, can be 1 to 4 |
ip | string to hold IP address |
Definition at line 892 of file benedettelli-nxt2wifi.h.
void N2WTCPClientMAC | ( | int | id, |
string & | mac | ||
) |
Get the remote client's MAC address. Only useful for local network client.
id | the connection ID to use, can be 1 to 4 |
mac | string to hold MAC address |
Definition at line 918 of file benedettelli-nxt2wifi.h.
bool N2WTCPClose | ( | int | id ) |
Close the specified connection
id | the connection ID to use, can be 1 to 4 or 0 for all |
Definition at line 778 of file benedettelli-nxt2wifi.h.
bool N2WTCPDetachClient | ( | int | id ) |
Closes a connection to a remote client
id | the connection ID to use, can be 1 to 4 |
Definition at line 759 of file benedettelli-nxt2wifi.h.
bool N2WTCPFlush | ( | int | id ) |
Flush the buffers of the specified connection
id | the connection ID to use, can be 1 to 4 or 0 for all |
Definition at line 793 of file benedettelli-nxt2wifi.h.
bool N2WTCPOpenClient | ( | int | id, |
string | host, | ||
int | port | ||
) |
Open a TCP connection to a remote host on a port
id | the connection ID to use, can be 1 to 4 |
host | the IP address of name of the remote host |
port | the port of the service on the remote host |
Definition at line 691 of file benedettelli-nxt2wifi.h.
bool N2WTCPOpenClient | ( | int | id, |
char * | host, | ||
int | port | ||
) |
Open a TCP connection to a remote host on a port
id | the connection ID to use, can be 1 to 4 |
host | the IP address of name of the remote host |
port | the port of the service on the remote host |
Definition at line 715 of file benedettelli-nxt2wifi.h.
bool N2WTCPOpenServer | ( | int | id, |
int | port | ||
) |
Open a listening UDP socket on the specified port
id | the connection ID to use, can be 1 to 4 |
port | the port on which to start listening |
Definition at line 740 of file benedettelli-nxt2wifi.h.
int N2WTCPRead | ( | int | id, |
int | datalen | ||
) |
Read the specified number of bytes from the connection ID. Bytes are read into the RS485rxbuffer variable.
id | the connection ID to use, can be 1 to 4 |
datalen | the number of bytes to read |
Definition at line 828 of file benedettelli-nxt2wifi.h.
int N2WTCPWrite | ( | int | id, |
tHugeByteArray & | data, | ||
int | datalen | ||
) |
Write the specified number of bytes to the connection ID.
id | the connection ID to use, can be 1 to 4 |
data | the tHugeByteArray containing the data to be transmitted |
datalen | the number of bytes to read |
Definition at line 866 of file benedettelli-nxt2wifi.h.
int N2WUDPAvail | ( | int | id ) |
Check if there are bytes available for reading on the specified connection.
id | the connection ID to use, can be 1 to 4 |
Definition at line 572 of file benedettelli-nxt2wifi.h.
bool N2WUDPClose | ( | int | id ) |
Close the specified connection. Use 0 to close all connections
id | the connection ID to use, can be 1 to 4 or 0 for all |
Definition at line 658 of file benedettelli-nxt2wifi.h.
bool N2WUDPFlush | ( | int | id ) |
Flush the buffers of the specified connection
id | the connection ID to use, can be 1 to 4 or 0 for all |
Definition at line 673 of file benedettelli-nxt2wifi.h.
bool N2WUDPOpenClient | ( | int | id, |
string | ip, | ||
int | port | ||
) |
Open a UDP datastream to a remote host on a port
id | the connection ID to use, can be 1 to 4 |
ip | the IP address of the remote host |
port | the port of the service on the remote host |
Definition at line 530 of file benedettelli-nxt2wifi.h.
bool N2WUDPOpenServer | ( | int | id, |
int | port | ||
) |
Open a listening UDP socket on the specified port
id | the connection ID to use, can be 1 to 4 |
port | the port on which to start listening |
Definition at line 553 of file benedettelli-nxt2wifi.h.
int N2WUDPRead | ( | int | id, |
int | datalen | ||
) |
Read the specified number of bytes from the connection ID. Bytes are read into the RS485rxbuffer variable.
id | the connection ID to use, can be 1 to 4 |
datalen | the number of bytes to read |
Definition at line 595 of file benedettelli-nxt2wifi.h.
bool N2WUDPWrite | ( | int | id, |
tHugeByteArray & | data, | ||
int | datalen | ||
) |
Write the specified number of bytes to the connection ID.
id | the connection ID to use, can be 1 to 4 |
data | the tHugeByteArray containing the data to be transmitted |
datalen | the number of bytes to read |
Definition at line 635 of file benedettelli-nxt2wifi.h.
bool N2WwriteWS | ( | ubyte | type, |
ubyte | id, | ||
tHugeByteArray & | wsmessage, | ||
ubyte | wsmsglen | ||
) |
Write data to the webserver.
Type can be one of the following:
type | the type of webpage element |
id | the field number in the web page |
wsmessage | data to be transmitted |
wsmsglen | length of the data |
Definition at line 1007 of file benedettelli-nxt2wifi.h.
intrinsic int StringFind | ( | const char * | sSrce, |
const char * | pzFindString | ||
) |
intrinsic int variableRefCharPtr | ( | pzFindString | ) |
intrinsic int variableRefCharPtr | ( | sSrce | ) |
intrinsic int functionReturn |
Definition at line 80 of file benedettelli-nxt2wifi.h.
string N2WscratchString |
string for tmp formatting, scratch data
Definition at line 78 of file benedettelli-nxt2wifi.h.
intrinsic int strOpFind |
Definition at line 80 of file benedettelli-nxt2wifi.h.