3.10. REST API#

The GMSL2-10GbE conversion module has REST API interface. The available API are described in this section.

3.10.1. Overview#

The connection destination is described in the below.

  • protocol: http

  • hostname: assigned-ip-address or kria-gmsl.local

  • Port: 3000

Therefore, the URI for the REST API is http://kria-gmsl.local:3000/<URI-path>.

In case the parameter is needed, it must be JSON format. it must be included in content-type header.

3.10.2. Available endpoints#

3.10.2.1. Reboot GMSL2-10Gb Ethernet board#

Description:

Reboot GMSL2-10Gb Ethernet board

Request:

POST /reboot-setup

Parameters:

N/A

example:

curl -X POST http://kria-gmsl.local:3000/reboot-setup

3.10.2.2. Setting up the number of camera#

Description:

Setting up number of camera

Request:

POST /setup-cam-num

Parameters:
  • cam_type: connected camera type (default:isx021)

    • isx021: C1

    • imx490: C2

  • num_p1: number of camera connected with port 1 (1~4, default:4)

  • num_p2: number of camera connected with port 2 (1~4, default:4)

example:

curl  -d '{"cam_type": "isx021", "num_p1": 1, "num_p2": 1}' -H "Content-Type: application/json" -X POST http://kria-gmsl.local:3000/setup-cam-num

Note

Nessesary to reboot GMSL2-10Gb Ethernet board after setting number of camera to apply above settings.

Attention

There are some points to note about connecting the camera. Please check this page for details.

3.10.2.3. Setting up the C1 camera#

Description:

Setting up the image output configurations for the C1 camera

Request:

POST /setup-cam1

Parameters:

N/A

example:

curl -X POST http://kria-gmsl.local:3000/setup-cam1

3.10.2.4. Setting up the C2 camera#

Description:

Setting up the image output configurations for the C2 camera

Request:

POST /setup-cam2

Parameters:

N/A

example:

curl -X POST http://kria-gmsl.local:3000/setup-cam2

3.10.2.5. Applying timestamp#

Description:

Configure the timestamp

Request:

POST /apply-timestamp

Parameters:
  • timestamp: Enable a custom timestamp or not.

    • 0: Disable

    • 1: Enable

  • frame: Position of the timestamp.

    • 0: End of the frame

    • 1: Start of the frame

  • timestamp_capture:

    • 0: RTP level

    • 1: trigger level

example:

curl -d '{"timestamp":"1","frame":"1"}' -H "Content-Type: application/json" -X POST http://kria-gmsl.local:3000/apply-timestamp

3.10.2.6. Configure the frame synchronization settings (all cameras)#

Description:

Configure the frame synchronization pulse settings (frequency, duty cycle and offset). This is applied for all cameras.

Request:

POST /command

Parameters:
  • frequency: Output frequency of the pulse.

  • duty_cycle: Duty cycle of the pulse.

  • offset: Offset

    The example of the parameter is shown in the below.

    {
    "data":{
        "trigger_mode":"triggered",
        "deserializers":{
            "p1":[
                {
                "frequency":"20",
                "duty_cycle":"20",
                "offset":"0"
                },
                {
                "frequency":"20",
                "duty_cycle":"20",
                "offset":"0"
                },
                {
                "frequency":"20",
                "duty_cycle":"20",
                "offset":"0"
                },
                {
                "frequency":"20",
                "duty_cycle":"20",
                "offset":"0"
                }
            ],
            "p2":[
                {
                "frequency":"20",
                "duty_cycle":"20",
                "offset":"10000000"
                },
                {
                "frequency":"20",
                "duty_cycle":"20",
                "offset":"20000000"
                },
                {
                "frequency":"20",
                "duty_cycle":"20",
                "offset":"25000000"
                },
                {
                "frequency":"20",
                "duty_cycle":"20",
                "offset":"30000000"
                }
            ]
        }
    }
    }
    

    To set the cameras for free-run mode, set the following parameters.

    {
    "data":{
        "trigger_mode":"free-running",
        "deserializers":{
            "p1":[
                {
                "frequency":"0",
                "duty_cycle":"20",
                "offset":"0"
                },
                {
                "frequency":"0",
                "duty_cycle":"20",
                "offset":"0"
                },
                {
                "frequency":"0",
                "duty_cycle":"20",
                "offset":"0"
                },
                {
                "frequency":"0",
                "duty_cycle":"20",
                "offset":"0"
                }
            ],
            "p2":[
                {
                "frequency":"0",
                "duty_cycle":"20",
                "offset":"0"
                },
                {
                "frequency":"0",
                "duty_cycle":"20",
                "offset":"0"
                },
                {
                "frequency":"0",
                "duty_cycle":"20",
                "offset":"0"
                },
                {
                "frequency":"0",
                "duty_cycle":"20",
                "offset":"0"
                }
            ]
        }
    }
    }
    
Example:

