-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Server side event support #12059
Server side event support #12059
Conversation
Not yet completely hooked up to the EventManagement but the key aspect of the API present.
The event is being logged from the TestEmitTestEventRequest command, which both provides a flavor the API and sets us up for a loopback/unit test
PR #12059: Size comparison from 5bad4ed to 6708064 Increases (1 build for linux)
Decreases (1 build for esp32)
Full report (38 builds for efr32, esp32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
|
src/app/EventLogging.h
Outdated
|
||
#include <app/ConcreteEventPath.h> | ||
#include <app/EventLoggingDelegate.h> | ||
#include <app/data-model/Decode.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#include <app/data-model/Decode.h> | |
#include <app/data-model/Encode.h> |
}; | ||
|
||
template <typename T> | ||
CHIP_ERROR LogEvent(const T & aEventData, EndpointId aEndpoint, EventOptions aEventOptions, EventNumber & aEventNumber) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to decide whether we're doing the EventSchema
thing (which would mean endpoint, etc is included in the EventOptions) or whether we are getting the cluster and event id from the data type and passing in the endpoint like this.
Seems to me that EventSchema should just go away.
That said event priority is not statically deducible from the data type, so we will need to pass that in, via either the EventOptions or some other mechanism.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed.
I'd rather we consolidate around EventOptions
, remove EventSchema
(schema is poor term for it anyways) and consequently, remove mpEventSchema
from EventOptions
.
}; | ||
|
||
template <typename T> | ||
CHIP_ERROR LogEvent(const T & aEventData, EndpointId aEndpoint, EventOptions aEventOptions, EventNumber & aEventNumber) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aEventNumber needs documentation. Is this an outparam? And in/out param? What purpose does it serve?
When would it be used, outside of our test command?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EventNumber is outParam,
Yes, we need to consolidate around EventOption, remove EventSchema, and put ConcreteEventPath as a member inside EventOption
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EventNumber is outParam,
My point is that this should be documented, not in a github comment.
chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, | ||
const chip::app::Clusters::TestCluster::Commands::TestEmitTestEventRequest::DecodableType & commandData) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, | |
const chip::app::Clusters::TestCluster::Commands::TestEmitTestEventRequest::DecodableType & commandData) | |
CommandHandler * commandObj, const ConcreteCommandPath & commandPath, | |
const Commands::TestEmitTestEventRequest::DecodableType & commandData) |
DataModel::List<const Structs::SimpleStruct::Type> arg5; | ||
DataModel::List<const SimpleEnum> arg6; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not pass these in the command payload?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd recommend using NullablesAndOptionalsStruct
since it covers lists as well as nullables/optionals, and embedding that in both the command and the event.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was the original pattern I was shooting for, but the interface to go from DecodableType to Type proved to be marginally more complicated, so I mocked up something temporary. Will fix.
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
EventLogger<T> eventData(aEventData); | ||
ConcreteEventPath path(aEndpoint, aEventData.GetClusterId(), aEventData.GetEventId()); | ||
// log the actual event | ||
aEventNumber = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall the eventNumber be an monotonically increasing ephemeral unique number?
* Port change from #12059 * Hook server with IM EventManagment and adjust EventManagment * run codegen
Merged by Integrate IM event with server #12641 |
Problem
Initial cut at the server event logging API.
Change overview
In the current form,
Logging API. For any of the generated
Events::*::Type
objects, the API looks as follows:EventOptions eventOptions;
Events::TestEvent::Type event;
EndpointId endpoint;
EventNumber eid;
LogEvent(event, endpoint, options, eid);
the API is not completely hooked up in this draft, this is will change before converting to a regular PR
test code to emit events as a result of a command.
Testing
How was this tested? (at least one bullet point required)