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 15 import its.device 16 17 def main(): 18 """Basic test for bring-up of 3A. 19 20 To pass, 3A must converge. Check that the returned 3A values are legal. 21 """ 22 23 with its.device.ItsSession() as cam: 24 rect = [0,0,1,1] 25 sens, exp, gains, xform, focus = cam.do_3a(rect, rect, rect) 26 print "AE: sensitivity %d, exposure %dms" % (sens, exp/1000000) 27 print "AWB: gains", gains, "transform", xform 28 print "AF: distance", focus 29 assert(sens > 0) 30 assert(exp > 0) 31 assert(len(gains) == 4) 32 assert(len(xform) == 9) 33 assert(focus > 0) 34 35 if __name__ == '__main__': 36 main() 37 38