User Tools

Site Tools


uphp:functions

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
uphp:functions [2019/02/26 04:34]
admin
uphp:functions [2022/09/23 04:53]
admin
Line 3: Line 3:
 uPHP functions have an identical syntax to PHP functions in most cases. Below is a list of all the functions that have been implemented. uPHP functions have an identical syntax to PHP functions in most cases. Below is a list of all the functions that have been implemented.
  
-Click on the function name for further details: +Certain additional functions are available as WattmonOS include files.  For a list of these see [[.library_functions:library_functions]].
- +
-^FUNCTION NAME^PARAMETER(S)^RETURN^DESCRIPTION^ +
-|[[.functions:adc_read]]|<html><span style="color:green">int<span style="color:blue"> channel</html>|<html><span style="color:green">int<span style="color:black"> ADC value</html>|Read an onboard <tooltip title="Analog to Digital Converter">ADC</tooltip> <html><span style="color:blue">channel</html>+
-|[[.functions:array]]|<html><span style="color:green">mixed<span style="color:blue"> values<span style="color:black"> ...</html>|<html><span style="color:green">array</html>|<html>Create an <span style="color:green">array<span style="color:black">, with optional <html><span style="color:blue">values</html>+
-|[[.functions:array_key]]|<html><span style="color:green">array<span style="color:black">, <span style="color:green"> int<span style="color:blue"> index</html>|<html><span style="color:green">string<span style="color:black"> key</html>|<html>Return the key for an <span style="color:green">array <span style="color:blue">index</html>+
-|[[.functions:array_keys]]|<html><span style="color:green">array<span style="color:black"> with key/value pairs</html>|<html><span style="color:green">array<span style="color:black"> of keys</html>|<html>Return keys for an <span style="color:green">array<span style="color:black"> that has key/value pairs</html>+
-|[[.functions:base64_decode]]|<html><span style="color:green">string<span style="color:blue"> base64</html>|<html><span style="color:green">string<span style="color:black"> decoded or <span style="color:green">int<span style="color:black"> 0</html>|<html>Decode a base64-encoded <span style="color:green">string</html>+
-|[[.functions:base64_encode]]|<html><span style="color:green">string<span style="color:black"> to encode</html>|<html><span style="color:green">string<span style="color:black"> base64 or <span style="color:green">int<span style="color:black"> 0</html>|<html>Return the base64-encoded version of a <span style="color:green">string</html>+
-|[[.functions:call_user_func]]|<html><span style="color:green">string<span style="color:blue"> function_name<span style="color:black">,<span style="color:green"> mixed<span style="color:blue"> parameters<span style="color:black"> ...</html>|<html><span style="color:green">mixed<span style="color:black"> result</html>|<html>Call a user defined function with optional <span style="color:blue">parameters</html>+
-|[[.functions:charat]]|<html><span style="color:green">string<span style="color:black">,<span style="color:green"> int<span style="color:blue"> index</html>|<html><span style="color:green">int<span style="color:black"> ASCII code</html>|<html>Return the ASCII code for a character in a <span style="color:green">string<span style="color:black"> at an<span style="color:blue"> index</html>+
-|[[.functions:chdir]]|<html><span style="color:green">string<span style="color:blue"> directory</html>|<html><span style="color:green">int<span style="color:black"> 0=OK</html>|Change the current directory| +
-|[[.functions:chr]]|<html><span style="color:green">int<span style="color:blue"> code</html>|<html><span style="color:green">string<span style="color:black"> 1 character</html>|<html>Return the character for an ASCII <span style="color:blue">code</html>+
-|[[.functions:clear_watchdog]]|||Clear the software watchdog timer| +
-|[[.functions:cos]]|<html><span style="color:green">number<span style="color:blue"> radian_angle</html>|<html><span style="color:green">float<span style="color:black"> cosine</html>|<html>Return cosine of a <span style="color:blue">radian_angle</html>+
-|[[.functions:debug]]|<html><span style="color:green">string<span style="color:blue"> output</html>||Print to debug output| +
-|[[.functions:debugout]]|<html><span style="color:green">int<span style="color:blue"> 0 or 1</html>||Enable or disable debug messages| +
-|[[.functions:die]]|||Kill the script| +
-|[[.functions:disk_free_space]]||<html><span style="color:green">int<span style="color:black"> KiloBytes</html>|Return free space on microSD card| +
-|[[.functions:disk_total_space]]||<html><span style="color:green">int<span style="color:black"> KiloBytes</html>|Return total space on microSD card| +
-|[[.functions:error_reporting]]|<html><span style="color:green">int<span style="color:blue"> verbosity</html>||Set the debug output level| +
-|[[.functions:exec]]|<html><span style="color:green">string<span style="color:blue"> script<span style="color:black">,<span style="color:green"> int<span style="color:blue"> delay</html>||<html>Run a <span style="color:blue">script<span style="color:black"> with an optional <span style="color:blue">delay</html>+
-|[[.functions:exec_action]]|<html><span style="color:green">mixed<span style="color:blue"> action</html>|<html><span style="color:green">int<span style="color:black"> 1=OK</html>|<html>Triggers a manually executable <span style="color:blue">action<span style="color:black"> by id or name</html>+
-|[[.functions:explode]]|<html><span style="color:green">string<span style="color:black">,<span style="color:green"> string<span style="color:blue"> delimiter</html>|<html><span style="color:green">array</html>|<html>Turn a <span style="color:green">string<span style="color:black"> into an <span style="color:green">array</html>+
-|[[.functions:f485open]]|<html><span style="color:green">int<span style="color:blue"> baud<span style="color:black">,<span style="color:green"> int<span style="color:blue"> parity</html>|<html><span style="color:green">int<span style="color:black"> handle or 0</html>|<html>Open the RS-485 port at the specified <span style="color:blue">baud<span style="color:black"> rate and <span style="color:blue">parity</html>+
-|[[.functions:fclose]]|<html><span style="color:green">int<span style="color:blue"> handle</html>||Close a file, stream or socket| +
-|[[.functions:feof]]|<html><span style="color:green">int<span style="color:blue"> handle</html>|<html><span style="color:green">int<span style="color:black"> 1 or 0</html>|Test if no more data is available in a file, stream or socket| +
-|[[.functions:fgets]]|<html><span style="color:green">int<span style="color:blue"> handle<span style="color:black">,<span style="color:green"> int<span style="color:blue"> size</html>|<html><span style="color:green">string<span style="color:black"> or <span style="color:green">int<span style="color:black"> -1</html>|<html>Return a single line from a file, stream or socket, with optional <span style="color:blue">size<span style="color:black"> limit</html>+
-|[[.functions:file_exists]]|<html><span style="color:green">string<span style="color:blue"> filename</html>|<html><span style="color:green">int<span style="color:black"> 1 or 0</html>|Check if a file exists| +
-|[[.functions:filesize]]|<html><span style="color:green">string<span style="color:blue"> filename<span style="color:black"> or<span style="color:green"> int<span style="color:blue"> handle</html>|<html><span style="color:green">int<span style="color:black"> bytes</html>|Return the size of a file, or the number of unread bytes in a stream or socket| +
-|[[.functions:findfirst]]|<html><span style="color:green">string<span style="color:blue"> pattern<span style="color:black">,<span style="color:green"> int<span style="color:blue"> attributes</html>|<html><span style="color:green">array<span style="color:black"> first file found</html>|<html>Start searching the current folder for files matching a <span style="color:blue">pattern<span style="color:black"> and <span style="color:blue">attributes</html>+
-|[[.functions:findnext]]||<html><span style="color:green">array<span style="color:black"> next file found</html>|Return next matching file information (after a findfirst)| +
-|[[.functions:firmwareupdate]]|||Initiate a firmware update sequence and reboot the device| +
-|[[.functions:floatval]]|<html><span style="color:green">mixed<span style="color:blue"> value</html>|<html><span style="color:green">float<span style="color:black"> value or <span style="color:green">int<span style="color:black"> 0/1</html>|<html>Return the <span style="color:green">float<span style="color:black"> value of a <span style="color:green">number<span style="color:black"> or <span style="color:green">string</html>+
-|[[.functions:flush]]|<html><span style="color:green">socket<span style="color:black"> socket to flush</html>||Flush current output or socket to the browser| +
-|[[.functions:fopen]]|<html><span style="color:green">string<span style="color:blue"> filename<span style="color:black">,<span style="color:green"> string<span style="color:blue"> mode</html>|<html><span style="color:green">int<span style="color:black"> handle or 0</html>|Open a file for reading or writing| +
-|[[.functions:fread]]|<html><span style="color:green">int<span style="color:blue"> handle<span style="color:black">,<span style="color:green"> int<span style="color:blue"> bytes</html>|<html><span style="color:green">string<span style="color:black"> or <span style="color:green">int<span style="color:black"> 0</html>|<html>Read <span style="color:blue">bytes<span style="color:black"> from a file, stream or socket</html>+
-|[[.functions:freemem]]||<html><span style="color:green">int<span style="color:black"> bytes</html>|Return free memory space| +
-|[[.functions:freestack]]||<html><span style="color:green">int<span style="color:black"> bytes</html>|Return free stack space| +
-|[[.functions:fseek]]|<html><span style="color:green">int<span style="color:blue"> handle<span style="color:black">,<span style="color:green"> int<span style="color:blue"> offset<span style="color:black">,<span style="color:green"> int<span style="color:blue"> whence</html>||Position the file pointer in an open file| +
-|[[.functions:fseropen]]|<html><span style="color:green">int<span style="color:blue"> baud<span style="color:black">,<span style="color:green"> int<span style="color:blue"> blocking<span style="color:black">,<span style="color:green"> int<span style="color:blue"> invert<span style="color:black">,<span style="color:green"> int<span style="color:blue"> parity</html>|<html><span style="color:green">int<span style="color:black"> handle or 0</html>|<html>Open the serial port at the specified <span style="color:blue">baud<span style="color:black"> rate with optional parameters</html>+
-|[[.functions:fsockopen]]|<html><span style="color:green">string<span style="color:blue"> host<span style="color:black">,<span style="color:green"> int<span style="color:blue"> port<span style="color:black">,<span style="color:green"> int<span style="color:blue"> timeout</html>|<html><span style="color:green">int<span style="color:black"> handle or 0</html>|<html>Open an internet socket connection with optional <span style="color:blue">timeout</html>+
-|[[.functions:ftell]]|<html><span style="color:green">int<span style="color:blue"> handle</html>|<html><span style="color:green">int<span style="color:black"> position</html>|Return the current position of a file read/write pointer| +
-|[[.functions:function_exists]]|<html><span style="color:green">string<span style="color:blue"> function_name</html>|<html><span style="color:green">int<span style="color:black"> 1 or 0</html>|Check if a function exists (custom or native)| +
-|[[.functions:fwrite]]|<html><span style="color:green">int<span style="color:blue"> handle<span style="color:black">, <span style="color:green">mixed <span style="color:blue">data<span style="color:black">, <span style="color:green">int <span style="color:blue">length</html>|<html><span style="color:green">int<span style="color:black"> bytes written or -1</html>|<html>Write <span style="color:blue">data<span style="color:black"> to a file, stream or socket</html>+
-|[[.functions:get3gstat]]||<html><span style="color:green">array</html>|Get cellular data connection status information| +
-|[[.functions:getcwd]]||<html><span style="color:green">string<span style="color:black"> path</html>|Get the current directory| +
-|[[.functions:getethstat]]||<html><span style="color:green">array</html>|Get Ethernet connection status information| +
-|[[.functions:getmac]]||<html><span style="color:green">string<span style="color:black"> MAC</html>|Get the Wattmon's MAC address| +
-|[[.functions:getusbstat]]||<html><span style="color:green">array</html>|Get USB host status information| +
-|[[.functions:header]]|<html><span style="color:green">string<span style="color:blue"> header_data</html>||Add to HTTP header| +
-|[[.functions:htmlspecialchars]]|<html><span style="color:green">string<span style="color:blue"> data</html>|<html><span style="color:green">string<span style="color:black"> converted</html>|Convert special characters for display in HTML| +
-|[[.functions:ieee754toint]]|<html><span style="color:green">float <span style="color:blue">value</html>|<html><span style="color:green">int<span style="color:black"> representation</html>|<html>Convert a <span style="color:green">float <span style="color:blue">value<span style="color:black"> to an IEEE-754 encoded <span style="color:green">integer<span style="color:black"> (32 bit)</html>+
-|[[.functions:implode]]|<html><span style="color:green">array<span style="color:black">,<span style="color:green"> string<span style="color:blue"> delimiter</html>|<html><span style="color:green">string</html>|<html>Turn an <span style="color:green">array<span style="color:black"> into a <span style="color:green">string</html>+
-|[[.functions:include]]|<html><span style="color:green">string<span style="color:blue"> filename</html>||Include a file within the current script at the current location| +
-|[[.functions:indexed_array]]|<html><span style="color:green">int<span style="color:blue"> type<span style="color:black">,<span style="color:green"> int<span style="color:blue"> size</html>|<html><span style="color:green">array</html>|<html>Create an <span style="color:green">array<span style="color:black"> of a specific <span style="color:blue">type<span style="color:black"> and <span style="color:blue">size</html>+
-|[[.functions:ini_get]]|<html><span style="color:green">string<span style="color:blue"> filename<span style="color:black">,<span style="color:green"> string<span style="color:blue"> section<span style="color:black">,<span style="color:green"> string<span style="color:blue"> key<span style="color:black">,<span style="color:green"> mixed<span style="color:blue"> default</html>|<html><span style="color:green">mixed<span style="color:black"> value</html>|Get a value from an INI file| +
-|[[.functions:ini_get_array]]|<html><span style="color:green">string<span style="color:blue"> filename<span style="color:black">,<span style="color:green"> string<span style="color:blue"> section</html>|<html><span style="color:green">array</html>|Get a group of parameters from an INI file as an <html><span style="color:green">array<span style="color:black"></html>+
-|[[.functions:ini_put_array]]|<html><span style="color:green">string<span style="color:blue"> filename<span style="color:black">,<span style="color:green"> array<span style="color:blue"> data<span style="color:black">,<span style="color:green"> string<span style="color:blue"> section</html>||Write a group of parameters to an INI file from an <html><span style="color:green">array<span style="color:black"></html>+
-|[[.functions:ini_set]]|<html><span style="color:green">string<span style="color:blue"> filename<span style="color:black">,<span style="color:green"> string<span style="color:blue"> section<span style="color:black">,<span style="color:green"> string<span style="color:blue"> key<span style="color:black">,<span style="color:green"> mixed<span style="color:blue"> value</html>|<html><span style="color:green">int<span style="color:black"> 1=OK</html>|Set a <html><span style="color:blue">value<span style="color:black"></html> in an INI file| +
-|[[.functions:init_watchdog]]|<html><span style="color:green">int <span style="color:blue">interval</html>||<html>Initialize the software watchdog timer</html>+
-|[[.functions:inttoieee754]]|<html><span style="color:green">int <span style="color:blue">representation</html>|<html><span style="color:green">float<span style="color:black"> value</html>|<html>Convert an IEEE-754 encoded <span style="color:green">integer <span style="color:blue">representation<span style="color:black"> (32 bit) to a <span style="color:green">float</html>+
-|[[.functions:intval]]|<html><span style="color:green">mixed<span style="color:blue"> value</html>|<html><span style="color:green">int<span style="color:black"> value</html>|<html>Return the <span style="color:green">integer<span style="color:black"> value of a <span style="color:green">number<span style="color:black"> or <span style="color:green">string</html>+
-|[[.functions:is_array]]|<html><span style="color:green">mixed<span style="color:blue"> variable</html>|<html><span style="color:green">int<span style="color:black"> 1 or 0</html>|<html>Check if a <span style="color:blue">variable<span style="color:black"> is an <span style="color:green">array</html>+
-|[[.functions:is_float]]|<html><span style="color:green">mixed<span style="color:blue"> variable</html>|<html><span style="color:green">int<span style="color:black"> 1 or 0</html>|<html>Check if a <span style="color:blue">variable<span style="color:black"> is a <span style="color:green">float</html>+
-|[[.functions:is_int]]|<html><span style="color:green">mixed<span style="color:blue"> variable</html>|<html><span style="color:green">int<span style="color:black"> 1 or 0</html>|<html>Check if a <span style="color:blue">variable<span style="color:black"> is an <span style="color:green">integer</html>+
-|[[.functions:is_numeric]]|<html><span style="color:green">mixed<span style="color:blue"> value</html>|<html><span style="color:green">int<span style="color:black"> 1 or 0</html>|<html>Check if a <span style="color:blue">value<span style="color:black"> is numeric (<span style="color:green">int<span style="color:black">, <span style="color:green">float<span style="color:black"> or numeric <span style="color:green">string)</html>+
-|[[.functions:is_string]]|<html><span style="color:green">mixed<span style="color:blue"> variable</html>|<html><span style="color:green">int<span style="color:black"> 1 or 0</html>|<html>Check if a <span style="color:blue">variable<span style="color:black"> is a <span style="color:green">string</html>+
-|[[.functions:isset]]|<html><span style="color:green">mixed<span style="color:blue"> variable</html>|<html><span style="color:green">int<span style="color:black"> 1 or 0</html>|<html>Check if a <span style="color:blue">variable<span style="color:black"> exists</html>+
-|[[.functions:json_encode]]|<html><span style="color:green">array<span style="color:black">,<span style="color:green"> int<span style="color:blue"> method</html>|<html><span style="color:green">string</html>|<html>JSON encode an <span style="color:green">array<span style="color:black"> into a <span style="color:green">string<span style="color:black">, with optional <span style="color:blue">method</html>+
-|[[.functions:ln]]|<html><span style="color:green">number<span style="color:blue"> number</html>|<html><span style="color:green">float<span style="color:black"> log<sub>e</sub></html>|Return the natural logarithm of a <html><span style="color:blue">number</html>+
-|[[.functions:log]]|<html><span style="color:green">string<span style="color:blue"> output<span style="color:black">,<span style="color:green"> string<span style="color:blue"> file</html>||<html>Print to the System Log (or optional <span style="color:blue">file<span style="color:black">)</html>+
-|[[.functions:log10]]|<html><span style="color:green">number<span style="color:blue"> number</html>|<html><span style="color:green">float<span style="color:black"> log<sub>10</sub></html>|Return the base 10 logarithm of a <html><span style="color:blue">number</html>+
-|[[.functions:mail]]|<html><span style="color:green">string<span style="color:blue"> recipient<span style="color:black">,<span style="color:green"> string<span style="color:blue"> subject<span style="color:black">,<span style="color:green"> string<span style="color:blue"> body</html>|<html><span style="color:green">int<span style="color:black"> 0 or SMTP error code</html>|Send an email [deprecated]| +
-|[[.functions:max_execution_time]]|<html><span style="color:green">int<span style="color:blue"> seconds</html>||Set the maximum execution time for the current script| +
-|[[.functions:mb_add_dev]]|<html><span style="color:green">int<span style="color:blue"> id<span style="color:black">,<span style="color:green"> int<span style="color:blue"> type<span style="color:black">,<span style="color:green"> string<span style="color:blue"> name<span style="color:black">,<span style="color:green"> int<span style="color:blue"> poll_interval<span style="color:black">,<span style="color:green"> int<span style="color:blue"> status<span style="color:black">,<span style="color:green"> int<span style="color:blue"> bus</html>|<html><span style="color:green">int<span style="color:black"> 0=OK</html>|Add device to the list of polled devices| +
-|[[.functions:mb_delete_device]]|<html><span style="color:green">int<span style="color:blue"> id</html>|<html><span style="color:green">int<span style="color:black"> 1=OK</html>|Delete a device from the list of active devices| +
-|[[.functions:mb_get_dev_by_id]]|<html><span style="color:green">int<span style="color:blue"> id</html>|<html><span style="color:green">array</html>|Return modbus device details by <html><span style="color:blue">id</html>+
-|[[.functions:mb_get_dev_by_index]]|<html><span style="color:green">int<span style="color:blue"> index</html>|<html><span style="color:green">array</html>|Return modbus device details by <html><span style="color:blue">index</html>+
-|[[.functions:mb_get_dev_by_name]]|<html><span style="color:green">string<span style="color:blue"> name</html>|<html><span style="color:green">array</html>|Return modbus device details by <html><span style="color:blue">name</html>+
-|[[.functions:mb_get_dev_info]]|<html><span style="color:green">int<span style="color:blue"> type</html>|<html><span style="color:green">array</html>|Return modbus device details by <html><span style="color:blue">type</html>+
-|[[.functions:mb_get_role_array]]||<html><span style="color:green">array</html>|Return an <html><span style="color:green">array<span style="color:black"></html> of all roles and their values| +
-|[[.functions:mb_get_status_by_role]]|<html><span style="color:green">int<span style="color:blue"> role</html>|<html><span style="color:green">int<span style="color:black"> 1=OK</html>|Return status of the device attached to the <html><span style="color:blue">role</html>+
-|[[.functions:mb_get_val_by_role]]|<html><span style="color:green">int<span style="color:blue"> role</html>|<html><span style="color:green">number</html>|Return value of the <html><span style="color:blue">role</html>+
-|[[.functions:mb_num_devices]]||<html><span style="color:green">int</html>|Return number of devices on the modbus| +
-|[[.functions:mb_queue_command]]|<html><span style="color:green">mixed<span style="color:blue"> values<span style="color:black"> ...</html>|<html><span style="color:green">array<span style="color:black"> of numbers</html>|Queue a sequence of characters to the RS-485 bus and get but ignore the reply| +
-|[[.functions:mb_scan_complete]]||<html><span style="color:green">int<span style="color:black"> 1=complete, 0=ongoing</html>|Check to see if a modbus scan has completed| +
-|[[.functions:mb_scan_percent]]||<html><span style="color:green">number<span style="color:black"> percent completed</html>|Return scan percentage completed| +
-|[[.functions:mb_send_command]]|<html><span style="color:green">mixed<span style="color:blue"> values<span style="color:black"> ...</html>|<html><span style="color:green">array<span style="color:black"> of numbers</html>|Send a sequence of characters to the RS-485 bus and get a reply| +
-|[[.functions:mb_set_dev_var]]|<html><span style="color:green">string<span style="color:blue"> name<span style="color:black"> or<span style="color:green"> int<span style="color:blue"> id<span style="color:black">,<span style="color:green"> string<span style="color:blue"> variable<span style="color:black">,<span style="color:green"> mixed<span style="color:blue"> value</html>|<html><span style="color:green">int<span style="color:black"> 1=OK</html>|Set a <html><span style="color:blue">variable<span style="color:black"></html> on a modbus device| +
-|[[.functions:mb_set_val_by_role]]|<html><span style="color:green">int<span style="color:blue"> role<span style="color:black">,<span style="color:green"> number<span style="color:blue"> value</html>|<html><span style="color:green">int<span style="color:black"> 1=OK</html>|Set a <html><span style="color:blue">role value<span style="color:black"></html> on a modbus device| +
-|[[.functions:mb_start_scan]]|<html><span style="color:green">int<span style="color:blue"> start<span style="color:black">,<span style="color:green"> int<span style="color:blue"> end</html>||Initiate an automatic scan of the modbus| +
-|[[.functions:md5]]|<html><span style="color:green">string<span style="color:blue"> input</html>|<html><span style="color:green">string<span style="color:black"> 32 characters</html>|Calculate the MD5 hash of a <html><span style="color:green">string</html>+
-|[[.functions:md5_file]]|<html><span style="color:green">string<span style="color:blue"> filename</html>|<html><span style="color:green">string<span style="color:black"> 32 characters</html>|Calculate the MD5 hash of a file| +
-|[[.functions:mem_dump]]|||Write the current memory map to /dump.txt| +
-|[[.functions:mem_usage]]|||Write memory usage to standard output| +
-|[[.functions:microtime]]||<html><span style="color:green">int<span style="color:black"> ms</html>|Return the number of milliseconds since boot| +
-|[[.functions:mkdir]]|<html><span style="color:green">string<span style="color:blue"> pathname</html>|<html><span style="color:green">int<span style="color:black"> 0 or error code</html>|Make a directory| +
-|[[.functions:mktime]]|<html><span style="color:green">int<span style="color:blue"> hour<span style="color:black">,<span style="color:green"> int<span style="color:blue"> minute<span style="color:black">,<span style="color:green"> int<span style="color:blue"> second<span style="color:black">,<span style="color:green"> int<span style="color:blue"> month<span style="color:black">,<span style="color:green"> int<span style="color:blue"> day<span style="color:black">,<span style="color:green"> int<span style="color:blue"> year</html>|<html><span style="color:green">int<span style="color:black"> seconds</html>|Return the Linux Timestamp for a given date and time| +
-|[[.functions:mqtt_publish]]|<html><span style="color:green">string<span style="color:blue"> channel</html>, <html><span style="color:green">string<span style="color:blue"> content</html>|<html><span style="color:green">int<span style="color:black"> 1 for success or 0 for error</html>|Publish a message to an MQTT server| +
-|[[.functions:mqtt_subscribe]]|<html><span style="color:green">string<span style="color:blue"> channel</html>, <html><span style="color:green">string<span style="color:blue"> callback</html>|<html><span style="color:green">int<span style="color:black"> 1 for success or 0 for error</html>|Subscribe to a channel on an MQTT server| +
-|[[.functions:net_disable3g]]|||Disable 3G support for the dongle| +
-|[[.functions:net_enable3g]]|||Enable 3G support for the dongle| +
-|[[.functions:netstat]]||<html><span style="color:green">array</html>|Get Ethernet information| +
-|[[.functions:number_format]]|<html><span style="color:green">mixed <span style="color:blue">number<span style="color:black">,<span style="color:green"> int<span style="color:blue"> digits</html>|<html><span style="color:green">string<span style="color:black"> formatted</html>|<html>Return the <span style="color:green">string<span style="color:black"> value of a <span style="color:blue">number<span style="color:black"> formatted to a particular precision</html>+
-|[[.functions:nvram_backup]]|<html><span style="color:green">string<span style="color:blue"> filename</html>|<html><span style="color:green">int<span style="color:black"> bytes written or 0=error</html>|Backup the contents of <tooltip title="Non-Volatile RAM">NVRAM</tooltip> to a file on the SD Card| +
-|[[.functions:nvram_defrag]]|||Defragment <tooltip title="Non-Volatile RAM">NVRAM</tooltip> to optimise it| +
-|[[.functions:nvram_dump]]|||Dump the contents of <tooltip title="Non-Volatile RAM">NVRAM</tooltip> to standard output| +
-|[[.functions:nvram_free]]||<html><span style="color:green">int<span style="color:black"> bytes</html>|Return the number of bytes available in <tooltip title="Non-Volatile RAM">NVRAM</tooltip>+
-|[[.functions:nvram_get]]|<html><span style="color:green">string<span style="color:blue"> key</html>|<html><span style="color:green">mixed<span style="color:black"> value</html>|Get a value from <tooltip title="Non-Volatile RAM">NVRAM</tooltip>+
-|[[.functions:nvram_restore]]|<html><span style="color:green">string <span style="color:blue">filename</html>||Restore the contents of <tooltip title="Non-Volatile RAM">NVRAM</tooltip> from a file| +
-|[[.functions:nvram_set]]|<html><span style="color:green">string<span style="color:blue"> key<span style="color:black">,<span style="color:green"> string<span style="color:blue"> value</html>|<html><span style="color:green">int<span style="color:black"> 1=OK</html>|<html>Set a <span style="color:blue">key<span style="color:black"> and <span style="color:blue">value<span style="color:black"> in </html><tooltip title="Non-Volatile RAM">NVRAM</tooltip>+
-|[[.functions:nvram_unset]]|<html><span style="color:green">string<span style="color:blue"> key</html>|<html><span style="color:green">int<span style="color:black"> 1=OK</html>|Clear a <html><span style="color:blue">key<span style="color:black"></html> from <tooltip title="Non-Volatile RAM">NVRAM</tooltip>+
-|[[.functions:ord]]|<html><span style="color:green">string<span style="color:blue"> character</html>|<html><span style="color:green">int<span style="color:black"> ASCII code</html>|Return the ASCII code for a <html><span style="color:blue">character</html>+
-|[[.functions:ow_first]]||<html><span style="color:green">array<span style="color:black"> or <span style="color:green">int<span style="color:black"> 0</html>|Initiate a OneWire bus scan and return the address of the first device found| +
-|[[.functions:ow_next]]||<html><span style="color:green">array<span style="color:black"> or <span style="color:green">int<span style="color:black"> 0</html>|Return the address of the next OneWire device found (after an ow_first)| +
-|[[.functions:ow_read]]||<html><span style="color:green">int<span style="color:black"> value or 0</html>|Read a byte from the OneWire bus| +
-|[[.functions:ow_read_temp]]|<html><span style="color:green">array<span style="color:blue"> device_id</html>|<html><span style="color:green">float<span style="color:black"> degrees Celsius</html>|Read a temperature from a device on the OneWire bus| +
-|[[.functions:ow_reset]]|||Reset the OneWire bus| +
-|[[.functions:ow_write]]|<html><span style="color:green">int<span style="color:blue"> value</html>||Write a byte to the OneWire bus| +
-|[[.functions:phpinfo]]||<html><span style="color:green">string</html>|Return information about the system| +
-|[[.functions:pin_configure]]|<html><span style="color:green">int<span style="color:blue"> pin_index<span style="color:black">,<span style="color:green"> int<span style="color:blue"> pin_type<span style="color:black">,<span style="color:green"> int<span style="color:blue"> counter_type</html>||Configure an <tooltip title="Input/Output">I/O</tooltip> pin as a digital input, output, or analog input| +
-|[[.functions:pin_get]]|<html><span style="color:green">int<span style="color:blue"> pin_index<span style="color:black">,<span style="color:green"> int<span style="color:blue"> pin_type</html>|<html><span style="color:green">int<span style="color:black"> value</html>|Return the value of an <tooltip title="Input/Output">I/O</tooltip> pin| +
-|[[.functions:pin_set]]|<html><span style="color:green">int<span style="color:blue"> pin_index<span style="color:black">,<span style="color:green"> int<span style="color:blue"> value</html>||Set a digital output to <html><span style="color:blue">value<span style="color:black"></html> 1 or 0| +
-|[[.functions:ping]]|<html><span style="color:green">string<span style="color:blue"> host</html>|<html><span style="color:green">array</html>|Send an ICMP ping and place the result in an <html><span style="color:green">array<span style="color:black"></html>+
-|[[.functions:power]]|<html><span style="color:green">number<span style="color:blue"> base<span style="color:black">,<span style="color:green"> number<span style="color:blue"> exp</html>|<html><span style="color:green">number<span style="color:blue"> base<sup>exp</sup></html>|<html>Return <span style="color:blue">base<span style="color:black"> raised to the power of <span style="color:blue">exp</html>+
-|[[.functions:print]]|<html><span style="color:green">string<span style="color:blue"> data</html>||Print <html><span style="color:blue">data<span style="color:black"></html> to the current output stream such as a web page or terminal| +
-|[[.functions:print_r]]|<html><span style="color:green">array</html>||<html>Dump the contents of an <span style="color:green">array<span style="color:black"> to the current output</html>+
-|[[.functions:printf]]|<html><span style="color:green">string<span style="color:blue"> format<span style="color:black">, <span style="color:green">mixed<span style="color:blue"> values<span style="color:black"> ...</html>||Print a formatted <html><span style="color:green">string<span style="color:black"></html> to standard output| +
-|[[.functions:process_kill]]|<html><span style="color:green">int<span style="color:blue"> pid</html>||Send a kill request to a process| +
-|[[.functions:process_list]]||<html><span style="color:green">array</html>|Return an <html><span style="color:green">array<span style="color:black"></html> of the currently running scripts| +
-|[[.functions:rand]]|<html><span style="color:green">int<span style="color:blue"> min<span style="color:black">, <span style="color:green">int<span style="color:blue"> max</html>|<html><span style="color:green">int</html>|<html>Return a random <span style="color:green">integer<span style="color:black"> between <span style="color:blue">min<span style="color:black"> and <span style="color:blue">max</html>+
-|[[.functions:reboot]]|||Reboot the processor| +
-|[[.functions:rename]]|<html><span style="color:green">string<span style="color:blue"> source<span style="color:black">, <span style="color:green">string<span style="color:blue"> destination</html>|<html><span style="color:green">int<span style="color:black"> 0 or error code</html>|<html>Rename or move a file or directory from <span style="color:blue">source<span style="color:black"> to <span style="color:blue">destination</html>+
-|[[.functions:reset]]|||Reset the processor| +
-|[[.functions:rmdir]]|<html><span style="color:green">string<span style="color:blue"> pathname<span style="color:black">,<span style="color:green"> int<span style="color:blue"> delete_contents</html>|<html><span style="color:green">int<span style="color:black"> 0=OK</html>|Remove a directory, with optional deletion of contents| +
-|[[.functions:send_sms]]|<html><span style="color:green">string<span style="color:blue"> phone_number, <span style="color:green"> string<span style="color:blue"> message</html>|<html><span style="color:green">int<span style="color:black"> result</html>|<html>sends an sms through a cellular dongle<span style="color:black"></html>+
-|[[.functions:session_destroy]]|||Clear the current session's data| +
-|[[.functions:session_is_new]]||<html><span style="color:green">int</html>|Check if a session was just initiated| +
-|[[.functions:session_start]]|||Initiate a new session and send the cookie data for it| +
-|[[.functions:set_search_path]]|<html><span style="color:green">string<span style="color:blue"> pathname</html>||Set the search path for the telnet client| +
-|[[.functions:setethpower]]|<html><span style="color:green">int<span style="color:blue"> state</html>||Enable or disable the ethernet controller| +
-|[[.functions:setpriority]]|<html><span style="color:green">int<span style="color:blue"> priority</html>||Set the <html><span style="color:blue">priority<span style="color:black"></html> of the current script| +
-|[[.functions:settime]]|<html><span style="color:green">int<span style="color:blue"> timestamp<span style="color:black">,<span style="color:green"> int<span style="color:blue"> calibration</html>||<html>Set the system time from a Linux <span style="color:blue">Timestamp<span style="color:black">, with optional <span style="color:blue">calibration</html>+
-|[[.functions:setusbpower]]|<html><span style="color:green">int<span style="color:blue"> state</html>||Enable or disable USB power| +
-|[[.functions:sha1]]|<html><span style="color:green">string<span style="color:blue"> input</html>|<html><span style="color:green">string<span style="color:black"> 40 characters</html>|Calculate the SHA1 hash of a <html><span style="color:green">string</html>+
-|[[.functions:sin]]|<html><span style="color:green">number<span style="color:blue"> radian_angle</html>|<html><span style="color:green">float<span style="color:black"> sine</html>|<html>Return sine of a <span style="color:blue">radian_angle<span style="color:black"></html>+
-|[[.functions:sizeof]]|<html><span style="color:green">array</html>|<html><span style="color:green">int<span style="color:black"> number of elements</html>|<html>Return the number of elements in an <span style="color:green">array</html>+
-|[[.functions:sleep]]|<html><span style="color:green">int<span style="color:blue"> ms</html>||Sleep for specified milliseconds| +
-|[[.functions:spi_clearcs]]|||Clear the CS output of the <tooltip title="Serial Peripheral Interface">SPI</tooltip> bus| +
-|[[.functions:spi_read]]||<html><span style="color:green">int<span style="color:black"> byte</html>|Read a byte from the <tooltip title="Serial Peripheral Interface">SPI</tooltip> bus| +
-|[[.functions:spi_setcs]]|||Set the CS output of the <tooltip title="Serial Peripheral Interface">SPI</tooltip> bus| +
-|[[.functions:spi_write]]|<html><span style="color:green">int<span style="color:blue"> byte</html>||Write a <html><span style="color:blue">byte<span style="color:black"></html> to the <tooltip title="Serial Peripheral Interface">SPI</tooltip> bus| +
-|[[.functions:sprintf]]|<html><span style="color:green">string<span style="color:blue"> format<span style="color:black">, <span style="color:green">mixed<span style="color:blue"> values<span style="color:black"> ...</html>|<html><span style="color:green">string<span style="color:black"> formatted</html>|Return a formatted <html><span style="color:green">string</html>+
-|[[.functions:sqr]]|<html><span style="color:green">number<span style="color:blue"> number</html>|<html><span style="color:green">number<span style="color:black"> squared</html>|Return the square of a <html><span style="color:blue">number</html>+
-|[[.functions:sqrt]]|<html><span style="color:green">number<span style="color:blue"> number</html>|<html><span style="color:green">number<span style="color:black"> square root</html>|Return the square root of a <html><span style="color:blue">number</html>+
-|[[.functions:stats]]||<html><span style="color:green">array</html>|Return system statistics| +
-|[[.functions:strftime]]|<html><span style="color:green">string<span style="color:blue"> format<span style="color:black">,<span style="color:green"> int<span style="color:blue"> timestamp</html>|<html><span style="color:green">string<span style="color:black"> formatted</html>|<html>Format a Linux <span style="color:blue">Timestamp<span style="color:black"> using a <span style="color:blue">format <span style="color:green">string</html>+
-|[[.functions:strlen]]|<html><span style="color:green">string<span style="color:blue"> input</html>|<html><span style="color:green">int<span style="color:black"> length</html>|Return the length of a <html><span style="color:green">string</html>+
-|[[.functions:strpos]]|<html><span style="color:green">string<span style="color:blue"> haystack<span style="color:black">, <span style="color:green">string<span style="color:blue"> needle</html>|<html><span style="color:green">int<span style="color:black"> position or -1</html>|<html>Return the position of the first occurrence of a <span style="color:blue">needle<span style="color:black"> in a <span style="color:blue">haystack<span style="color:black"></html>+
-|[[.functions:strrpos]]|<html><span style="color:green">string<span style="color:blue"> haystack<span style="color:black">, <span style="color:green">string<span style="color:blue"> needle</html>|<html><span style="color:green">int<span style="color:black"> position or -1</html>|<html>Return the position of the last occurrence of a <span style="color:blue">needle<span style="color:black"> in a <span style="color:blue">haystack<span style="color:black"></html>+
-|[[.functions:strtolower]]|<html><span style="color:green">string<span style="color:blue"> input</html>|<html><span style="color:green">string<span style="color:black"> lowercase</html>|Return the lowercase version of a <html><span style="color:green">string</html>+
-|[[.functions:strtoupper]]|<html><span style="color:green">string<span style="color:blue"> input</html>|<html><span style="color:green">string<span style="color:black"> UPPERCASE</html>|Return the UPPERCASE version of a <html><span style="color:green">string</html>+
-|[[.functions:strval]]|<html><span style="color:green">mixed<span style="color:blue"> value</html>======uPHP Reference====== +
- +
-uPHP functions have an identical syntax to PHP functions in most cases. Below is a list of all the functions that have been implemented.+
  
 Click on the function name for further details: Click on the function name for further details:
