एक्सटेंडेड व्यू सिस्टम (ईवीएस) 1.0 के पिछले वर्शन में, कैमरा डिवाइसों को रीड-ओनली डिवाइस माना जाता था. इसलिए, कोई भी ऐसा तरीका मौजूद नहीं था जिससे ऐप्लिकेशन, ज़ूम या चमक जैसे कैमरे के कंट्रोल पैरामीटर में बदलाव कर सके.
इससे ईवीएस ऐप्लिकेशन की सुविधाओं पर असर पड़ सकता है. इसलिए, ईवीएस 1.1 में नए तरीके पेश किए गए हैं. इनकी मदद से, ऐप्लिकेशन कई कैमरा कंट्रोल पैरामीटर को प्रोग्राम कर सकता है. इन सभी पैरामीटर के बारे में 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, };
तरीकों को इस तरह से परिभाषित किया गया है:
/** * 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()
, पैरामीटर की सूची (CameraParam
enum) दिखाता है, जिसे क्लाइंट पढ़ और लिख सकता है (अगर क्लाइंट एक मास्टर है). साथ ही, getIntParameterRange()
मान्य वैल्यू की रेंज और रिज़ॉल्यूशन दिखाता है.
जब कोई मास्टर क्लाइंट किसी कैमरे के पैरामीटर में बदलाव करता है, तो उसी कैमरे के हार्डवेयर पर मौजूद सभी अन्य क्लाइंट को इसकी सूचना दी जाती है. इसके लिए, पैरामीटर आईडी और नई वैल्यू के साथ PARAMETER_CHANGED
इवेंट भेजा जाता है.
ध्यान दें: सेंसर ड्राइवर, अमान्य पैरामीटर वैल्यू को अलग-अलग तरीके से मैनेज कर सकता है. यह सिर्फ़ गड़बड़ी का कोड दिखा सकता है या वैल्यू को मान्य रेंज में क्लिप करके लागू कर सकता है. इसलिए, setIntParameter()
तरीका एक असरदार वैल्यू दिखाता है. क्लाइंट इस वैल्यू का इस्तेमाल करके, यह पुष्टि कर सकता है कि अनुरोध को कैसे मैनेज किया गया.
एक से ज़्यादा कैमरा क्लाइंट के बीच मध्यस्थता का अनुरोध करना
ईवीएस के पिछले डिज़ाइन में, एक से ज़्यादा ऐप्लिकेशन को एक ही कैमरा हार्डवेयर की सदस्यता लेने की अनुमति थी. इसलिए, हो सकता है कि कोई ऐप्लिकेशन, कैमरे के पैरामीटर में बदलाव करके, दूसरे ऐप्लिकेशन के काम करने में रुकावट डाले. इसके अलावा, एक ही पैरामीटर में कई क्लाइंट अलग-अलग तरीके से बदलाव कर सकते हैं. इससे, कैमरे की सेवाओं में अनचाहे बदलाव हो सकते हैं.
ऐसी समस्याओं से बचने के लिए, EVS मैनेजर सिर्फ़ मास्टर क्लाइंट को कैमरा पैरामीटर प्रोग्राम करने की अनुमति देता है. किसी भी कैमरा पैरामीटर में बदलाव करने से पहले, क्लाइंट को setMaster()
विधि को कॉल करके, मास्टर क्लाइंट बनना ज़रूरी है. अगर ऐसा नहीं होता है, तो इसका मतलब है कि उस कैमरे के हार्डवेयर पर पहले से ही एक चालू मास्ट क्लाइंट मौजूद है. जब तक मौजूदा मास्ट क्लाइंट की लाइफ़ खत्म नहीं हो जाती या वह unsetMaster()
के ज़रिए साफ़ तौर पर मास्ट की भूमिका छोड़ नहीं देता, तब तक किसी दूसरे क्लाइंट को कैमरे के पैरामीटर में बदलाव करने की अनुमति नहीं है. जब कोई मुख्य क्लाइंट अपने ऐक्सेस लेवल को वापस कर देता है, तो सभी अन्य ऐप्लिकेशन को MASTER_RELEASED
इवेंट से इसकी सूचना दी जाती है.
ज़्यादा प्राथमिकता वाले क्लाइंट
EVS मैनेजर, डिसप्ले का मालिकाना हक रखने वाले क्लाइंट को सबसे ज़्यादा प्राथमिकता देता है. साथ ही, उसे मौजूदा मास्टर से मास्टर की भूमिका छीनने की अनुमति देता है. ईवीएस डिसप्ले का मालिकाना हक, डिसप्ले के इस्तेमाल की तारीख पर आधारित होता है. इसलिए, नया क्लाइंट, डिसप्ले के मौजूदा क्लाइंट की जगह ले सकता है.
मुख्य भूमिका पाने के लिए, ज़्यादा प्राथमिकता वाले क्लाइंट को IEvsCamera::forceMaster(sp<IEvsDisplay>& display)
कॉल करना होगा. ईवीएस मैनेजर, किसी डिसप्ले हैंडल की स्थिति की जांच करता है. अगर (और सिर्फ़ तब) उसकी स्थिति मान्य है और DisplayState::NOT_OPEN
और DisplayState::DEAD
, दोनों में से कोई भी किसी मास्टर को बदलता नहीं है, तो ईवीएस मैनेजर, डिसप्ले हैंडल को बदल देता है. जिस क्लाइंट की सिर्फ़ मास्टर भूमिका हटाई गई है उसे MASTER_RELEASED
इवेंट से सूचना दी जाती है. साथ ही, उसे इस इवेंट को सही तरीके से मैनेज करना ज़रूरी है.