Skip to content

Specific usage of the getStatus method? #161

Answered by Makuna
caibimiaokong asked this question in Q&A
Discussion options

You must be logged in to vote

(moved to discussions where questions are asked and answered)

The Wiki Entry for the getStatus method

Using the form of mp3.getStatus().state is not a good idea in any code. Every time you call getStatus() it communicates to the chip in this case, in other similar uses it could be far worse. Don't assume these calls are cheap. Call it once and store the results then use the results.

Why did you think you needed the single quotes around DfMp3_StatusState_Paused? DfMp3_Status.state is an enum. Search for how c++ enums are used.

DfMp3_Status status = mp3.getStatus();

if (status.state == DfMp3_StatusState_Playing)
{
}

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@caibimiaokong
Comment options

Answer selected by Makuna
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #160 on February 11, 2024 04:45.