Line 174: Line 9:
 ^FUNCTION NAME^PARAMETER(S)^RETURN^DESCRIPTION^ ^FUNCTION NAME^PARAMETER(S)^RETURN^DESCRIPTION^
 |[[.functions:adc_read]]|<html><span style="color:green">int<span style="color:blue"> channel</html>|<html><span style="color:green">int<span style="color:black"> ADC value</html>|Read an onboard <tooltip title="Analog to Digital Converter">ADC</tooltip> <html><span style="color:blue">channel</html>| |[[.functions:adc_read]]|<html><span style="color:green">int<span style="color:blue"> channel</html>|<html><span style="color:green">int<span style="color:black"> ADC value</html>|Read an onboard <tooltip title="Analog to Digital Converter">ADC</tooltip> <html><span style="color:blue">channel</html>|
 +|[[.functions:aes_decrypt]]|<html><span style="color:green">string <span style="color:black">text, <span style="color:green">int <span style="color:black">length, <span style="color:green"> string<span style="color:blue"> key</html>, <html><span style="color:green">string<span style="color:black"> iv</html>|string with data|<html>Return an AES-decrypted string</html>|
 +|[[.functions:aes_encrypt]]|<html><span style="color:green">string <span style="color:black">text, <span style="color:green">int<span style="color:black"> length, <span style="color:green"> string<span style="color:blue"> key<span style="color:black">,<span style="color:green">string<span style="color:black"> iv</html>|string with data|<html>Return an AES-encrypted string</html>|
 |[[.functions:array]]|<html><span style="color:green">mixed<span style="color:blue"> values<span style="color:black"> ...</html>|<html><span style="color:green">array</html>|<html>Create an <span style="color:green">array<span style="color:black">, with optional <html><span style="color:blue">values</html>| |[[.functions:array]]|<html><span style="color:green">mixed<span style="color:blue"> values<span style="color:black"> ...</html>|<html><span style="color:green">array</html>|<html>Create an <span style="color:green">array<span style="color:black">, with optional <html><span style="color:blue">values</html>|
 |[[.functions:array_key]]|<html><span style="color:green">array<span style="color:black">, <span style="color:green"> int<span style="color:blue"> index</html>|<html><span style="color:green">string<span style="color:black"> key</html>|<html>Return the key for an <span style="color:green">array <span style="color:blue">index</html>| |[[.functions:array_key]]|<html><span style="color:green">array<span style="color:black">, <span style="color:green"> int<span style="color:blue"> index</html>|<html><span style="color:green">string<span style="color:black"> key</html>|<html>Return the key for an <span style="color:green">array <span style="color:blue">index</html>|
 |[[.functions:array_keys]]|<html><span style="color:green">array<span style="color:black"> with key/value pairs</html>|<html><span style="color:green">array<span style="color:black"> of keys</html>|<html>Return keys for an <span style="color:green">array<span style="color:black"> that has key/value pairs</html>| |[[.functions:array_keys]]|<html><span style="color:green">array<span style="color:black"> with key/value pairs</html>|<html><span style="color:green">array<span style="color:black"> of keys</html>|<html>Return keys for an <span style="color:green">array<span style="color:black"> that has key/value pairs</html>|
 +|[[.functions:array_resize]]|<html><span style="color:green">array<span style="color:black"> indexed array, <span style="color:green">int<span style="color:black"> length</html>|none|<html>Resize indexed <span style="color:green">array<span style="color:black"> </html>|
 |[[.functions:base64_decode]]|<html><span style="color:green">string<span style="color:blue"> base64</html>|<html><span style="color:green">string<span style="color:black"> decoded or <span style="color:green">int<span style="color:black"> 0</html>|<html>Decode a base64-encoded <span style="color:green">string</html>| |[[.functions:base64_decode]]|<html><span style="color:green">string<span style="color:blue"> base64</html>|<html><span style="color:green">string<span style="color:black"> decoded or <span style="color:green">int<span style="color:black"> 0</html>|<html>Decode a base64-encoded <span style="color:green">string</html>|
 |[[.functions:base64_encode]]|<html><span style="color:green">string<span style="color:black"> to encode</html>|<html><span style="color:green">string<span style="color:black"> base64 or <span style="color:green">int<span style="color:black"> 0</html>|<html>Return the base64-encoded version of a <span style="color:green">string</html>| |[[.functions:base64_encode]]|<html><span style="color:green">string<span style="color:black"> to encode</html>|<html><span style="color:green">string<span style="color:black"> base64 or <span style="color:green">int<span style="color:black"> 0</html>|<html>Return the base64-encoded version of a <span style="color:green">string</html>|
