CAccMonitor Class Reference
Link against: accmonitor.lib
#include <AccMonitor.h>
Detailed Description
The Accessory Monitoring API interface offers accessory information about connected accessories.
It also offers an easy-to-use implementation of a CActive-based wrapper for accessory connection status changed event notifications. The clients can get information about the connected accessories capabilities and, if the capabilities have values, get the values from these capabilites. This API consist of classes CAccMonitor, CAccMonitorInfo and MAccMonitorObserver. If the user wants to use the observer this API offers, the user has to implement callback function for receiving accessory connection and disconnection status notifications. The connected accessories are offered to the client in an array. This array presents the connected accessories as instances of CAccMonitorInfo class. The CAccMonitorInfo offers accessory information encapsulated to a class. It presents accessory device type, physical connection and device address information with basic getter functions. The rest of the accessories features are contained in an array. This array can be accessed with functions that are in CAccMonitorInfo. This class is not intended for user derivation.
Usage:
Example query for some accessory's information. All connected accessories are fetched and the instance of CAccessoryInfo is getted:
Example query for some accessorys capabilties. The user has fetched the CAccMonitorInfo to accInfo instance from connected accessories:
Initialization example for the observer(from a class that implements MAccMonitorObserver interface). Observer starts to listen for headset connects:
Uninitialization example:
Connected method implementation example:
void CMyAccMonitorTest::Connected( CAccMonitorInfo* aAccessoryInfo )
{
iAccessoryInfo->CopyL( aAccessoryInfo );
}
- Dll AccMonitor.lib
- Since:
- S60 5.0
Constructor & Destructor Documentation
CAccMonitor::CAccMonitor | ( | | ) | [protected] |
|
Member Function Documentation
virtual void CAccMonitor::ConstructL | ( | | ) | [protected, pure virtual] |
|
|
Symbian OS 2nd phase constructor.
|
virtual void CAccMonitor::GetCapabilityValueL | ( | const CAccMonitorInfo * | aInfo, | | | const TUint32 | aCapability, | | | TInt & | aValue | | ) | const [pure virtual] |
|
|
Gets the value for a capability that is defined in Accessory Monitoring API.
- Parameters:
-
| aAccInfo | is the accessory for which the value needs to be fetched. | | aCapability | is capability which value needs to be fetched. | | aValue | is the value for the capability. |
- Leave:
- KErrNotFound if no capability is not defined for this accessory, KErrArgument if this accessory is not connected, otherwise standard Symbian error code.
|
virtual TInt CAccMonitor::GetConnectedAccessoriesL | ( | RConnectedAccessories & | aAccessoriesArray | ) | const [pure virtual] |
|
|
Used to get the connected accessories which are returned in an RPointerArray that is typed to RConnectedAccessories.
- Parameters:
-
| aAccessoriesArray | is a reference to an array that is filled with CAccMonitorInfo instances which are accessories connected to the S60 device. |
- Leave:
- KErrNotFound if no accessories are connected. KErrNotReady if a device is not ready to start operation.
- Returns:
- The amount of connected accessories.
|
virtual TBool CAccMonitor::IsObserving | ( | | ) | const [pure virtual] |
|
|
Checks whether observer is already observing.
- Returns:
- ETrue if observing
|
static IMPORT_C CAccMonitor* CAccMonitor::NewL | ( | | ) | [static] |
|
|
Symbian two phased constructor.
|
static IMPORT_C CAccMonitor* CAccMonitor::NewLC | ( | | ) | [static] |
|
|
Symbian two phased constructor.
Puts the instance to cleanup stack. |
|
Sets observer to listen connect/disconnect accessory notifications and starts the observer.
Accessories that need to be listened can be defined. - Parameters:
-
| aObserver | is the pointer to the callback functions. | | aCapabilityArray | is an array of capabilities. Accessory type that needs to be listened is constructed with this capability array. For exmple if KAccMonHeadset capability is inserted to the array the observer receives all notifications about connected/disconnected headsets. If an empty array is set as parameter no notifications are sent to the observer. |
- Leave:
- TInt KErrAlreadyExists if observer is active already, otherwise KErrNone or standard Symbian error code.
|
|
Sets observer to listen connect/disconnect accessory notifications and starts the observer.
Accessories that need to be listened can be defined with CAccMonitorInfo. This CAccMonitorInfo represents an instance of some connected or previously connected accessory. - Parameters:
-
| aObserver | is the pointer to the callback functions. | | aInfo | is the instance of the accessory that needs to be listened. Accessory that needs to be listened is copied from connected accessories array. If an empty instance is set as the parameter no notifications are sent. |
- Leave:
- TInt KErrAlreadyExists if observer is active allready, otherwise KErrNone or standard Symbian error code.
|
|
Sets observer to listen all connect/disconnect accessory notifications and starts the observer.
- Parameters:
-
| aObserver | is the pointer to the callback functions. |
- Leave:
- TInt KErrAlreadyExists if observer is active allready, otherwise KErrNone or standard Symbian error code.
|
virtual void CAccMonitor::StopObserving | ( | | ) | [pure virtual] |
|
|
Stops observing accessory connection status changes.
Listening will be automatically stopped when CAccMonintoringApi object is deleted. |
The documentation for this class was generated from the following file: