Python CLI#

module arvcli#
AravisDetector CLI.

Variables

__app_name__ = "arvcli"#
__version__ = "0.0.1"#
module __main__#

Functions

main()#
module cli#

Functions

convert_type(str s)#
Converts a string to the closest type
_version_callback(bool value)#
Returns current cli version
_get_callback(str path=None)#
Callback function that wraps get_value

Prints out the value returned by get_value and exits.

Args:
    key: (silly_enum): a cmd_map key (maps cli command to http request)
_put_callback(str path=None)#
Callback function that wraps put_value

Prints out the value returned by put_value and exits.

Args:
    key: (silly_enum): a cmd_map key (maps cli command to http request)
get_value(str path_temp)#
Get a frame processor value using a path

Separates the path into the http request path and the json request
Sends a put request
Parses the json response
Returns the target value

Args:
    path_temp (str): /fp/status/variable

Returns:
    dictionary/single value
put_value(str path_temp=None, str value=None)#
Workflow:

if path is aravis/configure/<target> then does a direct call

otherwise it separates it into a http path and a json tree
then send the json tree as the http put request
_status_callback(bool val)#
Returns the server status in json format and exits

Args:
    val (bool): true when called
_config_callback(bool val)#
Returns the server config in json format and exits

Args:
    val (bool): true when called
_ipaddress_callback(str val)#
Sets the ip address of the odin server

Requires a command

Args:
    val (str): ip address
_port_callback(str val)#
Sets the port of the odin server

Requires a command

Args:
    val (str): port
connect(Optional[str] camera_ip=typer.Option(None, "-ip", "--ip_address", help="connect to camera with ip address"), Optional[bool] list=typer.Option(None, "-l", "--list", help="list all the cameras detected"))#
Connects the AravisDetector plugin to a camera.
stream(Optional[bool] start=typer.Option(None, "-on", "--start", help="start acquiring frames in continuous mode"), Optional[bool] stop=typer.Option(None, "-off", "--stop", help="stop acquiring frames in continuous mode"), Optional[int] n_frames=typer.Option(None, "-c", "--capture", help="Acquire a fixed number of frames in continuous mode", ))#
Control camera frame acquisition in continuous mode
hdf(Optional[bool] start=typer.Option(None, "-s", "--start", help="start file writer"), Optional[bool] stop=typer.Option(None, "-s", "--stop", help="stop the file writer"), Optional[bool] start_writing=typer.Option(None, "-w", "--write", help="start file writer and start acquisition"), Optional[bool] stop_writing=typer.Option(None, "-sw", "--stopW", help="stop file writer and acquisition"), Optional[str] file_name=typer.Option(None, "-f", "--file", help="saving file name"), Optional[str] file_path=typer.Option(None, "-p", "--path", help="path to the directory"), Optional[int] num=typer.Option(None, "-n", "--num", help="number of files to save"))#
Control the file writer plugin

path and num default to config values

name default to current time in run_seconds_minute_hour_day_month_year format
http(Optional[str] put=typer.Option(None, "-p", "--put", help="send a command to the server"), Optional[str] value=typer.Option(None, "-v", "--value", help="value to send to server"), Optional[str] get=typer.Option(None, "-g", "--get", help="request information from the server"))#
send custom HTTP requests

Use this for trouble shooting and custom functions

Api requests are of the following form:

/api/0.1/aravis/config/start_acquisition

/api/0.1/aravis/config/stop_acquisition

/api/0.1/aravis/config/exposure_time

/api/0.1/fp/config/hdf/write

/api/0.1/fp/config/hdf/file/path

/api/0.1/fp/config/hdf/file/name

/api/0.1/fp/config/hdf/master
initiate_config()#
Read config file and create global variable
main(Optional[bool] status=typer.Option(None, "--status", "-s", case_sensitive=False, help="Print current status values of all plugins", callback=_status_callback, ), Optional[bool] config=typer.Option(None, "--config", "-c", case_sensitive=False, help="Print current config values of all plugins", callback=_config_callback, ), Optional[str] ipaddress=typer.Option(None, "--ip", "-i", case_sensitive=False, help="Specify an ip address for the server", callback=_ipaddress_callback, is_eager=True, ), Optional[str] port=typer.Option(None, "--port", "-po", case_sensitive=False, help="Specify a port for the server", callback=_port_callback, is_eager=True, ), Optional[str] g=typer.Option(None, "--get", "-g", case_sensitive=False, help=("Print a specific value. Paths must be of the form: fp/{status/ config / aravis}/"+"<target> or aravis/{config/status}/<target>"), callback=_get_callback, ), Optional[str] p=typer.Option(None, "--put", "-p", case_sensitive=False, help=("Change a specific value. Paths must be of the "+"form: fp/config/aravis/<target> or aravis/config/<target>"), callback=_put_callback, ), Optional[bool] version=typer.Option(None, "--version", "-v", help="Display arvcli's current version and exit", callback=_version_callback, is_eager=True, ))#
Python CLI for Aravis-Detector Plugin

For command detail call arvcli <command> --help

Variables

APP_NAME = "arvcli"#
app = typer.Typer()#
module control#

Functions

put_HTTP_request(str request, int value, str server_address, str port)#
get_HTTP_request(str request, str server_address, str port)#