Line 188: Line 26:
 |[[.functions:debugout]]|<html><span style="color:green">int<span style="color:blue"> 0 or 1</html>||Enable or disable debug messages| |[[.functions:debugout]]|<html><span style="color:green">int<span style="color:blue"> 0 or 1</html>||Enable or disable debug messages|
 |[[.functions:die]]|||Kill the script| |[[.functions:die]]|||Kill the script|
-|[[.functions:disk_free_space]]||<html><span style="color:green">int<span style="color:black"> KiloBytes</html>|Return free space on microSD card+|[[.functions:disk_free_space]]|<html><span style="color:green">int<span style="color:blue"> drive</html>|<html><span style="color:green">int<span style="color:black"> KiloBytes</html>|Return free space on drive| 
-|[[.functions:disk_total_space]]||<html><span style="color:green">int<span style="color:black"> KiloBytes</html>|Return total space on microSD card|+|[[.functions:disk_status]]|<html><span style="color:green">int<span style="color:blue"> drive</html>|<html><span style="color:green">int<span style="color:black"> Status</html>|Return mount status of drive
 +|[[.functions:disk_total_space]]|<html><span style="color:green">int<span style="color:blue"> drive</html>|<html><span style="color:green">int<span style="color:black"> KiloBytes</html>|Return total space on drive| 
 +|[[.functions:download]]|<html><span style="color:green">string<span style="color:blue"> url</html>|<html><span style="color:green">int<span style="color:black"> res</html>|Download a file in the background| 
 +|[[.functions:download_info]]||<html><span style="color:green">array<span style="color:black"> info</html>|Get info about ongoing download| 
 +|[[.functions:download_state]]||<html><span style="color:green">int<span style="color:black"> status</html>|Get state of download|
 |[[.functions:error_reporting]]|<html><span style="color:green">int<span style="color:blue"> verbosity</html>||Set the debug output level| |[[.functions:error_reporting]]|<html><span style="color:green">int<span style="color:blue"> verbosity</html>||Set the debug output level|
 +|[[.functions:ereg]]|<html><span style="color:green">string<span style="color:blue"> pattern<span style="color:black">,<span style="color:green"> string<span style="color:blue"> content [,<span style="color:green"> &amp;array<span style="color:blue"> matches]</html>|<html><span style="color:green">int</html>|<html>Perform a regex operation</html>|
 |[[.functions:exec]]|<html><span style="color:green">string<span style="color:blue"> script<span style="color:black">,<span style="color:green"> int<span style="color:blue"> delay</html>||<html>Run a <span style="color:blue">script<span style="color:black"> with an optional <span style="color:blue">delay</html>| |[[.functions:exec]]|<html><span style="color:green">string<span style="color:blue"> script<span style="color:black">,<span style="color:green"> int<span style="color:blue"> delay</html>||<html>Run a <span style="color:blue">script<span style="color:black"> with an optional <span style="color:blue">delay</html>|
 |[[.functions:exec_action]]|<html><span style="color:green">mixed<span style="color:blue"> action</html>|<html><span style="color:green">int<span style="color:black"> 1=OK</html>|<html>Triggers a manually executable <span style="color:blue">action<span style="color:black"> by id or name</html>| |[[.functions:exec_action]]|<html><span style="color:green">mixed<span style="color:blue"> action</html>|<html><span style="color:green">int<span style="color:black"> 1=OK</html>|<html>Triggers a manually executable <span style="color:blue">action<span style="color:black"> by id or name</html>|
