Functions
       
hdmi_off(DEBUG=False)
This function turn off hdmi port (need sudo -s)
:param DEBUG: Flag for using Debug mode
:type DEBUG:bool
:return: bool
hdmi_on(DEBUG=False)
This function turn on hdmi port (need sudo -s)
:param DEBUG: Flag for using Debug mode
:type DEBUG:bool
:return: bool
hdmi_size(v=None, h=None, DEBUG=False)
This function change hdmi display resolution (need sudo -s) (if call without any argument return current resolution)
:param v: vertical line
:param h: horizental line
:param DEBUG: Flag for using Debug mode
:type v : int
:type h:int
:type DEBUG:bool
:return: bool
global_ip(DEBUG=False)
return ip with by http://ipinfo.io/ip api
:param DEBUG:Flag for using Debug mode
:type DEBUG:bool
:return: global ip as string
internet(host='8.8.8.8', port=53, timeout=3)
Check Internet Connections.
:param  host: the host that check connection to
:param  port: port that check connection with
:param  timeout: times that check the connnection
:type host:str
:type port:int
:type timeout:int
:return bool: True if Connection is Stable
>>> internet() # if there is stable internet connection
True
>>> internet() # if there is no stable internet connection
False
local_ip(DEBUG=False)
return local ip of computer in windows by socket module and in unix with hostname command in shell
:param DEBUG:Flag for using Debug Mode
:type DEBUG:bool
:return: local ip as string
mac(DEBUG=False)
This function return mac addresses of net devices
:param DEBUG: Flag for using Debug mode
:type DEBUG:bool
:return: return mac addresses as dict with name as keys and mac addresses as values
ping(ip, packet_number=3, DEBUG=False)
This function ping ip and return True if this ip is available and False otherwise
:param ip: target ip
:param packet_number: numer of packet to size
:param DEBUG: Flag for using Debug mode
:type ip :str
:type packet_number:int
:type DEBUG:bool
:return: a boolean value (True if ip is available and False otherwise)
set_ip(ip, DEVICE='eth0', DEBUG=False)
This function set static ip in interfaces file (need sudo)
:param DEVICE: network device name
:type DEVICE:str
:param ip: static ip
:type ip :str
:param DEBUG: Flag for using Debug mode
:type DEBUG:bool
:return: True in successful
convert_bytes(num)
convert num to idiomatic byte unit
:param num: the input number.
:type num:int
:return: str
>>> convert_bytes(200)
'200.0 bytes'
>>> convert_bytes(6000)
'5.9 KB'
>>> convert_bytes(80000)
'78.1 KB'
freeup(DEBUG=False)
To free pagecache, dentries and inodes:
:param DEBUG: Flag for using Debug mode
:type DEBUG:bool
:return: Amount of freeuped ram as string and converted by convert_bytes()
ram_free(convert=True)
Return how much ram is available
:param convert: Flag for convert mode (using of convert_byte function)
:type convert : bool
:return: how much ram is available
ram_percent()
Return available ram percentage
:return: availabe ram percentage as string with %
ram_total(convert=True)
Return total ram of board
:param convert: Flag for convert mode (using of convert_byte function)
:type convert:bool
:return: total ram of board as string
ram_used(convert=True)
Return how much ram is using
:param convert: Flag for convert mode (using of convert_byte function)
:type convert:bool
:return: how much ram is using as string
mount(device_name, mount_address=None, DEBUG=False)
:param device_name: name of device for mounted example = sda1
:param mount_address: address for mounting device example = /mnt/usb , default value is None in this case function generate random number for mount folder name
:param DEBUG: Flag for using Debug mode
:type device_name:str
:type mount_address:str
:type DEBUG:bool
:return: True if device mount correctly and False other wise
mount_status(device_name, DEBUG=False)
This function return addresses of mounted memory devices in dev by device name
:param DEBUG: Flag for using Debug mode
:type DEBUG:bool
:return: list of memory devices
random_generator(number)
storage_status(DEBUG=False)
This function return all of the inserted memory and their status
:param DEBUG: Flag for using Debug mode
:type DEBUG:bool
:return: All of the inserted memory and their status as dictionary ( device name as keys and mount status (mounted_addresses as list and u --> unmounted) as values
unmount(ADDRESS, DEBUG=False)
This function unmount memory devices by addresses
:param ADDRESS: address of that device mount on
:type ADDRESS:str
:param DEBUG: Flag for using Debug mode
:type DEBUG:bool
:return: True if device unmount correctly and False other wise
unmount_all(DEBUG=False)
This function unmount all of the mounted devices
:param DEBUG: Flag for using Debug mode
:type DEBUG:bool
:return: return True if all of the mounted devices unmount correctly
check_update(DEBUG=False)
This function check orangetool site for newversion
:param DEBUG: Flag for using Debug mode
:type DEBUG:bool
:return: True if new version is available
get_temp(Zone=0, DEBUG=False)
This Function Wrote for Orangepi to read cpu temperature
:param DEBUG : Flag for using Debug mode
:param Zone : Thermal Zone Index
:type DEBUG:bool
:type Zone:int
:return: Board Temp as string in celsius
halt(DEBUG=False)
his function is a shortcut for poweroff (need sudo)
:param DEBUG: Flag for using Debug mode
:type DEBUG:bool
:return: None
idletime(DEBUG=False)
This function return system idletime
:param DEBUG: Flag for using Debug mode
:type DEBUG:bool
:return: system idle as string
restart(DEBUG=False)
his function is a shortcut for reboot (need sudo)
:param DEBUG: Flag for using Debug mode
:type DEBUG:bool
:return: None
sleep(DEBUG=False)
This function is a shortcut for sleep (need sudo)
:param DEBUG: Flag for using Debug mode
:type DEBUG:bool
:return: None
time_convert(input_string)
This function convert input_string from uptime from sec to DD,HH,MM,SS Format
:param input_string: input time string  in sec
:type input_string:str
:return: converted time as string
uptime(DEBUG=False)
This function return system uptime
:param DEBUG: Flag for using Debug mode
:type DEBUG:bool
:return: system uptime as string
version()
This function return orangetool version (for test)
:return: return orangetool-version number as string
wakeup(day=0, hour=0, minute=0, DEBUG=False)
This function set wakeup time for kernel RTC (need sudo)
:param day: days for wakeup
:param hour: hout for wakeup
:param minute: minute for wakeup
:param DEBUG: Flag for using Debug mode
:type day:int
:type hour:int
:type minute:int
:type DEBUG:bool
:return: bool
zero_insert(input_string)
This function get a string as input if input is one digit add a zero
:param input_string: input digit az string
:type input_string:str
:return: modified output as str