default
[ class tree: default ] [ index: default ] [ all elements ]

Class: guifiAPI

Source Location: /guifi_api.php

Class Overview


Client class for the guifi.net API


Constants

Methods



Class Details

[line 14]
Client class for the guifi.net API



[ Top ]


Class Methods


constructor __construct [line 587]

guifiAPI __construct( String $username, String $password, [String $token = null])

Constructor function for all new guifiAPI instances

Set up authentication with guifi and gets authentication token




Tags:

access:   public


Parameters:

String   $username   Username of the guifi.net account wanted to authenticate
String   $password   Password of the guifi.net account wanted to authenticate
String   $token   If any token is given, no need to send the username and password to the server

[ Top ]

method addDevice [line 226]

mixed addDevice( $node_id $node_id, $type $type, $parameters $mac, [ $parameters = array()])

Adds a guifi device to a node



Tags:

return:   The response with the newly created device_id or false in case of error
access:   public


Parameters:

$node_id   $node_id   ID of the node where the device should be added
$type   $type   Type of device which should be added (radio, mobile, server, nat, generic, adsl, cam, phone)
$parameters   $mac   Other parameters depending on the type of device, such as model_id, MAC address or firmware
   $parameters  

[ Top ]

method addInterface [line 382]

mixed addInterface( $device_id $device_id, $radiodev_counter $radiodev_counter)

Adds a wLan interface to a radio to accept more clients



Tags:

return:   Information about the newly created interface, such as interface_id
access:   public


Parameters:

$device_id   $device_id   Device where the interface should be added
$radiodev_counter   $radiodev_counter   Position of the radio within the device where the interface should be added

[ Top ]

method addLink [line 421]

mixed addLink( $from_device_id $from_device_id, $from_radiodev_counter $from_radiodev_counter, $to_device_id $to_device_id, $to_radiodev_counter $to_radiodev_counter, [$parameters $parameters = array()])

Adds a link to an guifi.net interface



Tags:

return:   Information about the newly created link, such as link_id
access:   public


Parameters:

$from_device_id   $from_device_id   Device ID of the origin of the link
$from_radiodev_counter   $from_radiodev_counter   Position of the radio within its device of the origin of the link
$to_device_id   $to_device_id   Device ID of the other extreme of the link
$to_radiodev_counter   $to_radiodev_counter   Position of the radio within its device of the other extreme of the link
$parameters   $parameters   Other parameters of the link to be added

[ Top ]

method addNode [line 160]

mixed addNode( $title $title, $zone_id $zone_id, $lat $lat, $lon $lon, [$parameters $parameters = array()])

Adds a new guifi.net node



Tags:

return:   Information of the newly created node (node_id)
access:   public


Parameters:

$title   $title   Title of the node
$zone_id   $zone_id   Zone ID of the node
$lat   $lat   Latitude where the node is
$lon   $lon   Longitude where the node is
$parameters   $parameters   Parameters to specify node settings

[ Top ]

method addRadio [line 290]

mixed addRadio( $mode $mode, $device_id $device_id, [$mac $mac = ''], [ $parameters = array()])

Adds a guifi Radio to a device



Tags:

return:   Information about the added radio, such as radiodev_counter
access:   public


Parameters:

$mode   $mode   Mode of the radio to be added
$device_id   $device_id   Device where the radio should be added
$mac   $mac   MAC address of the radio
   $parameters  

[ Top ]

method addZone [line 68]

mixed addZone( $title $title, $master $master, $miny $miny, $minx $minx, $maxy $maxy, $maxx $maxx, [$parameters $parameters = array()])

Adds a zone to guifi.net



Tags:

return:   An array with the zone_id, or false in case of failure
access:   public


Parameters:

$title   $title   Title of the zone
$master   $master   Parent zone of the new zone
$miny   $miny   Latitude coordinate, in decimal degrees, of the lower-left corner of the zone (SW)
$minx   $minx   Longitude coordinate, in decimal degrees, of the lower-left corner of the zone (SW)
$maxy   $maxy   Latitude coordinate, in decimal degrees, of the upper-right corner of the zone (NE)
$maxx   $maxx   Longitude coordinate, in decimal degrees, of the upper-right corner of the zone (NE)
$parameters   $parameters   Extra parameters to create the zone