Line 199: Line 42:
 |[[.functions:fgets]]|<html><span style="color:green">int<span style="color:blue"> handle<span style="color:black">,<span style="color:green"> int<span style="color:blue"> size</html>|<html><span style="color:green">string<span style="color:black"> or <span style="color:green">int<span style="color:black"> -1</html>|<html>Return a single line from a file, stream or socket, with optional <span style="color:blue">size<span style="color:black"> limit</html>| |[[.functions:fgets]]|<html><span style="color:green">int<span style="color:blue"> handle<span style="color:black">,<span style="color:green"> int<span style="color:blue"> size</html>|<html><span style="color:green">string<span style="color:black"> or <span style="color:green">int<span style="color:black"> -1</html>|<html>Return a single line from a file, stream or socket, with optional <span style="color:blue">size<span style="color:black"> limit</html>|
 |[[.functions:file_exists]]|<html><span style="color:green">string<span style="color:blue"> filename</html>|<html><span style="color:green">int<span style="color:black"> 1 or 0</html>|Check if a file exists| |[[.functions:file_exists]]|<html><span style="color:green">string<span style="color:blue"> filename</html>|<html><span style="color:green">int<span style="color:black"> 1 or 0</html>|Check if a file exists|
 +|[[.functions:filemtime]]|<html><span style="color:green">string<span style="color:blue"> filename</html>|<html><span style="color:green">int<span style="color:black"> bytes</html>|Return the last modified timestamp for a file|
 |[[.functions:filesize]]|<html><span style="color:green">string<span style="color:blue"> filename<span style="color:black"> or<span style="color:green"> int<span style="color:blue"> handle</html>|<html><span style="color:green">int<span style="color:black"> bytes</html>|Return the size of a file, or the number of unread bytes in a stream or socket| |[[.functions:filesize]]|<html><span style="color:green">string<span style="color:blue"> filename<span style="color:black"> or<span style="color:green"> int<span style="color:blue"> handle</html>|<html><span style="color:green">int<span style="color:black"> bytes</html>|Return the size of a file, or the number of unread bytes in a stream or socket|
 |[[.functions:findfirst]]|<html><span style="color:green">string<span style="color:blue"> pattern<span style="color:black">,<span style="color:green"> int<span style="color:blue"> attributes</html>|<html><span style="color:green">array<span style="color:black"> first file found</html>|<html>Start searching the current folder for files matching a <span style="color:blue">pattern<span style="color:black"> and <span style="color:blue">attributes</html>| |[[.functions:findfirst]]|<html><span style="color:green">string<span style="color:blue"> pattern<span style="color:black">,<span style="color:green"> int<span style="color:blue"> attributes</html>|<html><span style="color:green">array<span style="color:black"> first file found</html>|<html>Start searching the current folder for files matching a <span style="color:blue">pattern<span style="color:black"> and <span style="color:blue">attributes</html>|
