Skip to content
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

Update rvc app integrate service area #34887

Merged
Merged
Show file tree
Hide file tree
Changes from 85 commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
e4087bd
Updated the golabl data type's XMLs, removing the cluster entries.
hicklin Jul 31, 2024
7342db3
Zap generated after XML update.
hicklin Jul 31, 2024
63edf2e
Fixed namespaces used of global structs.
hicklin Jul 31, 2024
1cab752
Restyled by clang-format
restyled-commits Jul 31, 2024
72de6c5
Renamed LocationInfoStruct to AreaInfoStruct.
hicklin Aug 1, 2024
f2add10
Zap generated after XML update.
hicklin Aug 1, 2024
c6134a6
Renamed LocationStruct to AreaStruct and its LocationID and LocationD…
hicklin Aug 1, 2024
af8b02c
Zap generated after XML update.
hicklin Aug 1, 2024
a20d803
Updated SDK and example code to match the new naming.
hicklin Aug 1, 2024
8bb0d34
Updated the ProgressStruct's LocationID name to AreaID.
hicklin Aug 1, 2024
5bd0285
Zap generated after XML update.
hicklin Aug 1, 2024
5dc5eb0
Updated the SDK code following name changes.
hicklin Aug 1, 2024
5429771
Updated the SelectLocationsStatus and SkipLocationStatus enum names a…
hicklin Aug 1, 2024
04e87b6
Zap generated after XML update.
hicklin Aug 1, 2024
91f4446
Updated the SelectLocationsStatus and SkipCurrentLocationStatus names…
hicklin Aug 1, 2024
31a3c1a
Updated the names of the SupportedLocations, SelectedLocations and Cu…
hicklin Aug 1, 2024
f7d6a54
Zap generated after XML update.
hicklin Aug 1, 2024
4c128e6
Updated the changed names in the SDK.
hicklin Aug 1, 2024
088f01d
Updated the service area command names in XML.
hicklin Aug 1, 2024
a6b8036
Zap generated after XML update.
hicklin Aug 1, 2024
69eb53f
Updated the service area command names in the SDK.
hicklin Aug 1, 2024
c6c3659
Updated the rvc-example zap file.
hicklin Aug 1, 2024
d378b4e
Refactored LocationStructureWrapper to AreaStructureWrapper.
hicklin Aug 1, 2024
75a3369
Merge branch 'master' into update_names
hicklin Aug 1, 2024
86c38ed
Restyled by clang-format
restyled-commits Aug 1, 2024
a611a5b
Regenerated zap files due to changes upsteram.
hicklin Aug 1, 2024
56d0184
Merge branch 'master' into update_names
hicklin Aug 2, 2024
b3abfbd
Removed unused generated file.
hicklin Aug 2, 2024
e82a96e
Updated the Service Area XML marking previously nullabel attributes a…
hicklin Aug 2, 2024
f48fb79
Zap generated after XML update.
hicklin Aug 2, 2024
499b42d
Updated the attribute encoding and some server logic following the ro…
hicklin Aug 2, 2024
1aa272e
Explicitly set the Service Area version.
hicklin Aug 2, 2024
3881db0
Zap generated after XML update.
hicklin Aug 2, 2024
9a9b3bc
Updated the service area features in the XML to match the current spec.
hicklin Aug 2, 2024
d57ec78
Zap generated after XML update.
hicklin Aug 2, 2024
15376cb
Updated the SupportedArea validation logic as if the MAPS feature is …
hicklin Aug 2, 2024
43dd764
Change the type of the MapID to uint32 to match the spec.
hicklin Aug 2, 2024
ad374f1
Added the SkippedArea arg to the SkipArea command.
hicklin Aug 2, 2024
5979878
Zap generated after XML update.
hicklin Aug 2, 2024
5b079da
Updated the Service Area server code to handle the new SkippedArea co…
hicklin Aug 2, 2024
e8dd79c
Updated the service area XML to match the current spec. This includes…
hicklin Aug 2, 2024
1eb0f17
Zap generated after XML update.
hicklin Aug 2, 2024
bf8d264
Updated SDK server code and rvc-example after changes to the XML.
hicklin Aug 2, 2024
54cbcc2
Restyled by whitespace
restyled-commits Aug 2, 2024
9548b69
added vector include.
hicklin Aug 2, 2024
afb1084
Merge branch 'master' into update_names
hicklin Aug 5, 2024
ba24897
spacing changes form zap regen.
hicklin Aug 5, 2024
4f61bf3
Fixed minor mistake during merge.
hicklin Aug 5, 2024
30b4118
Merge branch 'update_names' into remove_nullable_qualities
hicklin Aug 5, 2024
2325e2a
Merge branch 'remove_nullable_qualities' into update_service_area_xml…
hicklin Aug 5, 2024
21663d9
Restyled by clang-format
restyled-commits Aug 5, 2024
cd43089
Merge branch 'master' into remove_nullable_qualities. Fixed conflicts…
hicklin Aug 5, 2024
82396bc
Merge branch 'remove_nullable_qualities' into update_service_area_xml…
hicklin Aug 5, 2024
b730832
Applied suggestions from review.
hicklin Aug 5, 2024
b3140db
Restyled by whitespace
restyled-commits Aug 5, 2024
c7f248c
Merge branch 'master' into update_service_area_xml_from_07
hicklin Aug 6, 2024
22db496
Updated the LondmarkInfoSturct PositionTag type.
hicklin Aug 6, 2024
23b1c6b
Zap generated after XML update.
hicklin Aug 6, 2024
ec07b0e
Fixed SDK following update to the position type.
hicklin Aug 6, 2024
95c68f7
Restyled by clang-format
restyled-commits Aug 6, 2024
6fafcf9
Updated the AeraStructWrapper to not contain methods with a large num…
hicklin Aug 6, 2024
0a5ec9f
Restyled by whitespace
restyled-commits Aug 6, 2024
6f9efb1
Restyled by clang-format
restyled-commits Aug 6, 2024
40c8298
Merge branch 'master' into update_service_area_xml_from_07. Fixed XML…
hicklin Aug 7, 2024
0ec7d0b
Missed a submudule update.
hicklin Aug 7, 2024
ca10c9a
Merge branch 'update_service_area_xml_from_07' into improve_AreaStruc…
hicklin Aug 7, 2024
f3df11c
Made the setters reture a ref to the sturct to allow chaining.
hicklin Aug 7, 2024
ed743e4
simplified the = oporator and add the == operator.
hicklin Aug 7, 2024
931557e
Restyled by clang-format
restyled-commits Aug 7, 2024
71437d2
Added methods to set the SupportedMaps and SupproctedAreas.
hicklin Aug 7, 2024
b0a7127
Updated the RVC app to provide a way to defined service area methods …
hicklin Aug 7, 2024
8498c51
Fixed typo.
hicklin Aug 8, 2024
10c7abb
Merge branch 'master' into improve_AreaStructWrapper
hicklin Aug 8, 2024
100b4d3
Merge branch 'improve_AreaStructWrapper' into update_rvc_app_integrat…
hicklin Aug 8, 2024
ccdc1e5
minor change to get restyler going.
hicklin Aug 8, 2024
35f5908
Restyled by clang-format
restyled-commits Aug 8, 2024
07faed8
Merge branch 'improve_AreaStructWrapper' into update_rvc_app_integrat…
hicklin Aug 8, 2024
258e249
Fixed status text referance issue.
hicklin Aug 8, 2024
b7ae205
Fixed issue casued by a change in the way that registrations are made.
hicklin Aug 8, 2024
2ee994e
Merge branch 'improve_AreaStructWrapper' into address_comments_from_r…
hicklin Aug 8, 2024
61e357b
Fixed styling and minor bug in IsValidSupportedArea.
hicklin Aug 8, 2024
e672d29
Merge branch 'address_comments_from_reviews' into update_rvc_app_inte…
hicklin Aug 8, 2024
752bcb8
Implemented the IsValidSelectAreasSet method.
hicklin Aug 8, 2024
9bf2e3c
implemented SaHandleSkipCurrentArea.
hicklin Aug 8, 2024
56dd13d
Restyled by clang-format
restyled-commits Aug 8, 2024
779fd70
Added methods to updated the service area current area and progress a…
hicklin Aug 8, 2024
b0940e8
Merge branch 'master' into address_comments_from_reviews
hicklin Aug 9, 2024
68748d4
Merge branch 'address_comments_from_reviews' into update_rvc_app_inte…
hicklin Aug 9, 2024
1af6153
Updated the handle skip area method to use the GoToNextArea method.
hicklin Aug 9, 2024
1d02665
Added the AreaComplete out-of-band message.
hicklin Aug 9, 2024
b2353f4
updated the reset evet handler to reset the service area attributes.
hicklin Aug 9, 2024
4fe3980
minor shifing of responsibilites.
hicklin Aug 9, 2024
4c4db41
Restyled by clang-format
restyled-commits Aug 9, 2024
80f79f9
reverted to adding the PID to the fifo name.
hicklin Aug 9, 2024
fc2ff21
Merge branch 'master' into update_rvc_app_integrate_service_area
hicklin Aug 9, 2024
2d8d4df
Updated readme and pics files.
hicklin Aug 9, 2024
f9e176d
Restyled by prettier-markdown
restyled-commits Aug 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions examples/rvc-app/rvc-common/include/rvc-device.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ class RvcDevice
mOperationalStateDelegate.SetPauseCallback(&RvcDevice::HandleOpStatePauseCallback, this);
mOperationalStateDelegate.SetResumeCallback(&RvcDevice::HandleOpStateResumeCallback, this);
mOperationalStateDelegate.SetGoHomeCallback(&RvcDevice::HandleOpStateGoHomeCallback, this);

