Lua Player Plus Vita
Documentation of lpp-vita
Network

Module that handles network and online features. More...

Enumerations

enum  HTTPMethod {
  GET_METHOD , POST_METHOD , HEAD_METHOD , OPTIONS_METHOD ,
  PUT_METHOD , DELETE_METHOD , TRACE_METHOD , CONNECT_METHOD
}
 HTTP methods. More...
 

Functions

void Network::init (void)
 Initialize network system. More...
 
void Network::term (void)
 Terminate network system. More...
 
void Network::initFTP (void)
 Initialize debug FTP. More...
 
void Network::termFTP (void)
 Terminate debug FTP. More...
 
string Network::getIPAdddress (void)
 Get console IP address. More...
 
string Network::getMacAdddress (void)
 Get console Mac address. More...
 
bool Network::isWifiEnabled (void)
 Check if WiFi is available. More...
 
int Network::getWifiLevel (void)
 Get WiFi strength level. More...
 
void Network::downloadFile (string url, string file, string useragent, HTTPMethod method, string postdata)
 Download a file via HTTP protocol (synchronous). More...
 
void Network::downloadFileAsync (string url, string file, string useragent, HTTPMethod method, string postdata)
 Download a file via HTTP protocol (asynchronous). More...
 
string Network::requestString (string url, string useragent, HTTPMethod method, string postdata)
 Get an HTTP request result (synchronous). More...
 
void Network::requestStringAsync (string url, string useragent, HTTPMethod method, string postdata)
 Get an HTTP request result (asynchronous). More...
 

Detailed Description

Module that handles network and online features.

Enumeration Type Documentation

◆ HTTPMethod

enum HTTPMethod

HTTP methods.

Enumerator
GET_METHOD 

GET method.

POST_METHOD 

POST method.

HEAD_METHOD 

HEAD method.

OPTIONS_METHOD 

OPTIONS method.

PUT_METHOD 

PUT method.

DELETE_METHOD 

DELETE method.

TRACE_METHOD 

TRACE method.

CONNECT_METHOD 

CONNECT method.

Function Documentation

◆ init()

void Network::init ( void  )

Initialize network system.

Usage example:
Definition: luaNetwork.cpp:21
void init(void)
Initialize network system.

◆ term()

void Network::term ( void  )

Terminate network system.

Usage example:
void term(void)
Terminate network system.

◆ initFTP()

void Network::initFTP ( void  )

Initialize debug FTP.

Usage example:
void initFTP(void)
Initialize debug FTP.

◆ termFTP()

void Network::termFTP ( void  )

Terminate debug FTP.

Usage example:
void termFTP(void)
Terminate debug FTP.

◆ getIPAdddress()

string Network::getIPAdddress ( void  )

Get console IP address.

Usage example:
ip_addr = Network.getIPAddress()
Returns
The IP Address of the console.

◆ getMacAdddress()

string Network::getMacAdddress ( void  )

Get console Mac address.

Usage example:
mac_addr = Network.getMacAddress()
Returns
The Mac Address of the console.

◆ isWifiEnabled()

bool Network::isWifiEnabled ( void  )

Check if WiFi is available.

Usage example:
Network.downloadFile("http://www.website.com/file.zip", "ux0:/data/file.zip")
end
bool isWifiEnabled(void)
Check if WiFi is available.
void downloadFile(string url, string file, string useragent, HTTPMethod method, string postdata)
Download a file via HTTP protocol (synchronous).
Returns
true if available, false otherwise.

◆ getWifiLevel()

int Network::getWifiLevel ( void  )

Get WiFi strength level.

Usage example:
wifi_lv = Network.getWifiLevel()
int getWifiLevel(void)
Get WiFi strength level.
Returns
The WiFi strength level percentage.

◆ downloadFile()

void Network::downloadFile ( string  url,
string  file,
string  useragent,
HTTPMethod  method,
string  postdata 
)

Download a file via HTTP protocol (synchronous).

Usage example:
Network.downloadFile("http://www.website.com/file.zip", "ux0:/data/file.zip")
Parameters
url- The url from where to download the file.
file- Filename where to save the downloaded file.
useragent- Custom useragent to use (optional).
method- Method to use to perform the HTTP request (optional).
postdata- POST data to send with the HTTP request (optional).
Note
postdata will work only with method set to POST_METHOD.
If not specified, GET_METHOD is used as default.

◆ downloadFileAsync()

void Network::downloadFileAsync ( string  url,
string  file,
string  useragent,
HTTPMethod  method,
string  postdata 
)

Download a file via HTTP protocol (asynchronous).

Usage example:
Network.downloadFileAsync("http://www.website.com/file.zip", "ux0:/data/file.zip")
void downloadFileAsync(string url, string file, string useragent, HTTPMethod method, string postdata)
Download a file via HTTP protocol (asynchronous).
Parameters
url- The url from where to download the file.
file- Filename where to save the downloaded file.
useragent- Custom useragent to use (optional).
method- Method to use to perform the HTTP request (optional).
postdata- POST data to send with the HTTP request (optional).
Note
postdata will work only with method set to POST_METHOD.
If not specified, GET_METHOD is used as default.

◆ requestString()

string Network::requestString ( string  url,
string  useragent,
HTTPMethod  method,
string  postdata 
)

Get an HTTP request result (synchronous).

Usage example:
result = Network.requestString("http://www.website.com/file.txt")
string requestString(string url, string useragent, HTTPMethod method, string postdata)
Get an HTTP request result (synchronous).
Parameters
url- The url where to send the HTTP request.
useragent- Custom useragent to use (optional).
method- Method to use to perform the HTTP request (optional).
postdata- POST data to send with the HTTP request (optional).
Returns
The HTTP request result.
Note
postdata will work only with method set to POST_METHOD.
If not specified, GET_METHOD is used as default.

◆ requestStringAsync()

void Network::requestStringAsync ( string  url,
string  useragent,
HTTPMethod  method,
string  postdata 
)

Get an HTTP request result (asynchronous).

Usage example:
Network.requestStringAsync("http://www.website.com/file.txt")
void requestStringAsync(string url, string useragent, HTTPMethod method, string postdata)
Get an HTTP request result (asynchronous).
Parameters
url- The url where to send the HTTP request.
useragent- Custom useragent to use (optional).
method- Method to use to perform the HTTP request (optional).
postdata- POST data to send with the HTTP request (optional).
Note
postdata will work only with method set to POST_METHOD.
If not specified, GET_METHOD is used as default.