Line 207: Line 51:
 |[[.functions:fopen]]|<html><span style="color:green">string<span style="color:blue"> filename<span style="color:black">,<span style="color:green"> string<span style="color:blue"> mode</html>|<html><span style="color:green">int<span style="color:black"> handle or 0</html>|Open a file for reading or writing| |[[.functions:fopen]]|<html><span style="color:green">string<span style="color:blue"> filename<span style="color:black">,<span style="color:green"> string<span style="color:blue"> mode</html>|<html><span style="color:green">int<span style="color:black"> handle or 0</html>|Open a file for reading or writing|
 |[[.functions:fread]]|<html><span style="color:green">int<span style="color:blue"> handle<span style="color:black">,<span style="color:green"> int<span style="color:blue"> bytes</html>|<html><span style="color:green">string<span style="color:black"> or <span style="color:green">int<span style="color:black"> 0</html>|<html>Read <span style="color:blue">bytes<span style="color:black"> from a file, stream or socket</html>| |[[.functions:fread]]|<html><span style="color:green">int<span style="color:blue"> handle<span style="color:black">,<span style="color:green"> int<span style="color:blue"> bytes</html>|<html><span style="color:green">string<span style="color:black"> or <span style="color:green">int<span style="color:black"> 0</html>|<html>Read <span style="color:blue">bytes<span style="color:black"> from a file, stream or socket</html>|
 +|[[.functions:fread_unpack]]|<html><span style="color:green">int<span style="color:blue"> handle<span style="color:black">,<html><span style="color:green">string<span style="color:blue"> format<span style="color:black">, <span style="color:green">int <span style="color:blue"> count<span style="color:black">, <span style="color:green">int <span style="color:blue"> interval<span style="color:black"></html> |<html><span style="color:green">number</html>|<html>Write contents of an indexed array to a file in binary<span style="color:black"></html>|
 |[[.functions:freemem]]||<html><span style="color:green">int<span style="color:black"> bytes</html>|Return free memory space| |[[.functions:freemem]]||<html><span style="color:green">int<span style="color:black"> bytes</html>|Return free memory space|
 |[[.functions:freestack]]||<html><span style="color:green">int<span style="color:black"> bytes</html>|Return free stack space| |[[.functions:freestack]]||<html><span style="color:green">int<span style="color:black"> bytes</html>|Return free stack space|
