Smart API

From open-smil
Jump to: navigation, search

Using Smart APIs to manage the system configuration of a SMIL player:

Smart API Format

In SMIL file, add a <ref/> clip source tag to setup device configuration.

<ref src="smartapi:${SmartApi_cmd}"/>

${SmartApi_cmd} is a Smart API command. One command can be referenced to one device configuration. How to call a Smart API with parameters:

<ref src="smartapi:${SmartApi_cmd}">
    <param name="${key1}" value="${value1}"/>
    <param name="${key2}" value="${value2}"/>
</ref>
${key1} and ${key2} are parameter names, ${value1} and ${value2} are parameter values.

Smart API Command

Set device password

  • Command
smartapi:set_password
  • Parameter
Parameter name Type of value Description
value string The new security password. Only allow 4 bytes ~ 16 bytes
  • Example
<ref src="smartapi:set_password">
    <param name="value" value="asdfg"/>
</ref>
Change device security password to *asdfg*. Security password on the SMIL player will be enabled once a password is set.

Delete device password

  • Command
smartapi:delete_password
  • Parameter

No parameter

  • Example
<ref src="smartapi:delete_password"/>
Delete device security password. The Security password on the SMIL player will be disable once this API is executed.

Set Ethernet configuration

  • Command
"smartapi:set_ethernet" 
  • Parameter
Parameter name Type of value Description
ip_assignment string The type of the ip address. Either "dhcp" or "static". If it is dhcp, related static configuration won't take effect.
static_ip string Static ip address
gateway string Gateway address
network_prefix_length integer network mask length
dns string DNS address
dns2 string Optional; Also optional when ip_assignment is static ip, another DNS address
proxy_settings string Type of the proxy settings. "none", "static", "pac"; default is "none"
proxy_static_host string proxy address
proxy_static_port integer proxy port
proxy_static_exclusion_list string proxy exclusion list
proxy_pac_url string proxy PAC URL


  • Example
<ref src="smartapi:set_ethernet">
    <param name="ip_assignment" value="static"/>
    <param name="static_ip" value="192.168.0.138"/>
    <param name="gateway" value="192.168.0.1"/>
    <param name="network_prefix_length" value="24"/>
    <param name="dns" value="4.4.4.4"/>
    <param name="dns2" value="8.8.8.8"/>
    <param name="proxy_settings" value="static"/>
    <param name="proxy_static_host" value="proxy.example.com"/>
    <param name="proxy_static_port" value="8081"/>
    <param name="proxy_static_exclusion_list" value="example.com,mycom.test.com,localhost"/>             
</ref>
Set Ethernet to static IP


  • Example
<ref src="smartapi:set_ethernet">
    <param name="ip_assignment" value="dhcp"/>             
</ref>
Set Ethernet to DHCP

Enable/Disable Ethernet

  • Command
smartapi:set_etherent_state
  • Parameter
Parameter name Type of value Description
value string either "enabled", or "disabled"


  • Example

<ref src="smartapi:set_etherent_state">

   <param name="value" value="enabled"/>     

</ref> </source>

Enable ethernet

Connect to Wi-Fi

  • Command
smartapi:connect_wifi
  • Parameter
Key name Type of value Description
method string Always set as "connect"
ssid string MUST, a SSID of a wifi access point
password string Optional. The Password of the wifi access point specified by SSID
security string Optional. Can be one of following string: "wep", "psk", "eap", "none". if security is specified, all other configurations are manually set by the client
eap_method string string of EAP method defined in WifiEnterpriseConfig.Eap
eap_phase2_method string string of EAP Phase2 method defined in WifiEnterpriseConfig.Phase2
eap_identity string same as WifiEnterpriseConfig.setIdentity()
eap_password string same as WifiEnterpriseConfig.setPassword()
eap_anonymous string same as WifiEnterpriseConfig.setAnonymousIdentity
advanced JSON Object see "advanced content"


  • Example
<ref src="smartapi:connect_wifi">
    <param name="method" value="connect"/>
    <param name="ssid" value="qbictek"/>
    <param name="password" value="24776663"/>
</ref>
Connect to Wifi AP with password


  • Example
<ref src="smartapi:connect_wifi">
    <param name="method" value="connect"/>
    <param name="ssid" value="qbictek"/>
    <param name="security" value="psk"/>
    <param name="password" value="24776663"/>
</ref>
Connect to AP with security type

Enable/Disable Wi-Fi

  • Command
smartapi:set_wifi_state
  • Parameter
Parameter name Type of value Description
value string either "enabled", or "disabled"


  • Example
<ref src="smartapi:set_wifi_state">
    <param name="value" value="disabled"/>
</ref>
Disable Wifi

Set NTP server

  • Command
smartapi:ntp_server
  • Parameter
Key name Type of value Description
value string NTP server address


  • Example
<ref src="smartapi:ntp_server">
    <param name="value" value="fr.pool.ntp.org"/>
</ref>

Set reboot time

  • Command
smartapi:reboot_time
  • Parameter
Key name Type of value Description
value string Reboot time every day of device, format:"HH:MM"
  • Example
<ref src="smartapi:reboot_time">
    <param name="value" value="3:30"/>
