|
1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // This file was generated automatically from the template commandsource.tmpl |
|
15 // on Thu, 29 May 2008 15:17:53 (time stamp) |
|
16 // |
|
17 // |
|
18 |
|
19 /** |
|
20 @file |
|
21 @internalComponent |
|
22 */ |
|
23 |
|
24 #include <bluetooth/hci/writestoredlinkkeycommand.h> |
|
25 #include <bluetooth/hci/event.h> |
|
26 #include <bluetooth/hci/commandcompleteevent.h> |
|
27 #include <bluetooth/hci/hciframe.h> |
|
28 #include <bluetooth/hci/hciopcodes.h> |
|
29 |
|
30 |
|
31 #ifdef __FLOG_ACTIVE |
|
32 _LIT8(KLogComponent, LOG_COMPONENT_COMMANDSEVENTS_SYMBIAN); |
|
33 #endif |
|
34 |
|
35 |
|
36 |
|
37 // Factory methods |
|
38 |
|
39 EXPORT_C CWriteStoredLinkKeyCommand* CWriteStoredLinkKeyCommand::NewL(TUint8 aNumKeysToWrite, const RArray< TBTDevAddr >& aBDADDR, const RArray< TBTLinkKey >& aLinkKey) |
|
40 { |
|
41 CWriteStoredLinkKeyCommand* self = new (ELeave) CWriteStoredLinkKeyCommand(aNumKeysToWrite, aBDADDR, aLinkKey); |
|
42 CleanupStack::PushL(self); |
|
43 self->CHCICommandBase::BaseConstructL(); |
|
44 CleanupStack::Pop(self); |
|
45 return self; |
|
46 } |
|
47 |
|
48 EXPORT_C CWriteStoredLinkKeyCommand* CWriteStoredLinkKeyCommand::NewL() |
|
49 { |
|
50 CWriteStoredLinkKeyCommand* self = new (ELeave) CWriteStoredLinkKeyCommand(); |
|
51 CleanupStack::PushL(self); |
|
52 self->CHCICommandBase::BaseConstructL(); |
|
53 CleanupStack::Pop(self); |
|
54 return self; |
|
55 } |
|
56 |
|
57 // Constructors |
|
58 |
|
59 CWriteStoredLinkKeyCommand::CWriteStoredLinkKeyCommand(TUint8 aNumKeysToWrite, const RArray< TBTDevAddr >& aBDADDR, const RArray< TBTLinkKey >& aLinkKey) |
|
60 : CHCICommandBase(KWriteStoredLinkKeyOpcode) |
|
61 , iNumKeysToWrite(aNumKeysToWrite) |
|
62 , iBDADDR(aBDADDR) |
|
63 , iLinkKey(aLinkKey) |
|
64 { |
|
65 SetExpectsCommandStatusEvent(EFalse); |
|
66 } |
|
67 |
|
68 CWriteStoredLinkKeyCommand::CWriteStoredLinkKeyCommand() |
|
69 : CHCICommandBase(KWriteStoredLinkKeyOpcode) |
|
70 { |
|
71 SetExpectsCommandStatusEvent(EFalse); |
|
72 } |
|
73 |
|
74 // Destructor |
|
75 CWriteStoredLinkKeyCommand::~CWriteStoredLinkKeyCommand() |
|
76 { |
|
77 iBDADDR.Close(); |
|
78 iLinkKey.Close(); |
|
79 } |
|
80 |
|
81 |
|
82 |
|
83 // Override of pure virtual from CHCICommandBase. This method embodies the knowledge |
|
84 // of how to format the specifics of this command into the HCTL command frame. |
|
85 void CWriteStoredLinkKeyCommand::Format(CHctlCommandFrame& aCommandFrame) const |
|
86 { |
|
87 aCommandFrame.PutByte(iNumKeysToWrite); |
|
88 for(int i=0;i<iNumKeysToWrite;++i) |
|
89 { |
|
90 aCommandFrame.PutDevAddr(iBDADDR[i]); |
|
91 aCommandFrame.PutLinkKey(iLinkKey[i]); |
|
92 } |
|
93 } |
|
94 |
|
95 // Assign new values to the parameters of this command |
|
96 EXPORT_C void CWriteStoredLinkKeyCommand::Reset(TUint8 aNumKeysToWrite, const RArray< TBTDevAddr >& aBDADDR, const RArray< TBTLinkKey >& aLinkKey) |
|
97 { |
|
98 iNumKeysToWrite = aNumKeysToWrite; |
|
99 iBDADDR = aBDADDR; |
|
100 iLinkKey = aLinkKey; |
|
101 } |
|
102 |
|
103 // Accessor methods for the parameters of the command |
|
104 |
|
105 EXPORT_C TUint8 CWriteStoredLinkKeyCommand::NumKeysToWrite() const |
|
106 { |
|
107 return iNumKeysToWrite; |
|
108 } |
|
109 |
|
110 EXPORT_C TBTDevAddr CWriteStoredLinkKeyCommand::BDADDR(TInt aIndex) const |
|
111 { |
|
112 return iBDADDR[aIndex]; |
|
113 } |
|
114 |
|
115 EXPORT_C TBTLinkKey CWriteStoredLinkKeyCommand::LinkKey(TInt aIndex) const |
|
116 { |
|
117 return iLinkKey[aIndex]; |
|
118 } |
|
119 |
|
120 |
|
121 |
|
122 // Extension function. Use this to retrieve any extension interfaces from CWriteStoredLinkKeyCommand |
|
123 // or any class from which it derives. |
|
124 /*virtual*/ TInt CWriteStoredLinkKeyCommand::Extension_(TUint aExtensionId, TAny*& aInterface, TAny* aData) |
|
125 { |
|
126 // To add an additional interface implementation specific for this class check the |
|
127 // provided ID and return an appropriate interface. |
|
128 |
|
129 // If a specific interface implementation is not provided - forward the call to the base class. |
|
130 return CHCICommandBase::Extension_(aExtensionId, aInterface, aData); |
|
131 } |
|
132 |