Skip to content

Commit

Permalink
Restyled by clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
restyled-commits authored and lpbeliveau-silabs committed Jul 13, 2023
1 parent 2a55ac5 commit a0b9d6e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 102 deletions.
125 changes: 25 additions & 100 deletions src/app/ReadHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,18 +215,9 @@ class ReadHandler : public Messaging::ExchangeDelegate
ReadHandler(ManagementCallback & apCallback, Observer * observer = nullptr);
#endif

const ObjectList<AttributePathParams> * GetAttributePathList() const
{
return mpAttributePathList;
}
const ObjectList<EventPathParams> * GetEventPathList() const
{
return mpEventPathList;
}
const ObjectList<DataVersionFilter> * GetDataVersionFilterList() const
{
return mpDataVersionFilterList;
}
const ObjectList<AttributePathParams> * GetAttributePathList() const { return mpAttributePathList; }
const ObjectList<EventPathParams> * GetEventPathList() const { return mpEventPathList; }
const ObjectList<DataVersionFilter> * GetDataVersionFilterList() const { return mpDataVersionFilterList; }

void GetReportingIntervals(uint16_t & aMinInterval, uint16_t & aMaxInterval) const
{
Expand Down Expand Up @@ -272,14 +263,8 @@ class ReadHandler : public Messaging::ExchangeDelegate
}

private:
PriorityLevel GetCurrentPriority() const
{
return mCurrentPriority;
}
EventNumber & GetEventMin()
{
return mEventMin;
}
PriorityLevel GetCurrentPriority() const { return mCurrentPriority; }
EventNumber & GetEventMin() { return mEventMin; }

enum class ReadHandlerFlags : uint8_t
{
Expand Down Expand Up @@ -360,10 +345,7 @@ class ReadHandler : public Messaging::ExchangeDelegate
*/
bool IsFromSubscriber(Messaging::ExchangeContext & apExchangeContext) const;

bool IsIdle() const
{
return mState == HandlerState::Idle;
}
bool IsIdle() const { return mState == HandlerState::Idle; }

// TODO (#27672): Change back to IsReportable once ReportScheduler is implemented so this can assess reportability without
// considering timing. The ReporScheduler will handle timing.
Expand All @@ -377,14 +359,8 @@ class ReadHandler : public Messaging::ExchangeDelegate
return mState == HandlerState::GeneratingReports && !mFlags.Has(ReadHandlerFlags::WaitingUntilMinInterval) &&
(IsDirty() || !mFlags.Has(ReadHandlerFlags::WaitingUntilMaxInterval));
}
bool IsGeneratingReports() const
{
return mState == HandlerState::GeneratingReports;
}
bool IsAwaitingReportResponse() const
{
return mState == HandlerState::AwaitingReportResponse;
}
bool IsGeneratingReports() const { return mState == HandlerState::GeneratingReports; }
bool IsAwaitingReportResponse() const { return mState == HandlerState::AwaitingReportResponse; }

// Resets the path iterator to the beginning of the whole report for generating a series of new reports.
void ResetPathIterator();
Expand All @@ -396,41 +372,17 @@ class ReadHandler : public Messaging::ExchangeDelegate
// sanpshotted last event, check with latest last event number, re-setup snapshoted checkpoint, and compare again.
bool CheckEventClean(EventManagement & aEventManager);

bool IsType(InteractionType type) const
{
return (mInteractionType == type);
}
bool IsChunkedReport() const
{
return mFlags.Has(ReadHandlerFlags::ChunkedReport);
}
bool IsType(InteractionType type) const { return (mInteractionType == type); }
bool IsChunkedReport() const { return mFlags.Has(ReadHandlerFlags::ChunkedReport); }
// Is reporting indicates whether we are in the middle of a series chunks. As we will set mIsChunkedReport on the first chunk
// and clear that flag on the last chunk, we can use mIsChunkedReport to indicate this state.
bool IsReporting() const
{
return mFlags.Has(ReadHandlerFlags::ChunkedReport);
}
bool IsPriming() const
{
return mFlags.Has(ReadHandlerFlags::PrimingReports);
}
bool IsActiveSubscription() const
{
return mFlags.Has(ReadHandlerFlags::ActiveSubscription);
}
bool IsFabricFiltered() const
{
return mFlags.Has(ReadHandlerFlags::FabricFiltered);
}
bool IsReporting() const { return mFlags.Has(ReadHandlerFlags::ChunkedReport); }
bool IsPriming() const { return mFlags.Has(ReadHandlerFlags::PrimingReports); }
bool IsActiveSubscription() const { return mFlags.Has(ReadHandlerFlags::ActiveSubscription); }
bool IsFabricFiltered() const { return mFlags.Has(ReadHandlerFlags::FabricFiltered); }
CHIP_ERROR OnSubscribeRequest(Messaging::ExchangeContext * apExchangeContext, System::PacketBufferHandle && aPayload);
void GetSubscriptionId(SubscriptionId & aSubscriptionId) const
{
aSubscriptionId = mSubscriptionId;
}
AttributePathExpandIterator * GetAttributePathExpandIterator()
{
return &mAttributePathExpandIterator;
}
void GetSubscriptionId(SubscriptionId & aSubscriptionId) const { aSubscriptionId = mSubscriptionId; }
AttributePathExpandIterator * GetAttributePathExpandIterator() { return &mAttributePathExpandIterator; }