Line 213: Line 58:
 |[[.functions:fsockopen]]|<html><span style="color:green">string<span style="color:blue"> host<span style="color:black">,<span style="color:green"> int<span style="color:blue"> port<span style="color:black">,<span style="color:green"> int<span style="color:blue"> timeout</html>|<html><span style="color:green">int<span style="color:black"> handle or 0</html>|<html>Open an internet socket connection with optional <span style="color:blue">timeout</html>| |[[.functions:fsockopen]]|<html><span style="color:green">string<span style="color:blue"> host<span style="color:black">,<span style="color:green"> int<span style="color:blue"> port<span style="color:black">,<span style="color:green"> int<span style="color:blue"> timeout</html>|<html><span style="color:green">int<span style="color:black"> handle or 0</html>|<html>Open an internet socket connection with optional <span style="color:blue">timeout</html>|
 |[[.functions:ftell]]|<html><span style="color:green">int<span style="color:blue"> handle</html>|<html><span style="color:green">int<span style="color:black"> position</html>|Return the current position of a file read/write pointer| |[[.functions:ftell]]|<html><span style="color:green">int<span style="color:blue"> handle</html>|<html><span style="color:green">int<span style="color:black"> position</html>|Return the current position of a file read/write pointer|
 +|[[.functions:ftp_command]]|<html><span style="color:green">string<span style="color:blue"> result</html>|<html><span style="color:green">string<span style="color:black"> command</html>]|Send an FTP command|
 +|[[.functions:ftp_close]]|<html><span style="color:green">int<span style="color:blue"> result</html>||Close an active connection with FTP server|
 +|[[.functions:ftp_download]]|<html><span style="color:green">int<span style="color:blue"> result</html>|<html><span style="color:green">string<span style="color:black"> remote_file</html>,<html><span style="color:green">string<span style="color:black"> local_file</html>,[<html><span style="color:green">int<span style="color:black"> position</html>]|Initiate a download of a remote file|
 +|[[.functions:ftp_error]]|<html><span style="color:green">int<span style="color:blue"> result</html>||Get last FTP response code|
 +|[[.functions:ftp_is_busy]]|<html><span style="color:green">int<span style="color:blue"> result</html>|| Check if the FTP engine is busy|
 +|[[.functions:ftp_is_connected]]|<html><span style="color:green">int<span style="color:blue"> result</html>|| Check if the FTP connection is active|
 +|[[.functions:ftp_is_connecting]]|<html><span style="color:green">int<span style="color:blue"> result</html>|| Check if the FTP connection is in the process of connecting|
 +|[[.functions:ftp_list]]|<html><span style="color:green">int<span style="color:blue"> result</html>|<html><span style="color:green">string<span style="color:black"> folder</html>, <html><span style="color:green">string<span style="color:black"> output_file</html>|Lists a folder on the FTP server and outputs the result to the specified file|
 +|[[.functions:ftp_open]]|<html><span style="color:green">int<span style="color:blue"> result</html>|<html><span style="color:green">string<span style="color:black"> host</html>, <html><span style="color:green">int<span style="color:black"> port</html>, <html><span style="color:green">string<span style="color:black"> username</html>, <html><span style="color:green">string<span style="color:black"> password</html>, <html><span style="color:green">int<span style="color:black"> keepalive</html>, <html><span style="color:green">int<span style="color:black"> ignore_reply</html>|Open a connection to an FTP server|
 +|[[.functions:ftp_size]]|<html><span style="color:green">int<span style="color:blue"> size</html>|<html><span style="color:green">string<span style="color:black"> filename</html>|Get the file size of a file on the FTP server|
 +|[[.functions:ftp_status]]|<html><span style="color:green">array<span style="color:blue"> status</html>||Get the FTP engine status including upload and download completion information
 +|[[.functions:ftp_upload]]|<html><span style="color:green">int<span style="color:blue"> result</html>|<html><span style="color:green">string<span style="color:black"> remote_file</html>,<html><span style="color:green">string<span style="color:black"> local_file</html>,[<html><span style="color:green">int<span style="color:black"> position</html>]|Initiate an upload of a file|
 |[[.functions:function_exists]]|<html><span style="color:green">string<span style="color:blue"> function_name</html>|<html><span style="color:green">int<span style="color:black"> 1 or 0</html>|Check if a function exists (custom or native)| |[[.functions:function_exists]]|<html><span style="color:green">string<span style="color:blue"> function_name</html>|<html><span style="color:green">int<span style="color:black"> 1 or 0</html>|Check if a function exists (custom or native)|
 |[[.functions:fwrite]]|<html><span style="color:green">int<span style="color:blue"> handle<span style="color:black">, <span style="color:green">mixed <span style="color:blue">data<span style="color:black">, <span style="color:green">int <span style="color:blue">length</html>|<html><span style="color:green">int<span style="color:black"> bytes written or -1</html>|<html>Write <span style="color:blue">data<span style="color:black"> to a file, stream or socket</html>| |[[.functions:fwrite]]|<html><span style="color:green">int<span style="color:blue"> handle<span style="color:black">, <span style="color:green">mixed <span style="color:blue">data<span style="color:black">, <span style="color:green">int <span style="color:blue">length</html>|<html><span style="color:green">int<span style="color:black"> bytes written or -1</html>|<html>Write <span style="color:blue">data<span style="color:black"> to a file, stream or socket</html>|
 +|[[.functions:fwrite_pack]]|<html><span style="color:green">int<span style="color:blue"> handle<span style="color:black">,<html><span style="color:green">array<span style="color:blue"> data<span style="color:black">, <span style="color:green">int <span style="color:blue"> length<span style="color:black"></html> |<html><span style="color:green">number</html>|<html>Write contents of an indexed array to a file in binary<span style="color:black"></html>|
 |[[.functions:get3gstat]]||<html><span style="color:green">array</html>|Get cellular data connection status information| |[[.functions:get3gstat]]||<html><span style="color:green">array</html>|Get cellular data connection status information|
 |[[.functions:getcwd]]||<html><span style="color:green">string<span style="color:black"> path</html>|Get the current directory| |[[.functions:getcwd]]||<html><span style="color:green">string<span style="color:black"> path</html>|Get the current directory|
 |[[.functions:getethstat]]||<html><span style="color:green">array</html>|Get Ethernet connection status information| |[[.functions:getethstat]]||<html><span style="color:green">array</html>|Get Ethernet connection status information|
 |[[.functions:getmac]]||<html><span style="color:green">string<span style="color:black"> MAC</html>|Get the Wattmon's MAC address| |[[.functions:getmac]]||<html><span style="color:green">string<span style="color:black"> MAC</html>|Get the Wattmon's MAC address|
 +|[[.functions:gettype]]|<html><span style="color:green">any<span style="color:blue"> variable<span style="color:black"></html>|<html><span style="color:green">string<span style="color:black"> type</html>|Get a variable type as a string|
 |[[.functions:getusbstat]]||<html><span style="color:green">array</html>|Get USB host status information| |[[.functions:getusbstat]]||<html><span style="color:green">array</html>|Get USB host status information|
 |[[.functions:getwifistat]]||<html><span style="color:green">array</html>|Get WIFI status information| |[[.functions:getwifistat]]||<html><span style="color:green">array</html>|Get WIFI status information|
 |[[.functions:header]]|<html><span style="color:green">string<span style="color:blue"> header_data</html>||Add to HTTP header| |[[.functions:header]]|<html><span style="color:green">string<span style="color:blue"> header_data</html>||Add to HTTP header|
 +|[[.functions:hash_hmac]]|<html><span style="color:green">string<span style="color:blue"> algorithm</html>, <html><span style="color:green">string<span style="color:blue"> data</html>, <html><span style="color:green">string<span style="color:blue"> key</html> |<html><span style="color:green">string<span style="color:black"> converted</html>|Generate a keyed hash value using the HMAC method|
 |[[.functions:htmlspecialchars]]|<html><span style="color:green">string<span style="color:blue"> data</html>|<html><span style="color:green">string<span style="color:black"> converted</html>|Convert special characters for display in HTML| |[[.functions:htmlspecialchars]]|<html><span style="color:green">string<span style="color:blue"> data</html>|<html><span style="color:green">string<span style="color:black"> converted</html>|Convert special characters for display in HTML|
 |[[.functions:ieee754toint]]|<html><span style="color:green">float <span style="color:blue">value</html>|<html><span style="color:green">int<span style="color:black"> representation</html>|<html>Convert a <span style="color:green">float <span style="color:blue">value<span style="color:black"> to an IEEE-754 encoded <span style="color:green">integer<span style="color:black"> (32 bit)</html>| |[[.functions:ieee754toint]]|<html><span style="color:green">float <span style="color:blue">value</html>|<html><span style="color:green">int<span style="color:black"> representation</html>|<html>Convert a <span style="color:green">float <span style="color:blue">value<span style="color:black"> to an IEEE-754 encoded <span style="color:green">integer<span style="color:black"> (32 bit)</html>|
Line 240: Line 100:
 |[[.functions:is_string]]|<html><span style="color:green">mixed<span style="color:blue"> variable</html>|<html><span style="color:green">int<span style="color:black"> 1 or 0</html>|<html>Check if a <span style="color:blue">variable<span style="color:black"> is a <span style="color:green">string</html>| |[[.functions:is_string]]|<html><span style="color:green">mixed<span style="color:blue"> variable</html>|<html><span style="color:green">int<span style="color:black"> 1 or 0</html>|<html>Check if a <span style="color:blue">variable<span style="color:black"> is a <span style="color:green">string</html>|
 |[[.functions:isset]]|<html><span style="color:green">mixed<span style="color:blue"> variable</html>|<html><span style="color:green">int<span style="color:black"> 1 or 0</html>|<html>Check if a <span style="color:blue">variable<span style="color:black"> exists</html>| |[[.functions:isset]]|<html><span style="color:green">mixed<span style="color:blue"> variable</html>|<html><span style="color:green">int<span style="color:black"> 1 or 0</html>|<html>Check if a <span style="color:blue">variable<span style="color:black"> exists</html>|
 +|[[.functions:json_decode]]|<html><span style="color:green">string<span style="color:black"></html>|<html><span style="color:green">array</html>|<html>JSON decode a <span style="color:green">string<span style="color:black"> into an <span style="color:green">array<span style="color:black"></html>|
 |[[.functions:json_encode]]|<html><span style="color:green">array<span style="color:black">,<span style="color:green"> int<span style="color:blue"> method</html>|<html><span style="color:green">string</html>|<html>JSON encode an <span style="color:green">array<span style="color:black"> into a <span style="color:green">string<span style="color:black">, with optional <span style="color:blue">method</html>| |[[.functions:json_encode]]|<html><span style="color:green">array<span style="color:black">,<span style="color:green"> int<span style="color:blue"> method</html>|<html><span style="color:green">string</html>|<html>JSON encode an <span style="color:green">array<span style="color:black"> into a <span style="color:green">string<span style="color:black">, with optional <span style="color:blue">method</html>|
 |[[.functions:ln]]|<html><span style="color:green">number<span style="color:blue"> number</html>|<html><span style="color:green">float<span style="color:black"> log<sub>e</sub></html>|Return the natural logarithm of a <html><span style="color:blue">number</html>| |[[.functions:ln]]|<html><span style="color:green">number<span style="color:blue"> number</html>|<html><span style="color:green">float<span style="color:black"> log<sub>e</sub></html>|Return the natural logarithm of a <html><span style="color:blue">number</html>|
