Module phone_detect
[hide private]
[frames] | no frames]

Module phone_detect

source code


Auto detect of phones.
This module provides functionality to perform auto-detection of connected phone.
To implement auto-detection for your phone, perform the following:

1.  If your phone can be determined by examining the Phone Manufacturer and
Phone Model values returned by +GMI and +GMM commands, just set the following
attributes in your Profile class:

phone_manufacturer='string'
phone_model='string'

The phone_manufacturer attribute will be checked for substring ie, 'SAMSUNG' in
'SAMSUNG ELECTRONICS CO.,LTD.'; phone_model must match exactly.

2.  If your phone detection scheme is more complex, define a staticmethod
'detectphone' in your Phone class.  The declaration of the method is:

def detectphone(ports, likely_ports, detect_dict)

ports: list of available ports returned from comscan
likely_ports: list of likely ports as returned from comdiagnose.islikelyport,
            ie ['com1', 'com2'].
where detect_dict is a dict with the following key/value pairs:
'port': {
'mode_modem': True if the phone can be set to modem mode, False otherwise
'mode_brew': True if the phone can be set to DM mode, False otherwise.  This
             value is not currently set since I'm not sure all phones can
             transition out of DM mode.
'manufacturer': string value returned by +GMI
'model': string value returned by +GMM
'firmware_version': string value returned by +GMR
'esn': ESN value of this phone, will be used to associate a name with it.
'firmwareresponse': response data based on BREW firmwarerequest command.
                    Currently not implemented.
}

If a possitive identification is made, method detectphone should return the
port associated with that phone, otherwise just return None.

Classes [hide private]
  DetectPhone