/// @brief Notifies the read handler that a set of attribute paths has been marked dirty. This will schedule a reporting engine
/// run if the change to the attribute path makes the ReadHandler reportable.
Expand All @@ -440,10 +392,7 @@ class ReadHandler : public Messaging::ExchangeDelegate
{
return (mDirtyGeneration > mPreviousReportsBeginGeneration) || mFlags.Has(ReadHandlerFlags::ForceDirty);
}
void ClearForceDirtyFlag()
{
ClearStateFlag(ReadHandlerFlags::ForceDirty);
}
void ClearForceDirtyFlag() { ClearStateFlag(ReadHandlerFlags::ForceDirty); }
NodeId GetInitiatorNodeId() const
{
auto session = GetSession();
Expand All @@ -457,47 +406,23 @@ class ReadHandler : public Messaging::ExchangeDelegate
}

Transport::SecureSession * GetSession() const;
SubjectDescriptor GetSubjectDescriptor() const
{
return GetSession()->GetSubjectDescriptor();
}
SubjectDescriptor GetSubjectDescriptor() const { return GetSession()->GetSubjectDescriptor(); }

auto GetTransactionStartGeneration() const
{
return mTransactionStartGeneration;
}
auto GetTransactionStartGeneration() const { return mTransactionStartGeneration; }

/// @brief Forces the read handler into a dirty state, regardless of what's going on with attributes.
/// This can lead to scheduling of a reporting run immediately, if the min interval has been reached,
/// or after the min interval is reached if it has not yet been reached.
void ForceDirtyState();

const AttributeValueEncoder::AttributeEncodeState & GetAttributeEncodeState() const
{
return mAttributeEncoderState;
}
void SetAttributeEncodeState(const AttributeValueEncoder::AttributeEncodeState & aState)
{
mAttributeEncoderState = aState;
}
uint32_t GetLastWrittenEventsBytes() const
{
return mLastWrittenEventsBytes;
}
const AttributeValueEncoder::AttributeEncodeState & GetAttributeEncodeState() const { return mAttributeEncoderState; }
void SetAttributeEncodeState(const AttributeValueEncoder::AttributeEncodeState & aState) { mAttributeEncoderState = aState; }
uint32_t GetLastWrittenEventsBytes() const { return mLastWrittenEventsBytes; }

// Returns the number of interested paths, including wildcard and concrete paths.
size_t GetAttributePathCount() const
{
return mpAttributePathList == nullptr ? 0 : mpAttributePathList->Count();
};
size_t GetEventPathCount() const
{
return mpEventPathList == nullptr ? 0 : mpEventPathList->Count();
};
size_t GetDataVersionFilterCount() const
{
return mpDataVersionFilterList == nullptr ? 0 : mpDataVersionFilterList->Count();
};
size_t GetAttributePathCount() const { return mpAttributePathList == nullptr ? 0 : mpAttributePathList->Count(); };
size_t GetEventPathCount() const { return mpEventPathList == nullptr ? 0 : mpEventPathList->Count(); };
size_t GetDataVersionFilterCount() const { return mpDataVersionFilterList == nullptr ? 0 : mpDataVersionFilterList->Count(); };

CHIP_ERROR SendStatusReport(Protocols::InteractionModel::Status aStatus);

Expand Down
4 changes: 2 additions & 2 deletions src/app/reporting/ReportScheduler.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ class ReportScheduler : public ReadHandler::Observer
{
public:
virtual ~TimerDelegate() {}
/// @brief Start a timer for a given context. The report scheduler must always cancel an existing timer for a context (using CancelTimer)
/// before starting a new one for that context.
/// @brief Start a timer for a given context. The report scheduler must always cancel an existing timer for a context (using
/// CancelTimer) before starting a new one for that context.
/// @param context context to pass to the timer callback.
/// @param aTimeout time in miliseconds before the timer expires
virtual CHIP_ERROR StartTimer(void * context, System::Clock::Timeout aTimeout) = 0;
Expand Down

0 comments on commit a0b9d6e

Please sign in to comment.