60
|
1 |
/*
|
|
2 |
* Component Name: Headset Simulator
|
|
3 |
* Author: Comarch S.A.
|
|
4 |
* Version: 1.0
|
|
5 |
* Copyright (c) 2010 Comarch S.A.
|
|
6 |
*
|
|
7 |
* This Software is submitted by Comarch S.A. to Symbian Foundation Limited on
|
|
8 |
* the basis of the Member Contribution Agreement entered between Comarch S.A.
|
|
9 |
* and Symbian Foundation Limited on 5th June 2009 (“Agreement”) and may be
|
|
10 |
* used only in accordance with the terms and conditions of the Agreement.
|
|
11 |
* Any other usage, duplication or redistribution of this Software is not
|
|
12 |
* allowed without written permission of Comarch S.A.
|
|
13 |
*
|
|
14 |
*/
|
|
15 |
|
|
16 |
#ifndef HSCLIENTMANAGER_H_
|
|
17 |
#define HSCLIENTMANAGER_H_
|
|
18 |
|
|
19 |
#include <e32base.h>
|
|
20 |
#include <hsclientobservers.h>
|
|
21 |
|
|
22 |
class CHsClient;
|
|
23 |
class MHsClientStateNotifier;
|
|
24 |
|
|
25 |
/** Array of AG clients */
|
|
26 |
typedef RPointerArray <CHsClient> RClientArray;
|
|
27 |
/** Array of AG clients' observers */
|
|
28 |
typedef RPointerArray <MHsClientStateNotifier> RClientObserverArray;
|
|
29 |
|
|
30 |
/** Size of arrays used by Client Manager */
|
|
31 |
const TInt KHsClientManagerArrayMinSize = 0x10;
|
|
32 |
/** Default AG client index */
|
|
33 |
const TInt KHsDefaultClientNumber = 0;
|
|
34 |
|
|
35 |
/**
|
|
36 |
* @brief Class manages AG clients connected with Headset Simulator.
|
|
37 |
*/
|
|
38 |
class CHsClientManager : public CBase, public MHsClientObserver
|
|
39 |
{
|
|
40 |
public:
|
|
41 |
/**
|
|
42 |
* Two-phase constructor
|
|
43 |
* @return instance of class
|
|
44 |
*/
|
|
45 |
static CHsClientManager* NewL();
|
|
46 |
|
|
47 |
/**
|
|
48 |
* Two-phase constructor
|
|
49 |
* @return instance of class
|
|
50 |
*/
|
|
51 |
static CHsClientManager* NewLC();
|
|
52 |
|
|
53 |
/**
|
|
54 |
* Destructor
|
|
55 |
*/
|
|
56 |
~CHsClientManager();
|
|
57 |
|
|
58 |
public:
|
|
59 |
|
|
60 |
/**
|
|
61 |
* Sets observer of AG's states.
|
|
62 |
*
|
|
63 |
* @param aClientStateNotifier reference to MHsClientStateNotifier
|
|
64 |
* @param aNumber index of AG client
|
|
65 |
*
|
|
66 |
* @leave KErrUnderflow if aNumber parameter is negative
|
|
67 |
* @leave KErrOverflow if aNumber parameter is greater than size of
|
|
68 |
* clients' array
|
|
69 |
*/
|
|
70 |
void SetClientStateNotfierL( MHsClientStateNotifier &aClientStateNotifier,
|
|
71 |
TInt aNumber = 0 );
|
|
72 |
|
|
73 |
/**
|
|
74 |
* Sends AT command to AG.
|
|
75 |
*
|
|
76 |
* @param aAt data to be send
|
|
77 |
* @param aNumber specified to which AG data should be send
|
|
78 |
*
|
|
79 |
* @return KErrNone if successful, KErrNotFound if aNumber parameter is
|
|
80 |
* not correct index in AG clients' array
|
|
81 |
*/
|
|
82 |
TInt Send( const TDesC8 &aAt, TInt aNumber = KHsDefaultClientNumber );
|
|
83 |
|
|
84 |
/**
|
|
85 |
* Disconnects from AGs.
|
|
86 |
*
|
|
87 |
* When request completes notification is sent to
|
|
88 |
* MHsObserver::HandleDisconnectedFromClient().
|
|
89 |
*/
|
|
90 |
void DisconnectClients();
|
|
91 |
|
|
92 |
public:
|
|
93 |
//Methods inherited from MHsClientObserver
|
|
94 |
void HandleNewClientL( CHsClient *aClient, TInt aErr );
|
|
95 |
|
|
96 |
void HandleClientDisconnect( CHsClient *aClient, TInt aErr );
|
|
97 |
|
|
98 |
private:
|
|
99 |
|
|
100 |
/**
|
|
101 |
* Constructor for performing 1st stage construction
|
|
102 |
*/
|
|
103 |
CHsClientManager();
|
|
104 |
|
|
105 |
/**
|
|
106 |
* Constructor for performing 2nd stage construction
|
|
107 |
*/
|
|
108 |
void ConstructL();
|
|
109 |
|
|
110 |
private:
|
|
111 |
/** Array of AG clients */
|
|
112 |
RClientArray iClientArray;
|
|
113 |
/** Array of AG clients' observers */
|
|
114 |
RClientObserverArray iObserverArray;
|
|
115 |
};
|
|
116 |
|
|
117 |
#endif /* HSCLIENTMANAGER_H_ */
|