mServiceAreaDelegate.SetIsSetSelectedAreasAllowedCallback(&RvcDevice::SaIsSetSelectedAreasAllowed, this);
mServiceAreaDelegate.SetHandleSkipCurrentAreaCallback(&RvcDevice::SaHandleSkipCurrentArea, this);
mServiceAreaDelegate.SetIsSupportedAreasChangeAllowedCallback(&RvcDevice::SaIsSupportedAreasChangeAllowed, this);
mServiceAreaDelegate.SetIsSupportedMapChangeAllowedCallback(&RvcDevice::SaIsSupportedMapChangeAllowed, this);
}

/**
Expand Down Expand Up @@ -97,6 +102,14 @@ class RvcDevice
*/
void HandleOpStateGoHomeCallback(Clusters::OperationalState::GenericOperationalError & err);

bool SaIsSetSelectedAreasAllowed(MutableCharSpan statusText);

bool SaHandleSkipCurrentArea(uint32_t skippedArea, MutableCharSpan skipStatusText);

bool SaIsSupportedAreasChangeAllowed();

bool SaIsSupportedMapChangeAllowed();

/**
* Updates the state machine when the device becomes fully-charged.
*/
Expand Down
87 changes: 73 additions & 14 deletions examples/rvc-app/rvc-common/include/rvc-service-area-delegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ namespace Clusters {

class RvcDevice;

typedef bool (RvcDevice::*IsSetSelectedAreasAllowedCallback)(MutableCharSpan statusText);
typedef bool (RvcDevice::*IsValidSelectAreasSetCallback)(const ServiceArea::Commands::SelectAreas::DecodableType & req,
ServiceArea::SelectAreasStatus & areaStatus, MutableCharSpan statusText);
typedef bool (RvcDevice::*HandleSkipCurrentAreaCallback)(uint32_t skippedArea, MutableCharSpan skipStatusText);
typedef bool (RvcDevice::*IsChangeAllowedSimpleCallback)();

namespace ServiceArea {

class RvcServiceAreaDelegate : public Delegate
Expand All @@ -40,32 +46,60 @@ class RvcServiceAreaDelegate : public Delegate
std::vector<uint32_t> mSelectedAreas;
std::vector<ServiceArea::Structs::ProgressStruct::Type> mProgressList;

RvcDevice * mIsSetSelectedAreasAllowedDeviceInstance;
IsSetSelectedAreasAllowedCallback mIsSetSelectedAreasAllowedCallback;
RvcDevice * mHandleSkipCurrentAreaDeviceInstance;
HandleSkipCurrentAreaCallback mHandleSkipCurrentAreaCallback;
RvcDevice * mIsSupportedAreasChangeAllowedDeviceInstance;
IsChangeAllowedSimpleCallback mIsSupportedAreasChangeAllowedCallback;
RvcDevice * mIsSupportedMapChangeAllowedDeviceInstance;
IsChangeAllowedSimpleCallback mIsSupportedMapChangeAllowedCallback;

// hardcoded values for SUPPORTED MAPS.
const uint32_t supportedMapId_XX = 3;
const uint32_t supportedMapId_YY = 245;

// hardcoded values for SUPPORTED AREAS.
const uint32_t supportedAreaID_A = 7;
const uint32_t supportedAreaID_B = 1234567;
const uint32_t supportedAreaID_C = 10050;
const uint32_t supportedAreaID_D = 0x88888888;

/**
* Set the SupportedMaps and SupportedAreas where the SupportedMaps is not null.
*/
void SetMapTopology();

/**
* Set the SupportedMaps and SupportedAreas where the SupportedMaps is null.
*/
void SetNoMapTopology();

public:
CHIP_ERROR Init() override;

// command support
bool IsSetSelectedAreasAllowed(MutableCharSpan statusText) override;
bool IsSetSelectedAreasAllowed(MutableCharSpan & statusText) override;

bool IsValidSelectAreasSet(const ServiceArea::Commands::SelectAreas::DecodableType & req,
ServiceArea::SelectAreasStatus & locationStatus, MutableCharSpan statusText) override;
ServiceArea::SelectAreasStatus & areaStatus, MutableCharSpan & statusText) override;

bool HandleSkipCurrentArea(uint32_t skippedArea, MutableCharSpan skipStatusText) override;
bool HandleSkipCurrentArea(uint32_t skippedArea, MutableCharSpan & skipStatusText) override;

//*************************************************************************
// Supported Locations accessors
// Supported Areas accessors

bool IsSupportedAreasChangeAllowed() override;

uint32_t GetNumberOfSupportedAreas() override;

bool GetSupportedLocationByIndex(uint32_t listIndex, ServiceArea::AreaStructureWrapper & supportedLocation) override;
bool GetSupportedAreaByIndex(uint32_t listIndex, AreaStructureWrapper & supportedArea) override;

bool GetSupportedLocationById(uint32_t aAreaId, uint32_t & listIndex,
ServiceArea::AreaStructureWrapper & supportedLocation) override;
bool GetSupportedAreaById(uint32_t aAreaId, uint32_t & listIndex, AreaStructureWrapper & supportedArea) override;

bool AddSupportedLocation(const ServiceArea::AreaStructureWrapper & newArea, uint32_t & listIndex) override;
bool AddSupportedArea(const AreaStructureWrapper & newArea, uint32_t & listIndex) override;

bool ModifySupportedLocation(uint32_t listIndex, const ServiceArea::AreaStructureWrapper & modifiedLocation) override;
bool ModifySupportedArea(uint32_t listIndex, const AreaStructureWrapper & modifiedArea) override;

bool ClearSupportedAreas() override;

Expand All @@ -87,15 +121,13 @@ class RvcServiceAreaDelegate : public Delegate
bool ClearSupportedMaps() override;

//*************************************************************************
// Selected Locations accessors
// Selected Areas accessors

uint32_t GetNumberOfSelectedAreas() override;

bool GetSelectedLocationByIndex(uint32_t listIndex, uint32_t & selectedLocation) override;

// IsSelectedLocation() no override
bool GetSelectedAreaByIndex(uint32_t listIndex, uint32_t & selectedArea) override;

bool AddSelectedLocation(uint32_t aAreaId, uint32_t & listIndex) override;
bool AddSelectedArea(uint32_t aAreaId, uint32_t & listIndex) override;

bool ClearSelectedAreas() override;

Expand All @@ -115,6 +147,33 @@ class RvcServiceAreaDelegate : public Delegate
const ServiceArea::Structs::ProgressStruct::Type & modifiedProgressElement) override;

