1# Copyright 2013 The Android Open Source Project 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15import its.device 16import its.caps 17 18def main(): 19 """Basic test for bring-up of 3A. 20 21 To pass, 3A must converge. Check that the returned 3A values are legal. 22 """ 23 24 with its.device.ItsSession() as cam: 25 props = cam.get_camera_properties() 26 if not its.caps.read_3a(props): 27 print "Test skipped" 28 return 29 30 sens, exp, gains, xform, focus = cam.do_3a(get_results=True) 31 print "AE: sensitivity %d, exposure %dms" % (sens, exp/1000000) 32 print "AWB: gains", gains, "transform", xform 33 print "AF: distance", focus 34 assert(sens > 0) 35 assert(exp > 0) 36 assert(len(gains) == 4) 37 assert(len(xform) == 9) 38 assert(focus >= 0) 39 40if __name__ == '__main__': 41 main() 42 43