Line 247: Line 108:
 |[[.functions:max_execution_time]]|<html><span style="color:green">int<span style="color:blue"> seconds</html>||Set the maximum execution time for the current script| |[[.functions:max_execution_time]]|<html><span style="color:green">int<span style="color:blue"> seconds</html>||Set the maximum execution time for the current script|
 |[[.functions:mb_add_dev]]|<html><span style="color:green">int<span style="color:blue"> id<span style="color:black">,<span style="color:green"> int<span style="color:blue"> type<span style="color:black">,<span style="color:green"> string<span style="color:blue"> name<span style="color:black">,<span style="color:green"> int<span style="color:blue"> poll_interval<span style="color:black">,<span style="color:green"> int<span style="color:blue"> status<span style="color:black">,<span style="color:green"> int<span style="color:blue"> bus</html>|<html><span style="color:green">int<span style="color:black"> 0=OK</html>|Add a device to the list of polled devices| |[[.functions:mb_add_dev]]|<html><span style="color:green">int<span style="color:blue"> id<span style="color:black">,<span style="color:green"> int<span style="color:blue"> type<span style="color:black">,<span style="color:green"> string<span style="color:blue"> name<span style="color:black">,<span style="color:green"> int<span style="color:blue"> poll_interval<span style="color:black">,<span style="color:green"> int<span style="color:blue"> status<span style="color:black">,<span style="color:green"> int<span style="color:blue"> bus</html>|<html><span style="color:green">int<span style="color:black"> 0=OK</html>|Add a device to the list of polled devices|
-|[[.functions:mb_delete_device]]|<html><span style="color:green">int<span style="color:blue"> id</html>|<html><span style="color:green">int<span style="color:black"> 1=OK</html>|Delete a device from the list of active devices|+|[[.functions:mb_delete_dev]]|<html><span style="color:green">int<span style="color:blue"> id</html>|<html><span style="color:green">int<span style="color:black"> 1=OK</html>|Delete a device from the list of active devices|
 |[[.functions:mb_get_dev_by_id]]|<html><span style="color:green">int<span style="color:blue"> id</html>|<html><span style="color:green">array</html>|Return modbus device details by <html><span style="color:blue">id</html>| |[[.functions:mb_get_dev_by_id]]|<html><span style="color:green">int<span style="color:blue"> id</html>|<html><span style="color:green">array</html>|Return modbus device details by <html><span style="color:blue">id</html>|
 |[[.functions:mb_get_dev_by_index]]|<html><span style="color:green">int<span style="color:blue"> index</html>|<html><span style="color:green">array</html>|Return modbus device details by <html><span style="color:blue">index</html>| |[[.functions:mb_get_dev_by_index]]|<html><span style="color:green">int<span style="color:blue"> index</html>|<html><span style="color:green">array</html>|Return modbus device details by <html><span style="color:blue">index</html>|
Line 270: Line 131:
 |[[.functions:mkdir]]|<html><span style="color:green">string<span style="color:blue"> pathname</html>|<html><span style="color:green">int<span style="color:black"> 0 or error code</html>|Make a directory| |[[.functions:mkdir]]|<html><span style="color:green">string<span style="color:blue"> pathname</html>|<html><span style="color:green">int<span style="color:black"> 0 or error code</html>|Make a directory|
 |[[.functions:mktime]]|<html><span style="color:green">int<span style="color:blue"> hour<span style="color:black">,<span style="color:green"> int<span style="color:blue"> minute<span style="color:black">,<span style="color:green"> int<span style="color:blue"> second<span style="color:black">,<span style="color:green"> int<span style="color:blue"> month<span style="color:black">,<span style="color:green"> int<span style="color:blue"> day<span style="color:black">,<span style="color:green"> int<span style="color:blue"> year</html>|<html><span style="color:green">int<span style="color:black"> seconds</html>|Return the Linux Timestamp for a given date and time| |[[.functions:mktime]]|<html><span style="color:green">int<span style="color:blue"> hour<span style="color:black">,<span style="color:green"> int<span style="color:blue"> minute<span style="color:black">,<span style="color:green"> int<span style="color:blue"> second<span style="color:black">,<span style="color:green"> int<span style="color:blue"> month<span style="color:black">,<span style="color:green"> int<span style="color:blue"> day<span style="color:black">,<span style="color:green"> int<span style="color:blue"> year</html>|<html><span style="color:green">int<span style="color:black"> seconds</html>|Return the Linux Timestamp for a given date and time|
 +|[[.functions:mqtt_disconnect]]||<html></html>|Disconnect MQTT connection|
 |[[.functions:mqtt_publish]]|<html><span style="color:green">string<span style="color:blue"> channel</html>, <html><span style="color:green">string<span style="color:blue"> content</html>|<html><span style="color:green">int<span style="color:black"> 1 for success or 0 for error</html>|Publish a message to an MQTT server| |[[.functions:mqtt_publish]]|<html><span style="color:green">string<span style="color:blue"> channel</html>, <html><span style="color:green">string<span style="color:blue"> content</html>|<html><span style="color:green">int<span style="color:black"> 1 for success or 0 for error</html>|Publish a message to an MQTT server|
 |[[.functions:mqtt_subscribe]]|<html><span style="color:green">string<span style="color:blue"> channel</html>, <html><span style="color:green">string<span style="color:blue"> callback</html>|<html><span style="color:green">int<span style="color:black"> 1 for success or 0 for error</html>|Subscribe to a channel on an MQTT server| |[[.functions:mqtt_subscribe]]|<html><span style="color:green">string<span style="color:blue"> channel</html>, <html><span style="color:green">string<span style="color:blue"> callback</html>|<html><span style="color:green">int<span style="color:black"> 1 for success or 0 for error</html>|Subscribe to a channel on an MQTT server|
 +|[[.functions:mqttstat]]||<html><span style="color:green">array<span style="color:black"> array with connection status</html>|Get MQTT Connection status|
 |[[.functions:net_disable3g]]|||Disable 3G support for the dongle| |[[.functions:net_disable3g]]|||Disable 3G support for the dongle|
 |[[.functions:net_enable3g]]|||Enable 3G support for the dongle| |[[.functions:net_enable3g]]|||Enable 3G support for the dongle|
Line 291: Line 154:
 |[[.functions:ow_reset]]|||Reset the OneWire bus| |[[.functions:ow_reset]]|||Reset the OneWire bus|
 |[[.functions:ow_write]]|<html><span style="color:green">int<span style="color:blue"> value</html>||Write a byte to the OneWire bus| |[[.functions:ow_write]]|<html><span style="color:green">int<span style="color:blue"> value</html>||Write a byte to the OneWire bus|
 +|[[.functions:pack]]|<html><span style="color:green">string<span style="color:blue"> format<span style="color:black">, <span style="color:green">mixed <span style="color:blue"> value<span style="color:black"></html> |<html><span style="color:green">string</html>|<html>Pack a value into a <html><span style="color:green">string<span style="color:black"></html>|
 |[[.functions:phpinfo]]||<html><span style="color:green">string</html>|Return information about the system| |[[.functions:phpinfo]]||<html><span style="color:green">string</html>|Return information about the system|
 |[[.functions:pin_configure]]|<html><span style="color:green">int<span style="color:blue"> pin_index<span style="color:black">,<span style="color:green"> int<span style="color:blue"> pin_type<span style="color:black">,<span style="color:green"> int<span style="color:blue"> counter_type</html>||Configure an <tooltip title="Input/Output">I/O</tooltip> pin as a digital input, output, or analog input| |[[.functions:pin_configure]]|<html><span style="color:green">int<span style="color:blue"> pin_index<span style="color:black">,<span style="color:green"> int<span style="color:blue"> pin_type<span style="color:black">,<span style="color:green"> int<span style="color:blue"> counter_type</html>||Configure an <tooltip title="Input/Output">I/O</tooltip> pin as a digital input, output, or analog input|
Line 304: Line 168:
 |[[.functions:rand]]|<html><span style="color:green">int<span style="color:blue"> min<span style="color:black">, <span style="color:green">int<span style="color:blue"> max</html>|<html><span style="color:green">int</html>|<html>Return a random <span style="color:green">integer<span style="color:black"> between <span style="color:blue">min<span style="color:black"> and <span style="color:blue">max</html>| |[[.functions:rand]]|<html><span style="color:green">int<span style="color:blue"> min<span style="color:black">, <span style="color:green">int<span style="color:blue"> max</html>|<html><span style="color:green">int</html>|<html>Return a random <span style="color:green">integer<span style="color:black"> between <span style="color:blue">min<span style="color:black"> and <span style="color:blue">max</html>|
 |[[.functions:reboot]]|||Reboot the processor| |[[.functions:reboot]]|||Reboot the processor|
 +|[[.functions:register_callback]]|<html><span style="color:green">string<span style="color:blue"> callback_type<span style="color:black">, <span style="color:green">string<span style="color:blue"> filename, <span style="color:green">string<span style="color:blue"> functionname</html>|<html><span style="color:green">int<span style="color:black"> 0 or error code</html>|<html>Register a callback function for system events </html>|
 |[[.functions:rename]]|<html><span style="color:green">string<span style="color:blue"> source<span style="color:black">, <span style="color:green">string<span style="color:blue"> destination</html>|<html><span style="color:green">int<span style="color:black"> 0 or error code</html>|<html>Rename or move a file or directory from <span style="color:blue">source<span style="color:black"> to <span style="color:blue">destination</html>| |[[.functions:rename]]|<html><span style="color:green">string<span style="color:blue"> source<span style="color:black">, <span style="color:green">string<span style="color:blue"> destination</html>|<html><span style="color:green">int<span style="color:black"> 0 or error code</html>|<html>Rename or move a file or directory from <span style="color:blue">source<span style="color:black"> to <span style="color:blue">destination</html>|
 |[[.functions:reset]]|||Reset the processor| |[[.functions:reset]]|||Reset the processor|
Line 311: Line 176:
 |[[.functions:session_is_new]]||<html><span style="color:green">int</html>|Check if a session was just initiated| |[[.functions:session_is_new]]||<html><span style="color:green">int</html>|Check if a session was just initiated|
 |[[.functions:session_start]]|||Initiate a new session and send the cookie data for it| |[[.functions:session_start]]|||Initiate a new session and send the cookie data for it|
 +|[[.functions:set_cert_key]]|<html><span style="color:green">string<span style="color:blue"> key</html>,<html><span style="color:green">string<span style="color:blue"> cert</html>||Set a custom certificate encryption key|
 |[[.functions:set_search_path]]|<html><span style="color:green">string<span style="color:blue"> pathname</html>||Set the search path for the telnet client| |[[.functions:set_search_path]]|<html><span style="color:green">string<span style="color:blue"> pathname</html>||Set the search path for the telnet client|
 |[[.functions:setethpower]]|<html><span style="color:green">int<span style="color:blue"> state</html>||Enable or disable the ethernet controller| |[[.functions:setethpower]]|<html><span style="color:green">int<span style="color:blue"> state</html>||Enable or disable the ethernet controller|