bool ClearProgress() override;

//*************************************************************************
// RVC device callback setters

void SetIsSetSelectedAreasAllowedCallback(IsSetSelectedAreasAllowedCallback callback, RvcDevice * instance)
{
mIsSetSelectedAreasAllowedCallback = callback;
mIsSetSelectedAreasAllowedDeviceInstance = instance;
}

void SetHandleSkipCurrentAreaCallback(HandleSkipCurrentAreaCallback callback, RvcDevice * instance)
{
mHandleSkipCurrentAreaCallback = callback;
mHandleSkipCurrentAreaDeviceInstance = instance;
}

void SetIsSupportedAreasChangeAllowedCallback(IsChangeAllowedSimpleCallback callback, RvcDevice * instance)
{
mIsSupportedAreasChangeAllowedCallback = callback;
mIsSupportedAreasChangeAllowedDeviceInstance = instance;
}

void SetIsSupportedMapChangeAllowedCallback(IsChangeAllowedSimpleCallback callback, RvcDevice * instance)
{
mIsSupportedMapChangeAllowedCallback = callback;
mIsSupportedMapChangeAllowedDeviceInstance = instance;
}
};

} // namespace ServiceArea
Expand Down
46 changes: 46 additions & 0 deletions examples/rvc-app/rvc-common/src/rvc-device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,52 @@ void RvcDevice::HandleOpStateGoHomeCallback(Clusters::OperationalState::GenericO
}
}