[ Top ]

method authenticateUser [line 604]

boolean authenticateUser( $username, string $password, string $email)

Authenticate guifi.net account against guifi.net



Tags:

return:   Whether the authentication was successful or not
access:   protected


Parameters:

string   $email  
string   $password  
   $username  

[ Top ]

method generateAuthHeader [line 636]

mixed generateAuthHeader( )

Generates the authentication header to authenticate using a token against guifi.net



Tags:

return:   Header of authentication
access:   protected


[ Top ]

method getAuthToken [line 628]

string getAuthToken( )

Retreives the authentication token used to authenticate the user in upcoming methods without sending the username and password each time



Tags:

return:   Authentication token
access:   public


[ Top ]

method getChannels [line 564]

string[] getChannels( $protocol $protocol)

Gets a list of channels to be used with links



Tags:

return:   Channels retrieved from the server
access:   public


Parameters:

$protocol   $protocol   Protocol the channels apply to

[ Top ]

method getErrors [line 723]

string[] getErrors( )

Retreives the possible errors commited during a method



Tags:

access:   public


[ Top ]

method getErrorsStr [line 733]

string getErrorsStr( [string $format = 'html'])

Retreives a list of the errors parsed as a string



Tags:

return:   List of formatted errors
access:   public


Parameters:

string   $format   Format of the list, either 'html' or 'plain'

[ Top ]

method getFirmwares [line 524]

string[] getFirmwares( [$parameters $parameters = array()])

Gets a list of supported firmwares to be used with devices



Tags:

return:   Firmwares retrieved from the server
access:   public


Parameters:

$parameters   $parameters   Firmware filters to be applied

[ Top ]

method getManufacturers [line 506]

string[] getManufacturers( )

Gets a list of device manufacturers



Tags:

return:   Manufacturers retrieved from the server
access:   public


[ Top ]

method getModels [line 484]

string[] getModels( [$parameters $parameters = array()])

Gets a list of devices models



Tags:

return:   Models retrieved from the server
access:   public


Parameters:

$parameters   $parameters   string[] of possible parameters to retrieve filtered models

[ Top ]

method getProtocols [line 546]

string[] getProtocols( )

Gets a list of supported protocols to be used with links



Tags:

return:   Protocols retrieved from the server
access:   public


[ Top ]

method httpRequest [line 768]

void httpRequest( $url, [array $get_variables = null], [array $post_variables = null], [array $headers = null])

Perform HTTP request



Tags:

access:   protected


Parameters:

array   $get_variables  
array   $post_variables  
array   $headers  
   $url  

[ Top ]

method nearestRadio [line 356]

mixed nearestRadio( $node_id $node_id, [$parameters $parameters = array()])

Searches the nearest radios from a given node



Tags:

return:   Nearest radios from a given node
access:   public


Parameters:

$node_id   $node_id   Node where to find the nearest radios
$parameters   $parameters   Parameters such as maximum or minimum distance

[ Top ]

method nearestZone [line 135]

mixed nearestZone( $lat $lat, $lon $lon)

Gets the zone which can contain a certain point



Tags:

return:   Nearest zones which can contain a certain point
access:   public


Parameters:

$lat   $lat   Latitude of the point
$lon   $lon   Longitude of the point

[ Top ]

method parseResponse [line 674]

mixed parseResponse( $response $response)

Parses a response from the server, according ti the input format



Tags:

return:   Returns the body of the response in case of success, false in case of failure
access:   protected


Parameters:

$response   $response   Response string to be parsed

[ Top ]

method removeDevice [line 273]

boolean removeDevice( $device_id $device_id)

Removes a guifi device from a node



Tags:

return:   Whether the device was removed or not
access:   public


Parameters:

