Ruben Brunk | 370e243 | 2014-10-14 18:33:23 -0700 | [diff] [blame] | 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 | import its.caps |
| 17 | |
| 18 | def 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() |
Chien-Yu Chen | bad96ca | 2014-10-20 17:30:56 -0700 | [diff] [blame] | 26 | its.caps.skip_unless(its.caps.read_3a(props)) |
Ruben Brunk | 370e243 | 2014-10-14 18:33:23 -0700 | [diff] [blame] | 27 | |
| 28 | sens, exp, gains, xform, focus = cam.do_3a(get_results=True) |
| 29 | print "AE: sensitivity %d, exposure %dms" % (sens, exp/1000000) |
| 30 | print "AWB: gains", gains, "transform", xform |
| 31 | print "AF: distance", focus |
| 32 | assert(sens > 0) |
| 33 | assert(exp > 0) |
| 34 | assert(len(gains) == 4) |
| 35 | assert(len(xform) == 9) |
| 36 | assert(focus >= 0) |
| 37 | |
| 38 | if __name__ == '__main__': |
| 39 | main() |
| 40 | |