bool getProperties();
bool openTuner();
bool checkAntenna();
- BandConfig& getBand(unsigned idx);
+
+ /**
+ * Retrieves AM/FM band configuration from module properties.
+ *
+ * The configuration may not exist: if radio type is other than AM/FM
+ * or provided index is out of bounds.
+ * In such case, empty configuration is returned.
+ *
+ * @param idx Band index to retrieve.
+ * @return Band configuration reference.
+ */
+ const BandConfig& getBand(unsigned idx);
static const nsecs_t kConnectCallbacktimeoutNs = seconds_to_nanoseconds(1);
static const nsecs_t kConfigCallbacktimeoutNs = seconds_to_nanoseconds(10);
return ((halResult == Result::OK) && (halConfig.antennaConnected == true));
}
-BandConfig& BroadcastRadioHidlTest::getBand(unsigned idx) {
+const BandConfig& BroadcastRadioHidlTest::getBand(unsigned idx) {
static BandConfig dummyBandConfig = {};
if (radioClass == Class::AM_FM) {
EXPECT_GT(mHalProperties.bands.size(), idx);
auto openCb = [&](Result result, const sp<ITuner>&) { halResult = result; };
auto hidlReturn = mRadio->openTuner(getBand(0), true, mTunerCallback, openCb);
EXPECT_TRUE(hidlReturn.isOk());
- if (halResult == Result::INVALID_STATE) {
- EXPECT_TRUE(waitForCallback(kConfigCallbacktimeoutNs));
+ if (halResult == Result::OK) {
+ if (radioClass == Class::AM_FM) {
+ EXPECT_TRUE(waitForCallback(kConfigCallbacktimeoutNs));
+ }
+ } else {
+ EXPECT_EQ(Result::INVALID_STATE, halResult);
}
}
* - the methods return 0 (no error)
* - the configuration callback is received within kConfigCallbacktimeoutNs ns
* - the configuration read back from HAl has the same class Id
+ *
+ * Skipped for other radio classes than AM/FM, because setConfiguration
+ * applies only for these bands.
*/
TEST_P(BroadcastRadioHidlTest, SetAndGetConfiguration) {
if (radioClass != Class::AM_FM) skipped = true;
* Verifies that:
* - the methods returns INVALID_ARGUMENTS on invalid arguments
* - the method recovers and succeeds after passing correct arguments
+ *
+ * Skipped for other radio classes than AM/FM, because setConfiguration
+ * applies only for these bands.
*/
TEST_P(BroadcastRadioHidlTest, SetConfigurationFails) {
if (radioClass != Class::AM_FM) skipped = true;
* - the method returns 0 (no error)
* - the tuned callback is received within kTuneCallbacktimeoutNs ns
* - skipping sub-channel or not does not fail the call
+ *
+ * Skipped for other radio classes than AM/FM, because step is not possible
+ * on DAB nor satellite.
*/
TEST_P(BroadcastRadioHidlTest, Step) {
if (radioClass != Class::AM_FM) skipped = true;
* - the HAL implements the methods
* - the methods return 0 (no error)
* - the tuned callback is received within kTuneCallbacktimeoutNs ns after tune()
+ *
+ * Skipped for other radio classes than AM/FM, because tune to frequency
+ * is not possible on DAB nor satellite.
*/
TEST_P(BroadcastRadioHidlTest, TuneAndGetProgramInformationAndCancel) {
if (radioClass != Class::AM_FM) skipped = true;
* Verifies that:
* - the method returns INVALID_ARGUMENTS when applicable
* - the method recovers and succeeds after passing correct arguments
+ *
+ * Skipped for other radio classes than AM/FM, because tune to frequency
+ * is not possible on DAB nor satellite.
*/
TEST_P(BroadcastRadioHidlTest, TuneFailsOutOfBounds) {
if (radioClass != Class::AM_FM) skipped = true;