The Detect
namespace contains several related functions to help determine if the device where the code is running is a BeagleBone Black, BeagleBone Green, or some other type of device.
More...
Typedefs | |
typedef std::vector< ECompatibility > | Compatibilities |
A vector of capabilities describing a device. More... | |
Enumerations | |
enum | ECompatibility { ECompatibility::invalid = 0, ECompatibility::other, ECompatibility::ti_am33xx, ECompatibility::ti_am335x_bone, ECompatibility::ti_am335x_bone_black, ECompatibility::ti_am335x_bone_green, ECompatibility::ti_am335x_bone_green_wireless } |
Compability enums for this device. More... | |
Functions | |
std::string | to_string (const ECompatibility type) |
Convert a single compatibility to a text string. More... | |
VStr | to_string (const Compatibilities &compabilities) |
Convert a vector of capabilities to a vector of strings. More... | |
Compatibilities | get_compatibilities (void) |
Get the vector of compabilities for this device. More... | |
bool | has (const ECompatibility type) |
Determine if the device compatibilities contains the given type. More... | |
std::string | get_model (void) |
Return the device model or product name as a text string. More... | |
bool | is_beaglebone_compatible (void) |
Determine if the device is compatible with the given type. More... | |
bool | is_beaglebone_black_compatible (void) |
Determine if the device is compatible with the given type. More... | |
bool | is_beaglebone_green_compatible (void) |
Determine if the device is compatible with the given type. More... | |
bool | is_beaglebone_green_wireless_compatible (void) |
Determine if the device is compatible with the given type. More... | |
The Detect
namespace contains several related functions to help determine if the device where the code is running is a BeagleBone Black, BeagleBone Green, or some other type of device.
For example, note the following code:
In addition, the actual model name can also be obtained. This contains a single text string which looks similar to "TI AM335x BeagleBone Green"
. For example:
typedef std::vector<ECompatibility> SG::BeagleBone::Detect::Compatibilities |
A vector of capabilities describing a device.
You'd typically obtain this by calling SG::BeagleBone::Detect::get_compatibilities(). BeagleBone devices typically report they are compatible with multiple devices. For example, a BeagleBone Green doesn't just call itself a BeagleBone Green, but also reports as a BeagleBone and a BeagleBone Black.
|
strong |
SG::BeagleBone::Detect::Compatibilities SG::BeagleBone::Detect::get_compatibilities | ( | void | ) |
Get the vector of compabilities for this device.
/proc/device-tree/compatible
References SG::BeagleBone::all, get_model(), SG::read_file(), and to_string().
Referenced by bb_detect(), and has().
std::string SG::BeagleBone::Detect::get_model | ( | void | ) |
Return the device model or product name as a text string.
For example:
TI AM335x BeagleBone Black
TI AM335x BeagleBone Green
"VirtualBox"
or "Vostro 470"
./proc/device-tree/model
/sys/devices/virtual/dmi/id/product_name
References SG::file_exists(), SG::read_file(), and SG::trim().
Referenced by bb_detect(), and get_compatibilities().
bool SG::BeagleBone::Detect::has | ( | const ECompatibility | type | ) |
Determine if the device compatibilities contains the given type.
For example:
The equivalent functionality can be obtained by calling the individual type functions, such as:
References get_compatibilities().
Referenced by is_beaglebone_black_compatible(), is_beaglebone_compatible(), is_beaglebone_green_compatible(), and is_beaglebone_green_wireless_compatible().
|
inline |
Determine if the device is compatible with the given type.
References has(), and ti_am335x_bone_black.
Referenced by bb_detect().
|
inline |
Determine if the device is compatible with the given type.
References has(), and ti_am335x_bone.
Referenced by bb_detect().
|
inline |
Determine if the device is compatible with the given type.
References has(), and ti_am335x_bone_green.
Referenced by bb_detect().
|
inline |
Determine if the device is compatible with the given type.
References has(), and ti_am335x_bone_green_wireless.
std::string SG::BeagleBone::Detect::to_string | ( | const ECompatibility | type | ) |
Convert a single compatibility to a text string.
Referenced by bb_detect(), SG::Font::Monospace::get(), SG::BeagleBone::LEDControl::get_base_path(), get_compatibilities(), SG::GroveBase::get_description(), SG::GpioManagement::get_value(), SG::GpioManagement::gpio_export(), SG::GroveI2CDigital::GroveI2CDigital(), SG::GpioManagement::is_exported(), SG::GpioManagement::set_direction(), SG::ThreeAxisDigitalCompass::set_mode(), SG::CommonOLED::set_orientation(), SG::BeagleBone::Watchdog::set_timeout(), SG::GpioManagement::set_value(), SG::CommonOLED::show(), to_string(), and SG::GroveI2CDigital::write_block().
SG::VStr SG::BeagleBone::Detect::to_string | ( | const Compatibilities & | compabilities | ) |
Convert a vector of capabilities to a vector of strings.
References to_string().