CSensrvChannelBuffer Class Reference
class CSensrvChannelBuffer : public CBase
|
Implements channel buffer related handling.
Channel buffer is a ring buffer with a couple of special twists:
-
There can be multiple tail pointers (one for each client that is listening to the channel).
-
New data is written by SSY or sensor driver directly to buffer, so any pointer given for writing must have at enough continuous space to fit n items (specified when new pointer is requested). -> This leads to situations where end of the buffer contains no valid data, so there is an end index to indicate end of valid data.
Constructor & Destructor Documentation
CSensrvChannelBuffer(TInt, TInt)
CSensrvChannelBuffer
|
(
|
TInt
|
aItemSize,
|
|
TInt
|
aBufferLength
|
|
)
|
[private]
|
Parameters
TInt
aItemSize
|
Size of single buffered item in bytes
|
TInt
aBufferLength
|
Number of items that need to be buffered.
|
~CSensrvChannelBuffer()
~CSensrvChannelBuffer
|
(
|
)
|
[virtual]
|
Member Functions Documentation
AddListener(CSensrvChannelListener *, TSensrvTailIndexItem *&, CSensrvChannelListener::TSensrvChannelListenerState)
Add new listener tail index. Index is initialized to KSensrvChannelBufferUninitializedTail, if there is an outstanding request for data block, or iHeadIndex if not. This is done so that first write of data will be ignored, as it was generated before listening started for this listener.
Called by server thread.
CancelFreeBlock()
Cancels any outstanding free block request Called by SSY thread.
ConstructL()
void
|
ConstructL
|
(
|
)
|
[private]
|
2nd phase of construction
GetConditionData(TSensrvTailIndexItem *, CSensrvChannelListener::TChannelDataParts &)
Gets data for condition evaluation and resets condition tail to head index.
GetFreeBlock(TInt)
Gets pointer to next free block of n items. Adjusts indexes accordingly. Called by SSY thread.
Parameters
TInt
aCount
|
Number of items to get free block for.
|
GetInitialMessageData(CSensrvChannelListener::TChannelDataMessage &)
Gets the initial data item that can be sent to new listerers if there is no data available by
GetMessageData()
. Called by server thread.
GetMessageData(TSensrvTailIndexItem *, CSensrvChannelListener::TChannelDataMessage &, TInt)
Gets data for transaction and adjusts listener tail accordingly. Data written can be less than the specified count, if there is less data available. Called by server thread.
GetTailIndex(CSensrvChannelListener *)
Gets tail index for listener.
InvalidateRange(TInt)
void
|
InvalidateRange
|
(
|
TInt
|
aCount
|
)
|
[private]
|
Invalidates range of items starting from head index. Adjusts valid and tail indexes accordingly.
Parameters
TInt
aCount
|
Number of items to invalidate.
|
Length()
TInt
|
Length
|
(
|
)
|
const [inline]
|
Gets buffer length Called from server thread
NewL(TInt, TInt)
Two phase constructor
-
Since
-
S60 5.0
-
Exceptions
-
KErrNoMemory
|
Out of memory
|
Parameters
TInt
aItemSize
|
Size of single buffered item in bytes
|
TInt
aBufferLength
|
Number of items that need to be buffered.
|
RemoveListener(CSensrvChannelListener *)
Removes a listener tail index. Called by server thread.
UpdateDataAvailable(TSensrvTailIndexItem &, TBool)
Checks how much new data is available for listener. If there is no data amount change, no update is needed.
Parameters
TSensrvTailIndexItem
& aTailItem
|
Reference to the tail item.
|
TBool
aMoreData
|
If ETrue, indicates that update is potentially increasing the amount of data. If false, the update is potentially decreasing the amount of data.
|
WroteBlock(TInt)
void
|
WroteBlock
|
(
|
TInt
|
aCount
|
)
|
|
Validates block of n items starting from the head index. Adjusts indexes accordingly. Called by SSY thread.
Parameters
TInt
aCount
|
Number of items that were written.
|
Member Data Documentation
TInt
iBufferLength
TInt
|
iBufferLength
|
[private]
|
Number of items buffer can hold.
TInt
iHeadIndex
TInt
|
iHeadIndex
|
[private]
|
Indicates cell where SSY will be writing next.
TInt
iItemSize
Single buffered data item size
TInt
iLatestWrittenItemIndex
TInt
|
iLatestWrittenItemIndex
|
[private]
|
Index of the latest written data item or KErrNotFound. The item located at this index can be sent to new listeners as initial data if there is nothing else to sent.
TInt
iRequestedFreeBlockLength
TInt
|
iRequestedFreeBlockLength
|
[private]
|
Indicates the length of free block that has been requested.
RPointerArray< TSensrvTailIndexItem > iTailIndexArray
Array of listener tail indexes
TInt
iValidEndIndex
TInt
|
iValidEndIndex
|
[private]
|
Indicates first invalid data cell after continuous valid cells. If iHeadIndex == iValidEndIndex, valid buffer space is continuous. If iHeadIndex < iValidEndIndex, buffer has wrapped around.
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.