</ref>

Set reboot optimized option

  • Command
smartapi:reboot_optimized
  • Parameter
Key name Type of value Description
value boolean ("true" or "false") Whether the reboot optimized or not, which means the device reboot time may vary around reboot time
  • Example
<ref src="smartapi:reboot_optimized">
    <param name="value" value="false"/>
</ref>

Set screen display on/off

  • Command
smartapi:display_state
  • Parameter
Key name Type of value Description
value boolean ("true" or "false") Whether the device's screen is on or not. The device is still active when screen is off.
  • Example
<ref src="smartapi:display_state">
    <param name="value" value="false"/>
</ref>
The display output will be turned off

Set content URL

  • Command
smartapi:content_url
  • Parameter
Key name Type of value Description
value string Content URL of SMIL Player. Need to restart SMIL Player to take effect.
  • Example
<ref src="smartapi:content_url">
     <param name="value" value="http://folk.uio.no/annembek/inf3210/examples/basic.smil"/>
</ref>

Enable/Disable adb

  • Command
smartapi:adb_enabled
  • Parameter
Key name Type of value Description
value boolean ("true" or "false") true if adb is enabled, otherwise false.
  • Example
<ref src="smartapi:adb_enabled">
    <param name="value" value="false"/>
</ref>

Set player name

  • Command
smartapi:player_name
  • Parameter
Key name Type of value Description
value string customized player name, which can be set by Settings API.
  • Example
<ref src="smartapi:player_name">
    <param name="value" value="Player101"/>
</ref>

Set screen orientation

  • Command
smartapi:screen_orientation
  • Parameter
Key name Type of value Description
value int Screen orientation for HDMI or LCD, 0 | 90 | 180 | 270, 0: 0 degree, 90: 90 degree, 180: 180 degree, 270: 270 degree.
  • Example
<ref src="smartapi:screen_orientation">
    <param name="value" value="90"/>
</ref>

Set ota xml url

  • Command
smartapi:ota_xml_url
  • Parameter
Key name Type of value Description
value string Remote firmware update (OTA) xml url. The device will auto connect to this url to perform firmware update if need.
  • Example
<ref src="smartapi:ota_xml_url">
    <param name="value" value="http://192.168.1.3/ota/devicename_v9.9.9.xml"/>
</ref>

Set led light color

  • Command
smartapi:light_control
  • Parameter
Key name Type of value Description
lightN string Key name for light: lightN where N = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10.

6-digit hex value: “#[[:xdigits:]]{6}”, CSS extended color keywords (case-insensitive).


  • Example
<ref src="smartapi:light_control">
    <param name="light1" value="#FF0000"/>
    <param name="light2" value="#00FF00"/>
</ref>

Set time zone

This is a list of time zones in the tz database release 2016b. The list is derived from the zones, links, and rules specified in zone.tab and the 7 "continent files" – africa, antarctica, asia, australasia, europe, northamerica, and southamerica. It also include other valid entries from the etcetera and backward files.

List of tz database time zones

  • Command
smartapi:time_zone
  • Parameter
Key name Type of value Description
value string Timezone of the device.
  • Example
<ref src="smartapi:time_zone">
    <param name="value" value="Europe/London"/>
</ref>

Set adb tcp port

  • Command
smartapi:prop_adb_tcp_port
  • Parameter
Key name Type of value Description
value int The tcp port for adb over tcp.
  • Example
<ref src="smartapi:prop_adb_tcp_port">
    <param name="value" value="5555"/>
</ref>

Set system stream volume

  • Command
smartapi:stream_system_vol
  • Parameter
Key name Type of value Description
value int 0~100, volume of stream music, which is defined in Android API.
  • Example
<ref src="smartapi:stream_system_vol">
    <param name="value" value="0"/>
</ref>

Set music stream volume

  • Command
smartapi:stream_music_vol
  • Parameter
Key name Type of value Description
value int 0~100, volume of stream music, which is defined in Android API.
  • Example
<ref src="smartapi:stream_music_vol">
    <param name="value" value="0"/>
</ref>

Set notification stream volume

  • Command
smartapi:stream_notification_vol
  • Parameter
Key name Type of value Description
value int 0~100, volume of stream notification , which is defined in Android API.
  • Example
<ref src="smartapi:stream_notification_vol">
    <param name="value" value="0"/>
</ref>

Set alarm stream volume

  • Command
smartapi:stream_alarm_vol
  • Parameter
Key name Type of value Description
value int 0~100, volume of stream alarm, which is defined in Android API.
  • Example
<ref src="smartapi:stream_alarm_vol">
    <param name="value" value="0"/>
</ref>

Reboot device

Reboot device when reboot command is executed.

  • Command
smartapi:reboot
  • Parameter

No parameter.

  • Example
<ref src="smartapi:reboot"/>

Shutdown device

Shutdown the device when clip source is played with shutdown command.

  • Command
smartapi:shutdown
  • Parameter

No parameter.

  • Example
<ref src="smartapi:shutdown"/>

Screen off

  • Command
smartapi:screen_off
  • Parameter

No parameter.

  • Example
<ref src="smartapi:screen_off"/>
Turn off screen when playable is alive.

Related