Home | History | Annotate | Download | only in audio
      1 # Copyright 2017 The Chromium OS Authors. All rights reserved.
      2 # Use of this source code is governed by a BSD-style license that can be
      3 # found in the LICENSE file.
      4 
      5 """This module provides the test utilities for audio spec."""
      6 
      7 _BOARD_TYPE_CHROMEBOX = 'CHROMEBOX'
      8 _BOARD_TYPE_CHROMEBIT = 'CHROMEBIT'
      9 
     10 def has_internal_speaker(board_type, board_name):
     11     """Checks if a board has internal speaker.
     12 
     13     @param board_type: board type string. E.g. CHROMEBOX, CHROMEBIT, and etc.
     14     @param board_name: board name string.
     15 
     16     @returns: True if the board has internal speaker. False otherwise.
     17 
     18     """
     19     if ((board_type == _BOARD_TYPE_CHROMEBOX and board_name != 'stumpy')
     20             or board_type == _BOARD_TYPE_CHROMEBIT):
     21         return False
     22     return True
     23 
     24 
     25 def has_internal_microphone(board_type):
     26     """Checks if a board has internal microphone.
     27 
     28     @param board_type: board type string. E.g. CHROMEBOX, CHROMEBIT, and etc.
     29 
     30     @returns: True if the board has internal microphone. False otherwise.
     31 
     32     """
     33     if (board_type == _BOARD_TYPE_CHROMEBOX
     34             or board_type == _BOARD_TYPE_CHROMEBIT):
     35         return False
     36     return True
     37 
     38 
     39 def has_headphone(board_type):
     40     """Checks if a board has headphone.
     41 
     42     @param board_type: board type string. E.g. CHROMEBOX, CHROMEBIT, and etc.
     43 
     44     @returns: True if the board has headphone. False otherwise.
     45 
     46     """
     47     if board_type == _BOARD_TYPE_CHROMEBIT:
     48         return False
     49     return True
     50