Line 320: Line 186:
 |[[.functions:sizeof]]|<html><span style="color:green">array</html>|<html><span style="color:green">int<span style="color:black"> number of elements</html>|<html>Return the number of elements in an <span style="color:green">array</html>| |[[.functions:sizeof]]|<html><span style="color:green">array</html>|<html><span style="color:green">int<span style="color:black"> number of elements</html>|<html>Return the number of elements in an <span style="color:green">array</html>|
 |[[.functions:sleep]]|<html><span style="color:green">int<span style="color:blue"> ms</html>||Sleep for specified milliseconds| |[[.functions:sleep]]|<html><span style="color:green">int<span style="color:blue"> ms</html>||Sleep for specified milliseconds|
 +|[[.functions:snmp_trap_send]]|<html><span style="color:green">string<span style="color:blue"> message<span style="color:black"></html>|<html><span style="color:green">int<span style="color:black"> 0 or 1</html>|<html>Send an SNMP trap message with ASCII content of <span style="color:blue">source</html>|
 |[[.functions:spi_clearcs]]|||Clear the CS output of the <tooltip title="Serial Peripheral Interface">SPI</tooltip> bus| |[[.functions:spi_clearcs]]|||Clear the CS output of the <tooltip title="Serial Peripheral Interface">SPI</tooltip> bus|
 |[[.functions:spi_read]]||<html><span style="color:green">int<span style="color:black"> byte</html>|Read a byte from the <tooltip title="Serial Peripheral Interface">SPI</tooltip> bus| |[[.functions:spi_read]]||<html><span style="color:green">int<span style="color:black"> byte</html>|Read a byte from the <tooltip title="Serial Peripheral Interface">SPI</tooltip> bus|
Line 328: Line 195:
 |[[.functions:sqrt]]|<html><span style="color:green">number<span style="color:blue"> number</html>|<html><span style="color:green">number<span style="color:black"> square root</html>|Return the square root of a <html><span style="color:blue">number</html>| |[[.functions:sqrt]]|<html><span style="color:green">number<span style="color:blue"> number</html>|<html><span style="color:green">number<span style="color:black"> square root</html>|Return the square root of a <html><span style="color:blue">number</html>|
 |[[.functions:stats]]||<html><span style="color:green">array</html>|Return system statistics| |[[.functions:stats]]||<html><span style="color:green">array</html>|Return system statistics|
 +|[[.functions:str_replace]]|<html><span style="color:green">string<span style="color:blue"> search<span style="color:black">, <span style="color:green">string<span style="color:blue"> replace, <span style="color:green">string<span style="color:blue"> subject,[<span style="color:green">int<span style="color:blue"> &count]</html>|<html><span style="color:green">string<span style="color:black"> result</html>|<html>Return the string with each occurrence of <span style="color:blue">search<span style="color:black"> replaced with <span style="color:blue">replace<span style="color:black"></html>|
 |[[.functions:strftime]]|<html><span style="color:green">string<span style="color:blue"> format<span style="color:black">,<span style="color:green"> int<span style="color:blue"> timestamp</html>|<html><span style="color:green">string<span style="color:black"> formatted</html>|<html>Format a Linux <span style="color:blue">Timestamp<span style="color:black"> using a <span style="color:blue">format <span style="color:green">string</html>| |[[.functions:strftime]]|<html><span style="color:green">string<span style="color:blue"> format<span style="color:black">,<span style="color:green"> int<span style="color:blue"> timestamp</html>|<html><span style="color:green">string<span style="color:black"> formatted</html>|<html>Format a Linux <span style="color:blue">Timestamp<span style="color:black"> using a <span style="color:blue">format <span style="color:green">string</html>|
 |[[.functions:strlen]]|<html><span style="color:green">string<span style="color:blue"> input</html>|<html><span style="color:green">int<span style="color:black"> length</html>|Return the length of a <html><span style="color:green">string</html>| |[[.functions:strlen]]|<html><span style="color:green">string<span style="color:blue"> input</html>|<html><span style="color:green">int<span style="color:black"> length</html>|Return the length of a <html><span style="color:green">string</html>|
Line 340: Line 208:
 |[[.functions:time]]||<html><span style="color:green">int<span style="color:black"> seconds</html>|Return the current system timestamp| |[[.functions:time]]||<html><span style="color:green">int<span style="color:black"> seconds</html>|Return the current system timestamp|
 |[[.functions:timefromfat]]|<html><span style="color:green">int<span style="color:blue"> filetime</html>|<html><span style="color:green">int<span style="color:black"> seconds</html>|Convert a FAT <html><span style="color:blue">filetime<span style="color:black"></html> to a Linux Timestamp| |[[.functions:timefromfat]]|<html><span style="color:green">int<span style="color:blue"> filetime</html>|<html><span style="color:green">int<span style="color:black"> seconds</html>|Convert a FAT <html><span style="color:blue">filetime<span style="color:black"></html> to a Linux Timestamp|
 +|[[.functions:trim]]|<html><span style="color:green">string<span style="color:blue"> input</html>|<html><span style="color:green">string<span style="color:black"> trimmed</html>|Return the trimmed <html><span style="color:green">string</html>|
 |[[.functions:ucfirst]]|<html><span style="color:green">string<span style="color:blue"> input</html>|<html><span style="color:green">string<span style="color:black"> Lowercase</html>|Convert a <html><span style="color:green">string<span style="color:black"></html> to Lowercase except for the first character| |[[.functions:ucfirst]]|<html><span style="color:green">string<span style="color:blue"> input</html>|<html><span style="color:green">string<span style="color:black"> Lowercase</html>|Convert a <html><span style="color:green">string<span style="color:black"></html> to Lowercase except for the first character|
 |[[.functions:unlink]]|<html><span style="color:green">string <span style="color:blue">filename</html>|<html><span style="color:green">int<span style="color:black"> 0 or error code</html>|Remove a file (delete it)| |[[.functions:unlink]]|<html><span style="color:green">string <span style="color:blue">filename</html>|<html><span style="color:green">int<span style="color:black"> 0 or error code</html>|Remove a file (delete it)|
 |[[.functions:untar]]|<html><span style="color:green">string<span style="color:blue"> filename<span style="color:black">,<span style="color:green"> int<span style="color:blue"> verbosity</html>|<html><span style="color:green">int<span style="color:black"> 1=OK</html>|Expand a TAR file into the current folder, optionally verbose| |[[.functions:untar]]|<html><span style="color:green">string<span style="color:blue"> filename<span style="color:black">,<span style="color:green"> int<span style="color:blue"> verbosity</html>|<html><span style="color:green">int<span style="color:black"> 1=OK</html>|Expand a TAR file into the current folder, optionally verbose|
 +|[[.functions:unpack]]|<html><span style="color:green">string<span style="color:blue"> format<span style="color:black">, <span style="color:green">string <span style="color:blue"> value<span style="color:black"></html> |<html><span style="color:green">number</html>|<html>Unpack a packed string value and return the original data<span style="color:black"></html>|
 |[[.functions:uptime]]||<html><span style="color:green">int<span style="color:black"> ms</html>|Return the uptime in milliseconds| |[[.functions:uptime]]||<html><span style="color:green">int<span style="color:black"> ms</html>|Return the uptime in milliseconds|
 +|[[.functions:urldecode]]|<html><span style="color:green">string <span style="color:blue">str</html>|<html><span style="color:green">string<span style="color:black"> string to encode</html>|URL-Decode a string|
 +|[[.functions:urlencode]]|<html><span style="color:green">string <span style="color:blue">str</html>|<html><span style="color:green">string<span style="color:black"> encoded string</html>|URL-Encode a string|
 |[[.functions:wifi_disable]]|||Disable Wifi module| |[[.functions:wifi_disable]]|||Disable Wifi module|
 |[[.functions:wifi_enable]]|||Enable Wifi module| |[[.functions:wifi_enable]]|||Enable Wifi module|
- 
-|<html><span style="color:green">string</html>|<html>Return the <span style="color:green">string<span style="color:black"> equivalent of a <span style="color:green">number</html>| 
-|[[.functions:substr]]|<html><span style="color:green">string<span style="color:blue"> input<span style="color:black">,<span style="color:green"> int<span style="color:blue"> start<span style="color:black">,<span style="color:green"> int<span style="color:blue"> length</html>|<html><span style="color:green">string<span style="color:black"> substring</html>|Return part of a <html><span style="color:green">string</html>| 
-|[[.functions:tar_finish]]|<html><span style="color:green">int<span style="color:blue"> handle</html>|<html><span style="color:green">int<span style="color:black"> 1=OK</html>|Add the ending header to a TAR file| 
-|[[.functions:tar_put]]|<html><span style="color:green">int<span style="color:blue"> handle<span style="color:black">,<span style="color:green"> string<span style="color:blue"> src_pathname<span style="color:black">,<span style="color:green"> string<span style="color:blue"> tar_pathname</html>|<html><span style="color:green">int<span style="color:black"> 1=OK</html>|Add a file to an open file in TAR format| 
-|[[.functions:time]]||<html><span style="color:green">int<span style="color:black"> seconds</html>|Return the current system timestamp| 
-|[[.functions:timefromfat]]|<html><span style="color:green">int<span style="color:blue"> filetime</html>|<html><span style="color:green">int<span style="color:black"> seconds</html>|Convert a FAT <html><span style="color:blue">filetime<span style="color:black"></html> to a Linux Timestamp| 
-|[[.functions:ucfirst]]|<html><span style="color:green">string<span style="color:blue"> input</html>|<html><span style="color:green">string<span style="color:black"> Lowercase</html>|Convert a <html><span style="color:green">string<span style="color:black"></html> to Lowercase except for the first character| 
-|[[.functions:unlink]]|<html><span style="color:green">string <span style="color:blue">filename</html>|<html><span style="color:green">int<span style="color:black"> 0 or error code</html>|Remove a file (delete it)| 
-|[[.functions:untar]]|<html><span style="color:green">string<span style="color:blue"> filename<span style="color:black">,<span style="color:green"> int<span style="color:blue"> verbosity</html>|<html><span style="color:green">int<span style="color:black"> 1=OK</html>|Expand a TAR file into the current folder, optionally verbose| 
-|[[.functions:uptime]]||<html><span style="color:green">int<span style="color:black"> ms</html>|Return the uptime in milliseconds| 
  
uphp/functions.txt · Last modified: 2022/09/23 04:53 by admin