class MHCICmdQueueDecisionInterface |
Mixin for the QDP interface.
Automatically resending commands that have completed with an error.
Applying a timeout to the period between a command being sent to the controller and the command completing.
Adding 'child' commands before and after an existing command that the Command Queue wishes to send.
Blocking the next command to be sent from the Command Queue depending on what had already been sent to the controller.
Dealing with unexpected events from the controller.
Public Member Enumerations | |
---|---|
enum | TCanSendAction { EContinue = KErrNone, EBlock = 1 } |
enum | TCommandErroredAction { EContinueWithError = 0, EResendErroredCommand = 1 } |
enum | TCommandTimedOutAction { EDropTimeoutEvent = 0, EContinueWithTimeoutEvent = 1, EResendTimedOutCommand = 2 } |
Public Attributes | |
---|---|
const TUint | KNoTimeoutRequired |
TInt | MhcqdiCanSend | ( | CHCICommandQItem & | aCommand, |
const TDblQue < const CHCICommandQItem > & | aSentCommands | |||
) | [pure virtual] |
Called when the Command Queue has determined that aCommand is in a position to be sent. This function gives the QDP the opportunity to send, block or reject the command.
the sent queue has changed (command completed successfully or with an error)
an unsolicited event has been received (e.g. PIN Code Request Event) The QDP gets a chance to let the command be sent or to delay it further. There is no other way (e.g. by a call back into the Command Queue) for the QDP to change its mind and decide a command can be sent.
The QDP should be careful not to cause a deadlock. This could happen if the decision is taken not to send command A if the command P is in the sent queue. However, if the completion of P depends on command A then the Command Queue would deadlock. For example, P = Connection Request Command and A = PIN Request Reply Command (in secmode 3).
will ASSERT the sent queue is not empty if CanSend returns TCanSendAction::EBlock
will run a watchdog timer to ensure the queue is not being starved
CanSend can return a Symbian error code (not including KErrNone) to tell the Command Queue not to send a command. The obtained error code is send back to the command's originator. HCI error codes are represented within the Symbian error code range by subtracting the Bluetooth specification defined error code from KHCIErrorBase.
Returning KErrNone will result in the command being sent.
Note that the Command Queue will panic if the value returned is not a Symbian system-wide error code, a Symbian HCI error code (excluding EOK), or TCanSendAction::EBlock.
CHCICommandQItem & aCommand | The command to decide whether it should be delayed (or not). |
const TDblQue < const CHCICommandQItem > & aSentCommands | These are the commands that have been sent to the controller but haven't been completed yet. |
void | MhcqdiCommandAboutToBeDeleted | ( | const CHCICommandQItem & | aDyingCmd | ) | [pure virtual] |
Called immediately prior to a command queue item being deleted to allow the QDP to clean up the items QDP data member.
const CHCICommandQItem & aDyingCmd | The CHCICommandQItem that should have its QDP data member cleaned up. |
TCommandTimedOutAction | MhcqdiCommandTimedOut | ( | const CHCICommandQItem & | aCommand, |
const TDblQue < const CHCICommandQItem > & | aSentCommands, | |||
TUint | aCurrentCommandCredits, | |||
TUint & | aCreditsToBeRefunded | |||
) | [pure virtual] |
Called when the timeout for a command has expired.
const CHCICommandQItem & aCommand | The command that has timed out. |
const TDblQue < const CHCICommandQItem > & aSentCommands | The list of commands currently on the Sent Queue. |
TUint aCurrentCommandCredits | The current number of command credits available to the Command Queue. |
TUint & aCreditsToBeRefunded | The number of credits to be refunded to the command queue. |
TBool | MhcqdiDoesCommandRequireWorkaround | ( | const CHCICommandQItem & | aParent | ) | [pure virtual] |
Queries whether a HCI command requires child commands to be sent before or after this parent command is sent for a workaround.
const CHCICommandQItem & aParent | The command that might require a workaround. |
THCIEventBase * | MhcqdiGetFakedUnsolicitedEvent | ( | const CHCICommandQItem & | aParent, |
const THCIEventBase * | aPreviousFakedEvent | |||
) | [pure virtual] |
Retrieves the next faked event the QDP wishes to send (following a workaround) in order for it to keep the Stack synchronised with what may have been done (normally in the case where state cannot returned to how it was prior to the workaround, i.e. failures to succesfully perform the post-workaround stage)
For a faked event to be sent, the QDP should create a descriptor (of sufficient lifetime) that contains the raw data the event is to have. It should then use this to create an appropriate THCIEventBase class, which is to be returned as the faked event for the Command Queue to pass on.
This function will be repeatedly called (while the QDP continues to return faked events) so as to retrieve the sequence of faked events required. The previous faked event will be provided in the call to the QDP so that it does not need to maintain state about how far though the sequence of faked events it is.
When there are no (more) faked events required, a NULL pointer should be returned.
const CHCICommandQItem & aParent | The parent command that requires fake events to be generated. |
const THCIEventBase * aPreviousFakedEvent | Will be NULL the first time this function is caled for a particular workaround, otherwise it will point to an identical instance of the previously faked event generated by the QDP. Ownership is not passed. |
CHCICommandQItem * | MhcqdiGetPostChildCommand | ( | const CHCICommandQItem & | aParent, |
const CHCICommandQItem * | aPreviousPostChild, | |||
const THCIEventBase * | aPreviousCmdResult | |||
) | [pure virtual] |
Retrieves the next post-child command for a parent command. A post-child command is a command that is to be sent to the HCTL after the parent command has been sent.
The aid the QDP in selecting the next command to be sent, it is passed the parent command and pointers to the previous child-command sent and its associated event. Note if the same command needs to be sent twice in a workaround, the QDP needs to create two different objects, as ownership of the resultant command is passed to the Command Queue.
const CHCICommandQItem & aParent | The parent command that the post-child command would be for. |
const CHCICommandQItem * aPreviousPostChild | Will be NULL the first time this function is called for a particular workaround. Ownership is not passed. |
const THCIEventBase * aPreviousCmdResult | If aPreviousPostChild is NULL then this is the result of aParent otherwise it is the result of aPreviousPostChild. This parameter can be NULL if the previous command timed out (so there is no event). Ownership is not passed. |
CHCICommandQItem * | MhcqdiGetPreChildCommand | ( | const CHCICommandQItem & | aParent, |
const CHCICommandQItem * | aPreviousWorkaroundCmd, | |||
const THCIEventBase * | aPreviousCmdResult | |||
) | [pure virtual] |
Retrieves the next pre-child command for a parent command. A pre-child command is a command that is to be sent to the HCTL before the parent command is sent.
The aid the QDP in selecting the next command to be sent, it is passed the parent command and pointers to the previous child-command sent and its associated event. Note if the same command needs to be sent twice in a workaround, the QDP needs to create two different objects, as ownership of the resultant command is passed to the Command Queue.
const CHCICommandQItem & aParent | The parent command that the pre-child command will be for. |
const CHCICommandQItem * aPreviousWorkaroundCmd | Will be null the first time this function is called for a particular workaround. Ownership is not passed. |
const THCIEventBase * aPreviousCmdResult | Will be null the first time this function is called for a particular workaround or if the previous command has timed out (so there is no event). Ownership is not passed. |
TCommandErroredAction | MhcqdiMatchedErrorEventReceived | ( | const THCIEventBase & | aErrorEvent, |
const CHCICommandQItem & | aRelatedCommand | |||
) | [pure virtual] |
Called to notify the QDP of an event that has been matched to a command. This function is intended as a way of the QDP keeping its state up-to-date. TCommandErroredAction
const THCIEventBase & aErrorEvent | The event received which represents an error. |
const CHCICommandQItem & aRelatedCommand | The command that caused the event. |
void | MhcqdiMatchedEventReceived | ( | const THCIEventBase & | aEvent, |
const CHCICommandQItem & | aRelatedCommand | |||
) | [pure virtual] |
Called to notify the QDP of an event that has been matched to a command. This function is intended only as a way of the QDP keeping its state up-to-date.
const THCIEventBase & aEvent | The event received. |
const CHCICommandQItem & aRelatedCommand | The command that caused the event. |
TUint | MhcqdiReset | ( | ) | [pure virtual] |
Notifies the QDP of the Command Queue being reset.
This returns the initial number of command credits for the queue, which is typically one. However, some controllers send an event after reset to set credits so it could be zero.
void | MhcqdiSetHCICommandQueue | ( | MHCICommandQueue & | aHCICommandQueue | ) | [pure virtual] |
Gives the QDP a reference to MHCICommandQueue , which allows it to add and remove commands when necessary
MHCICommandQueue & aHCICommandQueue | Interface to Command Queue |
void | MhcqdiSetHardResetInitiator | ( | const MHardResetInitiator & | aHardResetInitiator | ) | [pure virtual] |
Gives the QDP a reference to MHardResetInitiator , which allows it to initiate a hard reset
const MHardResetInitiator & aHardResetInitiator | Hard Reset interface to use |
void | MhcqdiSetPhysicalLinksState | ( | const MPhysicalLinksState & | aPhysicalLinksState | ) | [pure virtual] |
Gives the QDP a reference to MPhysicalLinksState, which provides information that helps with decision making.
const MPhysicalLinksState & aPhysicalLinksState | Interface to query the state of the stack's physical links |
void | MhcqdiSetTimeouts | ( | TUint | aQueueStarvationTimeout, |
TUint | aMaxHciCommandTimeout | |||
) | [pure virtual] |
The QDP should make use of these values when informing the command queue of command completion timeouts. The QDP should be aware when choosing command completion timeouts, that choosing a value approaching the starvation timeout may result in panicing the queue. By default KMaxHciCommandTimeout is less than KQueueStarvationTimeout although this is configurable via the CmdQ.ini file. MhcqdiTimeoutRequired
TUint | MhcqdiTimeoutRequired | ( | const CHCICommandQItem & | aSentCmd | ) | [pure virtual] |
Called immediately after a command has been sent to the controller allowing the QDP to keep its state up-to-date and specify a time-out for the command.
const CHCICommandQItem & aSentCmd | The sent command. |
void | MhcqdiUnmatchedEventReceived | ( | const THCIEventBase & | aEvent | ) | [pure virtual] |
Called to notify the QDP of an event that does not have a matching command. This function is intended as a way of the QDP keeping its state up-to-date.
Note that this function will be called for both events that could legitimately be unexpected (unsolicited events), and those that are due to the controller sending us something odd e.g. providing a command status event for a command that has not been sent.
const THCIEventBase & aEvent | The event received. |
Represents the action that the QDP decides the Command Queue should take when a command is presented to the QDP ready to be sent, in the MhcqdiCanSend function. MhcqdiCanSend
EContinue = KErrNone |
Send the command, identical to KErrNone |
EBlock = 1 |
Delay sending the command. |
Represents the action that the QDP decides the Command Queue should take when a command is matched to an event which signifies an error. MhcqdiMatchedErrorEventReceived
EContinueWithError = 0 |
Continue and report the error to the client who added the command. |
EResendErroredCommand = 1 |
Attempt to resend the command (command's client is not informed). |
Represents the action that the QDP decides the Command Queue should take when the timeout for a command has expired. MhcqdiCommandTimedOut
EDropTimeoutEvent = 0 |
Do not inform the command's client of the timeout. This will result in the command being dropped. A QDP would wish to do this if it reset the controller in the MhcqdiCommandTimedOut function call. |
EContinueWithTimeoutEvent = 1 |
Continue as if it had received an event with error code EHardwareFail. |
EResendTimedOutCommand = 2 |
Attempt to resend the command (command's client is not informed). |
const TUint | KNoTimeoutRequired | [static] |
Represents that no timer is required for the completion of a command.
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.