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
Next revision Both sides next revision
uphp:functions [2018/09/06 11:04]
jeff Tooltip for 'I/O'
uphp:functions [2019/08/16 05:58]
admin
Line 7: Line 7:
 ^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>|<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</html>|<html><span style="color:green">string<span style="color:black"> iv</html>|<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>|
Line 21: Line 23:
 |[[.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: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: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>|
Line 46: Line 49:
 |[[.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>|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>|
Line 53: Line 68:
 |[[.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: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: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 78: Line 95:
 |[[.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: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: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</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 88: Line 105:
 |[[.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_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_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 rs485 bus and get but ignore the reply|+|[[.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_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_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 rs485 bus and get a reply|+|[[.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_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_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|
Line 172: Line 189:
 |[[.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: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:wifi_disable]]|||Disable Wifi module|
 +|[[.functions:wifi_enable]]|||Enable Wifi module|
  
uphp/functions.txt · Last modified: 2022/09/23 04:53 by admin