Nella versione precedente di Extended View System (EVS) 1.0, i dispositivi fotocamera erano considerati dispositivi di sola lettura e, pertanto, non esisteva alcun metodo che consentisse all'app di modificare i parametri di controllo della fotocamera come zoom o luminosità.
Poiché ciò potrebbe limitare la capacità delle app EVS, il nuovo EVS 1.1 introduce nuovi metodi e consente all'app di programmare diversi parametri di controllo della fotocamera, tutti definiti enum CameraParam
:
/** * EVS Camera Parameter */ enum CameraParam : uint32_t { /** * The brightness of image frames */ BRIGHTNESS, /** * The contrast of image frames */ CONTRAST, /** * Automatic gain/exposure control */ AUTOGAIN, /** * Gain control */ GAIN, /** * Automatic Whitebalance */ AUTO_WHITE_BALANCE, /** * Manual white balance setting as a color temperature in Kelvin. */ WHITE_BALANCE_TEMPERATURE, /** * Image sharpness adjustment */ SHARPNESS, /** * Auto Exposure Control modes; auto, manual, shutter priority, or * aperture priority. */ AUTO_EXPOSURE, /** * Manual exposure time of the camera */ ABSOLUTE_EXPOSURE, /** * Set the focal point of the camera to the specified position. This * parameter may not be effective when auto focus is enabled. */ ABSOLUTE_FOCUS, /** * Enables continuous automatic focus adjustments. */ AUTO_FOCUS, /** * Specify the objective lens focal length as an absolute value. */ ABSOLUTE_ZOOM, };
I metodi sono definiti come:
/** * Requests to be a master client. * * When multiple clients subscribe to a single camera hardware and one of * them adjusts a camera parameter such as the contrast, it may disturb * other clients' operations. Therefore, the client must call this method * to be a master client. When it becomes a master, it can * change camera parameters until either it dies or explicitly gives up the * role. * * @return result EvsResult::OK if a master role is granted. * EvsResult::OWNERSHIP_LOST if there is already a * master client. */ setMaster() generates (EvsResult result); /** * Sets to be a master client forcibly. * * The client, which owns the display, has a high priority and can take over * a master role from other clients without the display. * * @param display IEvsDisplay handle. If this is valid, the calling client * is considered as the high priority client and therefore * it would take over a master role. * * @return result EvsResult::OK if a master role is granted. * EvsResult::OWNERSHIP_LOST if there is already a * master client with the display. */ forceMaster(IEvsDisplay display) generates (EvsResult result); /** * Retires from a master client role. * * @return result EvsResult::OK if this call is successful. * EvsResult::INVALID_ARG if the caller client is not a * master client. */ unsetMaster() generates (EvsResult result); /** * Retrieves a list of parameters this camera supports. * * @return params A list of CameraParam that this camera supports. */ getParameterList() generates (vec<CameraParam> params); /** * Requests a valid value range of a camera parameter * * @param id The identifier of camera parameter, CameraParam enum. * * @return min The lower bound of the valid parameter value range. * @return max The upper bound of the valid parameter value range. * @return step The resolution of values in valid range. */ getIntParameterRange(CameraParam id) generates (int32_t min, int32_t max, int32_t step); /** * Requests to set a camera parameter. * * @param id The identifier of camera parameter, * CameraParam enum. * value A desired parameter value. * @return result EvsResult::OK if it succeeds to set a parameter. * EvsResult::INVALID_ARG if either a requested * parameter is not supported or a given value is out * of bounds. * effectiveValue A programmed parameter value. This may differ * from what the client gives if, for example, the * driver does not support a target parameter. */ setIntParameter(CameraParam id, int32_t value) generates (EvsResult result, int32_t effectiveValue); /** * Retrieves a value of given camera parameter. * * @param id The identifier of camera parameter, CameraParam enum. * @return result EvsResult::OK if it succeeds to read a parameter. * EvsResult::INVALID_ARG if either a requested parameter is * not supported. * value A value of requested camera parameter. */ getIntParameter(CameraParam id) generates(EvsResult result, int32_t value);
getParameterList()
restituisce un elenco di parametri (enum CameraParam
) che un client può leggere e scrivere (se il client è un master) e getIntParameterRange()
trasmette l'intervallo di valori validi e la risoluzione. Quando un client principale modifica un parametro della telecamera, tutti gli altri client sullo stesso hardware della telecamera ricevono una notifica ricevendo un evento PARAMETER_CHANGED
con un ID parametro e un nuovo valore.
Nota: il driver del sensore potrebbe gestire i valori dei parametri non validi in modo diverso. Potrebbe semplicemente restituire un codice di errore o ritagliare il valore nell'intervallo valido e applicarlo. Pertanto, il metodo setIntParameter()
restituisce un valore effettivo e il client può utilizzare questo valore per confermare come è stata gestita la richiesta.
Richiedi arbitrato tra più client di telecamere
Poiché la precedente progettazione EVS consentiva a più app di iscriversi simultaneamente a un singolo hardware della fotocamera, è possibile che un'app possa disturbare le operazioni di altre app modificando un parametro della fotocamera. Inoltre, più client potrebbero voler regolare lo stesso parametro in modo diverso e quindi causare comportamenti imprevisti nell'esecuzione dei servizi della fotocamera.
Per evitare tali problemi, il gestore EVS consente solo al client principale di programmare un parametro della telecamera. Prima di provare a regolare qualsiasi parametro della telecamera, il client DEVE diventare un client master chiamando il metodo setMaster()
. Se fallisce, significa che c'è già un client master attivo sull'hardware della fotocamera. Fino a quando l'attuale client principale non muore o rinuncia esplicitamente al ruolo principale tramite unsetMaster()
, a nessun altro client è consentito modificare un parametro della fotocamera. Quando un client principale restituisce i suoi privilegi, tutte le altre app ricevono una notifica da un evento MASTER_RELEASED
.
Clienti con alta priorità
Il gestore EVS gestisce il client che possiede il display con la priorità alta e gli consente di rubare un ruolo di master a un master corrente. Poiché la proprietà del display EVS si basa sulla recency, il nuovo cliente può anche subentrare al cliente corrente con il display.
I client ad alta priorità devono chiamare IEvsCamera::forceMaster(sp<IEvsDisplay>& display)
per ottenere un ruolo master. Il gestore EVS esamina lo stato di un dato handle di visualizzazione e, se ( e solo se ) il suo stato è valido e né DisplayState::NOT_OPEN
né DisplayState::DEAD
sostituiscono un master. Il client, che perde semplicemente il ruolo di master, viene avvisato da un evento MASTER_RELEASED
e DEVE gestirlo correttamente.
Nella versione precedente di Extended View System (EVS) 1.0, i dispositivi fotocamera erano considerati dispositivi di sola lettura e, pertanto, non esisteva alcun metodo che consentisse all'app di modificare i parametri di controllo della fotocamera come zoom o luminosità.
Poiché ciò potrebbe limitare la capacità delle app EVS, il nuovo EVS 1.1 introduce nuovi metodi e consente all'app di programmare diversi parametri di controllo della fotocamera, tutti definiti enum CameraParam
:
/** * EVS Camera Parameter */ enum CameraParam : uint32_t { /** * The brightness of image frames */ BRIGHTNESS, /** * The contrast of image frames */ CONTRAST, /** * Automatic gain/exposure control */ AUTOGAIN, /** * Gain control */ GAIN, /** * Automatic Whitebalance */ AUTO_WHITE_BALANCE, /** * Manual white balance setting as a color temperature in Kelvin. */ WHITE_BALANCE_TEMPERATURE, /** * Image sharpness adjustment */ SHARPNESS, /** * Auto Exposure Control modes; auto, manual, shutter priority, or * aperture priority. */ AUTO_EXPOSURE, /** * Manual exposure time of the camera */ ABSOLUTE_EXPOSURE, /** * Set the focal point of the camera to the specified position. This * parameter may not be effective when auto focus is enabled. */ ABSOLUTE_FOCUS, /** * Enables continuous automatic focus adjustments. */ AUTO_FOCUS, /** * Specify the objective lens focal length as an absolute value. */ ABSOLUTE_ZOOM, };
I metodi sono definiti come:
/** * Requests to be a master client. * * When multiple clients subscribe to a single camera hardware and one of * them adjusts a camera parameter such as the contrast, it may disturb * other clients' operations. Therefore, the client must call this method * to be a master client. When it becomes a master, it can * change camera parameters until either it dies or explicitly gives up the * role. * * @return result EvsResult::OK if a master role is granted. * EvsResult::OWNERSHIP_LOST if there is already a * master client. */ setMaster() generates (EvsResult result); /** * Sets to be a master client forcibly. * * The client, which owns the display, has a high priority and can take over * a master role from other clients without the display. * * @param display IEvsDisplay handle. If this is valid, the calling client * is considered as the high priority client and therefore * it would take over a master role. * * @return result EvsResult::OK if a master role is granted. * EvsResult::OWNERSHIP_LOST if there is already a * master client with the display. */ forceMaster(IEvsDisplay display) generates (EvsResult result); /** * Retires from a master client role. * * @return result EvsResult::OK if this call is successful. * EvsResult::INVALID_ARG if the caller client is not a * master client. */ unsetMaster() generates (EvsResult result); /** * Retrieves a list of parameters this camera supports. * * @return params A list of CameraParam that this camera supports. */ getParameterList() generates (vec<CameraParam> params); /** * Requests a valid value range of a camera parameter * * @param id The identifier of camera parameter, CameraParam enum. * * @return min The lower bound of the valid parameter value range. * @return max The upper bound of the valid parameter value range. * @return step The resolution of values in valid range. */ getIntParameterRange(CameraParam id) generates (int32_t min, int32_t max, int32_t step); /** * Requests to set a camera parameter. * * @param id The identifier of camera parameter, * CameraParam enum. * value A desired parameter value. * @return result EvsResult::OK if it succeeds to set a parameter. * EvsResult::INVALID_ARG if either a requested * parameter is not supported or a given value is out * of bounds. * effectiveValue A programmed parameter value. This may differ * from what the client gives if, for example, the * driver does not support a target parameter. */ setIntParameter(CameraParam id, int32_t value) generates (EvsResult result, int32_t effectiveValue); /** * Retrieves a value of given camera parameter. * * @param id The identifier of camera parameter, CameraParam enum. * @return result EvsResult::OK if it succeeds to read a parameter. * EvsResult::INVALID_ARG if either a requested parameter is * not supported. * value A value of requested camera parameter. */ getIntParameter(CameraParam id) generates(EvsResult result, int32_t value);
getParameterList()
restituisce un elenco di parametri (enum CameraParam
) che un client può leggere e scrivere (se il client è un master) e getIntParameterRange()
trasmette l'intervallo di valori validi e la risoluzione. Quando un client principale modifica un parametro della telecamera, tutti gli altri client sullo stesso hardware della telecamera ricevono una notifica ricevendo un evento PARAMETER_CHANGED
con un ID parametro e un nuovo valore.
Nota: il driver del sensore potrebbe gestire i valori dei parametri non validi in modo diverso. Potrebbe semplicemente restituire un codice di errore o ritagliare il valore nell'intervallo valido e applicarlo. Pertanto, il metodo setIntParameter()
restituisce un valore effettivo e il client può utilizzare questo valore per confermare come è stata gestita la richiesta.
Richiedi arbitrato tra più client di telecamere
Poiché la precedente progettazione EVS consentiva a più app di iscriversi simultaneamente a un singolo hardware della fotocamera, è possibile che un'app possa disturbare le operazioni di altre app modificando un parametro della fotocamera. Inoltre, più client potrebbero voler regolare lo stesso parametro in modo diverso e quindi causare comportamenti imprevisti nell'esecuzione dei servizi della fotocamera.
Per evitare tali problemi, il gestore EVS consente solo al client principale di programmare un parametro della telecamera. Prima di provare a regolare qualsiasi parametro della telecamera, il client DEVE diventare un client master chiamando il metodo setMaster()
. Se fallisce, significa che c'è già un client master attivo sull'hardware della fotocamera. Fino a quando l'attuale client principale non muore o rinuncia esplicitamente al ruolo principale tramite unsetMaster()
, a nessun altro client è consentito modificare un parametro della fotocamera. Quando un client principale restituisce i suoi privilegi, tutte le altre app ricevono una notifica da un evento MASTER_RELEASED
.
Clienti con alta priorità
Il gestore EVS gestisce il client che possiede il display con la priorità alta e gli consente di rubare un ruolo di master a un master corrente. Poiché la proprietà del display EVS si basa sulla recency, il nuovo cliente può anche subentrare al cliente corrente con il display.
I client ad alta priorità devono chiamare IEvsCamera::forceMaster(sp<IEvsDisplay>& display)
per ottenere un ruolo master. Il gestore EVS esamina lo stato di un dato handle di visualizzazione e, se ( e solo se ) il suo stato è valido e né DisplayState::NOT_OPEN
né DisplayState::DEAD
sostituiscono un master. Il client, che perde semplicemente il ruolo di master, viene avvisato da un evento MASTER_RELEASED
e DEVE gestirlo correttamente.