# Admin API - Command References
Commands are implemented in each applications and plugins. These are accessible throught the commandline, or **Admin core RPC** endpoint.
### AdminEmbedded commands (core admin)
| Command | Description | example |
| -------------------------------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
| hello(STRINGFORCALLBACK) | test communication, permit to validate the communication with the admin embedded | hello('world') |
| get_application_list() | list available applications | get_application_list() |
| get_machine_id() | get the machine id, this is string taken from the CPUID is it exists | get_machine_id() |
| list_services() | list all available services | |
| call_service(SERVICENAME, SERVICEMETHOD, args ...) | call service command with following arguments | call_service("wifi", "hello", "world") |
| send_event(SENDER, EVENTNAME, EVENTDATA) | broacast an event to all services | |
| deploy_app(BUNDLEID) | deploy an application | take the application from the BUNDLEID folder from the "bundled_factory_apps" and deploy it to the deployed_application folder, to permit the configuration |
| undeploy_app(APPLICATION_ID) | undeploy an application | remove the application |
| activate_app(APPLICATION_ID, PARAMETERS) | activate by configuring the application | PARAMETERS are overloading the factory ones |
| deactivate_app(APPLICATION_ID) | deactivate the application | deactivate a deployed application, using its applicationid |
| start_app(APPLICATION_ID) | start the application | once the application is deployed and activated, start ir (start the process and monitor it),
Optional parameter (managed (booolean)), this parameter explain the process must not be managed |
| stop_app(APPLICATION_ID) | stop the application | |
| get_app_status() | get current app running status (from the last inspection) | get_app_status() |
| execute_command(COMMAND) | execute the command contained in the string, and give the result back | ../../target/debug/admincli -c "execute_command('hello(\\'baba\\')')"
=== AdminCli ===
connect to adminembedded and send command: execute_command('hello(\\'baba\\')')
Received response : Handler function says: Hello, baba! |
| reset_factory(FILE_WITH_COMMANDS) | stop all services, clean the deployed elements, and execute the given command file | |
| describe_plugin(PLUGIN_OR_SERVICE) | This function will return the methods and parameters associated to a plugin. | Note : some plugin / service might not implement the describe_plugin endpoint |
### RTCTime (service "time")
| Command | Description | example |
| ------------------- | ----------------------------------- | ------- |
| get_time() | get the rtc time | |
| query_remote_time() | return the remote time (ntp driven) | |
| | | |
See [RTCTime Service](../services/rtstimeservices-1.0.md)
### Powermanagement (service "power")
| Command | Description | example |
| -------------------------- | ------------------------------------------------------------ | ------- |
| switch_battery_mode() | | |
| powerdown(next_awake_date) | schedule the next wake up and powerdown | |
| get_power_mode() | get the current power management mode (powered / battery)
0 -> Powered mode
1 -> Battery mode | |
| watchdog() | tell the powermanagement to credit more time to stay alive | |
| get_power_consumption() | retrieve the battery accumulator register | |
### Wifiservice commands (service "wifi")
| Command | Description | example |
| --------------------------------- | ----------------------------------------- | ------------------------------------------------------------ |
| activate(ssid, password) | activate wifi | |
| deactivate() | deactivate wifi | |
| list_networks() | return the network list | call_service('wifi','list_networks')
[{\"signal\":\"-13.00 dBm\",\"ssid\":\"freebox_pf\"},{\"signal\":\"-41.00 dBm\",\"ssid\":\"FreeWifi_secure\"},{\"signal\":\"-58.00 dBm\",\"ssid\":\"Livebox-C400\"},{\"signal\":\"-74.00 dBm\",\"ssid\":\"SoundBarSetup_CC0D\"},{\"signal\":\"-75.00 dBm\",\"ssid\":\"Livebox-3FD0\"},{\"signal\":\"-64.00 dBm\",\"ssid\":\"Livebox-E4B8_wifi_invite\"},{\"signal\":\"-65.00 dBm\",\"ssid\":\"Freebox-41EC5A\"},{\"signal\":\"-74.00 dBm\",\"ssid\":\"FreeWifi_secure\"},{\"signal\":\"-79.00 dBm\",\"ssid\":\"Livebox-5730\"},{\"signal\":\"-78.00 dBm\",\"ssid\":\"ECOVACS0000\"},{\"signal\":\"\",\"ssid\":\"Bbox-D2BCDF74\"}] |
| get_ip_address() | return the wifi wlan ipaddress | call_service('wifi', 'get_ip_address')
String("192.168.4.193") |
| activate_ap(AP_SSID, AP_PASSWORD) | create an access point for the enrollment | |
### Transfers service commands (service "transfer")
Transfert service permit to transfert some elements from local to remote and associated
| Command | Description | example |
| ------------------------------------------- | ------------------------------------------------------------ | ------- |
| download(source_ref, sink_path) | download file from the remote repository to local sink_path | |
| upload(source_ref, sink_path) | upload file/folder from the source_ref to remote sink_path | |
| remove_on_remote(sink_path) | remove some file/folder on remote (used for message passing) | |
| download_single_file(remote_ref, local_ref) | download a single file (without any browsing on remote) | |
| http_request(url, method, headers, body) | send a single http request | |
### eink commands (service eink)
| Command | Description | example |
| ---------------------------------------------------------- | ------------------------------------------------------------ | ------- |
| hello | hello / test method to check connectivity | |
| eink_display | first parameter is the BMP file to send to the screen | |
| eink_display_svg(SVG_CONTENT) | render a given svg onto the screen | |
| eink_display_template(SVG_FILE, JSON_ENCODED_PARAMETERS) | this render a templated svg, with the following parameters | |
| eink_display_draw(DRAWINSTRUCTIONS, OUTPUT_EINK_FILE_PATH) | execute the json DRAWINSTRUCTIONS and generate an output eink file (that can be displayed using the eink_display function) | |
| eink_display_test_colors() | display a test image | |
Several command example :
```
./admincli -c 'call_service("eink","eink_display_template","/home/use/projets/2024-07-17_rsiotnode/output/x64/apps/deployed_applications/supervisor-1.0/enrollment.svg", "[]")'
```
### Scheduler commands (service "scheduler")
the scheduler plugin is responsible for getting jobs to be done at a specific time, and monitoring the result.
| Command | Description | example |
| ------------------------------------------------------------ | ------------------------------------------------------------ | -------------------------------------- |
| get_jobs(ONLY_ACTIVES_JOBS) | return the job description, takes a boolean in parameter | get_jobs(False) |
| get_next_execution_time(JOBID) | return the next date for the job execution | get_next_execution_time(1) |
| get_next_execution_time_for_all_jobs() | return all the next execution date for all active jobs | get_next_execution_time_for_all_jobs() |
| commit_job_execution(job_id, executiontime, status, result) | commit the execution of a job,
**job_id** is a string identifying the job
**execution time** is the executed time, in string format (2024-09-19T00:00Z)
**status** is an integer | |
| update_or_create_job(job_name, executed_expression,cron, activated ) | Create or update a job with the associated elements | |
| remove_job(job_name) | remove the given existing job | |
### Monitoring commands (service "monitoring")
Monitor plugin is responsible to grab actions from the central, and apply them , using the admin API.
| Command | Description | example |
| --------------------------------- | ------------------------------------------------------------ | ------- |
| upload_monitoring() | ask the service the status, and upload the monitoring status to the transmitted content. | |
| process_administrative_commands() | download the administrative commands to process and execute them, the result will be located in the status folder, uploaded | |
### NetworkManager commands (service "networkmanager")
| Command | Description | example |
| -------------------- | ------------------------------------------------- | ------- |
| check_connectivity() | check if network is connected, by a specific mean | |
### Bluetooth(BT), serial connection
there are no associated commands, the bluetooth is activated as the service is running (started), one can then connect to the device and send some commands.
### GPIO Service, (service "gpio")
The gpio service permit to activate some general purpose input/output from the device
| Command | Description | example |
| --------------------------------- | -------------------------------------------------------- | ------- |
| set_gpio(gpio_number, gpio_value) | Define a gpio value (output) | |
| get_gpio(gpio_number) | return the read value from gpio (configured as read pin) | |