def _get_supported_params()

in camera-sdk/iotccsdk/camera.py [0:0]


    def _get_supported_params(self):
        """
        Private method for getting preview params

        This method populates the `resolutions`, `encodetype`, `bitrates`
        and `framerates` attribute. It is called by the `CameraClient` constructor.

        Returns
        -------
        bool
            True if the request is successful. False on failure.

        """
        path = "/video"
        payload = {}
        response = self.ipc_provider.get(path, payload)
        if response["status"]:
            self.resolutions = response["resolution"]
            r_idx = response["resolutionSelectVal"]
            self.cur_resolution = self.resolutions[r_idx]
            self.encodetype = response["encodeMode"]
            e_idx = response["encodeModeSelectVal"]
            self.cur_codec = self.encodetype[e_idx]
            self.bitrates = response["bitRate"]
            b_idx = response["bitRateSelectVal"]
            self.cur_bitrate = self.bitrates[b_idx]
            self.framerates = response["fps"]
            f_idx = response["fpsSelectVal"]
            self.cur_framerate = self.framerates[f_idx]
            self.display_out = response["displayOut"]

            self.logger.info("resolutions: %s" % self.resolutions)
            self.logger.info("encodetype: %s" % self.encodetype)
            self.logger.info("bitrates: %s" % self.bitrates)
            self.logger.info("framerates: %s" % self.framerates)

            self.logger.info("Current preview settings:")
            self.logger.info("resolution: %s" % self.cur_resolution)
            self.logger.info("encodetype: %s" % self.cur_codec)
            self.logger.info("bitrate: %s" % self.cur_bitrate)
            self.logger.info("framerate: %s" % self.cur_framerate)
            self.logger.info("display_out: %s" % self.display_out)

        return response["status"]