$device_id   $device_id   ID of the device which should be removed

[ Top ]

method removeInterface [line 402]

boolean removeInterface( $interface_id $interface_id)

Removes a guifi interface from a radio



Tags:

return:   Whether the interface was removed or not
access:   public


Parameters:

$interface_id   $interface_id   ID of the interface to be removed

[ Top ]

method removeLink [line 469]

boolean removeLink( $link_id $link_id)

Removes a link from guifi.net



Tags:

return:   Whether the link was removed or not
access:   public


Parameters:

$link_id   $link_id   Link ID to be removed

[ Top ]

method removeNode [line 209]

boolean removeNode( $zone_id $node_id)

Removes a guifi node



Tags:

return:   Whether the node was removed or not
access:   public


Parameters:

$zone_id   $node_id   ID of the node which should be removed

[ Top ]

method removeRadio [line 339]

boolean removeRadio( $device_id $device_id, $radiodev_counter $radiodev_counter)

Removes a guifi radio from a device



Tags:

return:   Whether the radio was removed or not
access:   public


Parameters:

$device_id   $device_id   ID of the device where the radio to be removed is
$radiodev_counter   $radiodev_counter   Position within the device where the radio is

[ Top ]

method removeZone [line 119]

boolean removeZone( $zone_id $zone_id)

Removes a guifi zone



Tags:

return:   Whether the zone was removed or not
access:   public


Parameters:

$zone_id   $zone_id   ID of the zone which should be removed

[ Top ]

method sendRequest [line 650]

mixed sendRequest( $url $url, $variables $variables)

Performs the request to the guifi.net API server



Tags:

return:   response from the API server
access:   protected


Parameters:

$url   $url   URL to send the request to
$variables   $variables   Variables to be formatted to be sent to the server

[ Top ]

method updateDevice [line 253]

boolean updateDevice( $device_id $device_id, $parameters $parameters)

Updates a guifi device



Tags:

return:   Whether the device was edited or not
access:   public


Parameters:

$device_id   $device_id   Device ID to edit
$parameters   $parameters   Parameters to edit

[ Top ]

method updateLink [line 449]

boolean updateLink( $link_id $link_id, $parameters $parameters)

Updates a guifi link



Tags:

return:   Whether the link was updated or not
access:   public


Parameters:

$link_id   $link_id   Link ID to be updated
$parameters   $parameters   Parameters of the link to be updated

[ Top ]

method updateNode [line 189]

boolean updateNode( $node_id $node_id, $parameters $parameters)

Updates a guifi node



Tags:

return:   Whether the node was edited or not
access:   public


Parameters:

$node_id   $node_id   Node ID to edit
$parameters   $parameters   Parameters to edit

[ Top ]

method updateRadio [line 317]

boolean updateRadio( $device_id $device_id, $radiodev_counter $radiodev_counter, $parameters)

Updates a guifi radio of a device



Tags:

return:   Whether the radio was updated or not
access:   public


Parameters:

$device_id   $device_id   Device ID of the radio to be updated
$radiodev_counter   $radiodev_counter   Position within the device where the radio is location
   $parameters  

[ Top ]

method updateZone [line 99]

boolean updateZone( $zone_id $zone_id, $parameters $parameters)

Updates a guifi zone



Tags:

return:   Whether the zone was edited or not
access:   public


Parameters:

$zone_id   $zone_id   Zone ID to edit
$parameters   $parameters   Parameters to edit

[ Top ]


Class Constants

dev_mode =  false

[line 37]

Whether the class is using the Development mode or not


[ Top ]

http_interface =  'auto'

[line 19]

Which is the HTTP interface used by PHP to open HTTP connections (either curl, fopen or autodetection)


[ Top ]

input_format =  'json'

[line 43]

What is the input format of the incoming responses from the API


[ Top ]

output_format =  'get'

[line 49]

What is the output format of the outcoming parameters to the API


[ Top ]



Documentation generated on Sun, 10 Jan 2010 21:02:50 +0100 by phpDocumentor 1.4.3