bool RvcDevice::SaIsSetSelectedAreasAllowed(MutableCharSpan statusText)
{
if (mOperationalStateInstance.GetCurrentOperationalState() == to_underlying(OperationalState::OperationalStateEnum::kRunning))
{
CopyCharSpanToMutableCharSpan("cannot set the Selected Areas while the device is running"_span, statusText);
return false;
}
return true;
}

bool RvcDevice::SaHandleSkipCurrentArea(uint32_t skippedArea, MutableCharSpan skipStatusText)
{
if (mServiceAreaInstance.GetCurrentArea() != skippedArea)
{
// This device only supports skipping the current location.
CopyCharSpanToMutableCharSpan("the skipped area does not match the current area"_span, skipStatusText);
return false;
}

// Call the device's skip command.
// if successful

if (!mServiceAreaInstance.HasFeature(ServiceArea::Feature::kProgressReporting) ||
mServiceAreaDelegate.GetNumberOfProgressElements() == 0)
{
// notting else to do since there is no progress data.
return true;
}

mServiceAreaInstance.SetProgressStatus(skippedArea, ServiceArea::OperationalStatusEnum::kSkipped);

return true;
}

bool RvcDevice::SaIsSupportedAreasChangeAllowed()
{
return mOperationalStateInstance.GetCurrentOperationalState() !=
to_underlying(OperationalState::OperationalStateEnum::kRunning);
}

bool RvcDevice::SaIsSupportedMapChangeAllowed()
{
return mOperationalStateInstance.GetCurrentOperationalState() !=
to_underlying(OperationalState::OperationalStateEnum::kRunning);
}

void RvcDevice::HandleChargedMessage()
{
if (mOperationalStateInstance.GetCurrentOperationalState() !=
Expand Down
Loading
Loading