Skip to content

Commit

Permalink
Define posix radio RadioSpinel accessor (#9018)
Browse files Browse the repository at this point in the history
When adding cli commands to be used by a posix platform is is useful
to have access to the spinel interface when trying to communicate with
a RCP using vendor specific spinel properties. It is inadvisable to
create a separate spinel interface for custom properties as the two
interfaces would need to avoid contention on the hardware interface.

This accessor method allows access to the static spinel interface
defined in radio.cpp for external code segments. Dependent source
files can do so with: `(RadioSpinel<InterfaceType,
ProcessContextType>*)Posix::Radio::getSpinelInstance()` or similar.
  • Loading branch information
bertoldi-silabs authored May 10, 2023
1 parent fb45cf2 commit 1203ea6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/posix/platform/radio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,8 @@ void Radio::Init(void)
#endif // OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE
}

void *Radio::GetSpinelInstance(void) { return &sRadioSpinel; }

} // namespace Posix
} // namespace ot

Expand Down
8 changes: 8 additions & 0 deletions src/posix/platform/radio.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@ class Radio
*/
void Init(void);

/**
* This method acts as an accessor to the spinel instance used by the radio.
*
* @returns A pointer to the radio's spinel interface instance.
*
*/
static void *GetSpinelInstance(void);

private:
RadioUrl mRadioUrl;
};
Expand Down

0 comments on commit 1203ea6

Please sign in to comment.