How to get roi and line value?

Answered

Comments

4 comments

  • Avatar
    IanKwon

    You can search for the values in the setting page, by its "name". 

    And this search and retrieve task is done by the function below:
    ConsumingDeviceAgent::settingValue(const std::string& settingName) const
    This function is in the consuming_device_agent, and since we each stream(deviceAgent) has inherited by this ConsumingDeviceAgent Class, we can use this function directely within your deviceAgent class without additional declaration or implementation.

    For example, if you want to save the point coordination of the secondary Polygon, into the DeviceAgent Class member variable, we can add some code like below. Under the settingsReceived() function.

    nx::sdk::Result<const nx::sdk::ISettingsResponse*> DeviceAgent::settingsReceived()
    { ...
    m_secondPolygonStr = settinvValue("polygon2.figure");
    ...
    }

    And when you print out what is in the m_secondPolygonStr, you may see some string set that contains value of the user input. I recommend you to print out that.

    0
    Comment actions Permalink
  • Avatar
    IanKwon

    You can search for the values in the setting page, by its "name". 

    And this search and retrieve task is done by the function below:
    ConsumingDeviceAgent::settingValue(const std::string& settingName) const
    This function is in the consuming_device_agent, and since we each stream(deviceAgent) has inherited by this ConsumingDeviceAgent Class, we can use this function directely within your deviceAgent class without additional declaration or implementation.

    For example, if you want to save the point coordination of the secondary Polygon, into the DeviceAgent Class member variable, we can add some code like below. Under the settingsReceived() function.

    nx::sdk::Result<const nx::sdk::ISettingsResponse*> DeviceAgent::settingsReceived()
    { ...
    m_secondPolygonStr = settinvValue("polygon2.figure");
    ...
    }

    And when you print out what is in the m_secondPolygonStr, you may see some string set that contains value of the user input. I recommend you to print out that.

    1
    Comment actions Permalink
  • Avatar
    高偉恆

    Hi Ian,

    Can I get the count of the repeater?

    0
    Comment actions Permalink
  • Avatar
    IanKwon

    In the Json String, you may see the "#" place holder when you use the "repeater". This is the placeholder for the count of the repeater. So, you can access to the specific counter by replacing the "#" into the specific number. 
    ex) 

    // Json string for the GUI
    name: "polygon#.figure"

    // DeviceAgent.cpp
    settingValue("polygon1.figure") // this returns all the information from the 1st repeater.
    settingValue("polygon2.figure") // this returns all the information from the 2nd repeater.
    ....

    And if you mean the total number of repeater that is enabled by user,

    I am not sure if it is possible or not.

    But It was okay to use, because if we are trying to access repeat counter which has not enabled by user,

    it is returning empty json string as a return value of settingValue() function.

    You may make own function that parse the Json String from the settingValue() function, so that distinguish it's value and status (activated or not) 

    1
    Comment actions Permalink

Please sign in to leave a comment.