curl -H "Content-Type: application/json" -X POST http://kria-gmsl.local:3000/command -d @trigger.json

Assuming that the json above is stored as trigger.json

3.10.2.7. Configure the frame synchronization pulse for a single camera#

Description:

Configure the frame synchronization pulse settings (frequency, duty cycle and offset) for a single camera.

Request:

POST /save-single

Parameters:

{index, frequency, duty_cycle, offset, fsync_source}

Example:

3.10.2.8. Start streaming the C1 from P1#

Description:

Start image streaming of C1 camera from P1 port of the board.

Request:

POST /streaming-cam1-des1

Parameters:

N/A

Example:

curl -X POST http://kria-gmsl.local:3000/streaming-cam1-des1

3.10.2.9. Start streaming the C1 from P2#

Description:

Start image streaming of C1 camera from P2 port of the board.

Request:

POST /streaming-cam1-des2

Parameters:

N/A

Example:

curl -X POST http://kria-gmsl.local:3000/streaming-cam1-des2

3.10.2.10. Start streaming the C1 from both deserializer prot#

Description:

Start image streaming of C1 camera from both P1 and P2 port of the board.

Request:

POST /streaming-cam1-des12

Parameters:

N/A

Example:

curl -X POST http://kria-gmsl.local:3000/streaming-cam1-des12

3.10.2.11. Start streaming the C2 from P1#

Description:

Start image streaming of C2 camera from P1 port of the board.

Request:

POST /streaming-cam1-des2

Parameters:

N/A

Example:

curl -X POST http://kria-gmsl.local:3000/streaming-cam2-des1

3.10.2.12. Stop streaming#

Description:

Stop streaming the camera stream from all ports

Request:

POST /stop-streaming

Parameters:

N/A

Example:

curl -X POST http://kria-gmsl.local:3000/stop-streaming

3.10.2.13. Update System Time#

Note

The GMSL10GbEthernet board must be connected to the Internet.

Description:

Retrieves the local time via an HTTP request and updates the system time.

This is equivalent to corresponding GUI control

Request:

POST /update-time

Parameters:

N/A

Example:

curl -X POST http://kria-gmsl.local:3000/update-time

3.10.2.14. Start PTP-based synchronization#

Description:

Starts the ptp4l slave (client) program on eth0.

This is equivalent to corresponding GUI control

Request:

POST /sync-ptp

Parameters:

N/A

Example:

curl -X POST http://kria-gmsl.local:3000/sync-ptp

3.10.2.15. Sync System Clock to PHC#

Description:

Starts a program that updates the system clock based on the PHC time.

This is equivalent to corresponding GUI control

Request:

POST /sync-phc

Parameters:

N/A

Example:

curl -X POST http://kria-gmsl.local:3000/sync-phc

3.10.2.16. Stop PTP-based Synchronization#

Description:

Stops the ptp4l slave program.

This is equivalent to corresponding GUI control

Request:

POST /stop-ptp4l

Parameters:

N/A

Example:

curl -X POST http://kria-gmsl.local:3000/stop-ptp4l

3.10.2.17. Stop PHC to System#

Description:

Stops the PHC-based system.

This is equivalent to corresponding GUI control

Request:

POST /stop-phc2sys

Parameters:

N/A

Example:

curl -X POST http://kria-gmsl.local:3000/stop-phc2sys

3.10.2.18. Applying exposure settings for cameras#

Description:

Applying exposure time settings for each camera.

This is equivalent to corresponding GUI control

Request:

POST /apply-exposure-cam<X>

can be from 0 to 7.

Parameters:

expCam<X>: 0 - 33000, [usec]

Example:

curl -d '{"expCam0":11000}' -H "Content-Type: application/json" -X POST http://kria-gmsl.local:3000/apply-exposure-cam0

This sets camera 0 exposure time to 10msec.

3.10.2.19. Enabling / Disabling auto exposure#

Description:

Enabling / Disabling auto exposure settings for each camera.

This is equivalent to corresponding GUI control

Request:

POST /apply-auto-exposure-cam<X>

can be from 0 to 7.

Parameters:

autoExpCam<X>:

  • 0: Disable

  • 1: Enable

Example:

curl -d '{"autoExpCam0":1}' -H "Content-Type: application/json" -X POST http://kria-gmsl.local:3000/apply-auto-exposure-cam0

This enables auto exposure for camera 0

3.10.2.20. Enabling / Disabling distortion correction#

Description:

Enabling / Disabling distortion correction settings for each camera.

This is equivalent to corresponding GUI control

Request:

POST /apply-dist-corr-cam<X>

can be from 0 to 7.

Parameters:

distCorrCam<X>:

  • 0: Disable

  • 1: Enable

Example:

curl -d '{"distCorrCam0":1}' -H "Content-Type: application/json" -X POST http://kria-gmsl.local:3000/apply-dist-corr-cam0

This enables distortion correction for camera 0