Check Services Available; Api Coding - Dovado pro tinyac Reference Manual

Universal broadband router
Table of Contents

Advertisement

30
Reference Manual 8.0.0
>> sms del 1
>>
5.8

Check services available

Services available in current session:
To display which services that are available in current session, execute the command:
services
It will respond with the services (Home Automation and SMS) that are currently available
Example:
HOMEAUTOMATION=enabled
SMS=enabled
5.9

API Coding

The API can easily be extended with a custom front-end. When implementing a front-end, mind the
following:
The router might be behind a high-latency connection. Set a high timeout for your connection.
When logging in to the API, the password must be encoded either ISO-8859-1or UTF-8
When executing a command (for example ts aliases), each line of output from the API is
terminated with LF (Line Feed, ASCII character 10d) and the last line of output from the
command is ETB (End of Transmission Block, ASCII character 23d).
Since there can only be one instance of the API running on the Router, a session that has been
inactive for more than 60 seconds will be dropped in favor of a new session.
5.9.1
Example code
API example code for different platforms are available on http://www.dovado.mobi/
5.9.1.1
PHP
Below is a sample php script that will connect to the router and then send a SMS via the API
<?php
error_reporting(E_ALL);
echo "Code example on how to send a SMS via the Dovado router API\n";
/* The following variables are set
$username= your username to the router with API access
$password= your password for the above username
$ipaddress = ipaddress of your router
$api_port = 6435;
$smsnr = Number to send SMS to
$smstxt = Message content for your SMS
*/
$username = "admin";
$password = "password";
$api_port = 6435;
$ipaddress = ('192.168.0.1');
$smsnr = "Enter your phonenumber in international format (4670000000)";
$smstxt = "Enter Text Here";
$readbuf = '';
/* Function to wait for >> answers */
function respons_wait($insocket)
{
do {
$readbuf = socket_read($insocket, 4096, PHP_BINARY_READ) ;
}while (strpos($readbuf,'>>') === false);
$readbuf = '';
}
T h e M o b il e C h o ic e f o r y o u r B r o a d b a n d I n t e r n e t
© 2015 Dovado FZ-LLC

Advertisement

Table of Contents
loading

Table of Contents