LCC Fusion Project 1.0
LCC Automation
Loading...
Searching...
No Matches
SoundPlayerDevice Class Reference

#include <SoundPlayerDevice.h>

Collaboration diagram for SoundPlayerDevice:

Public Member Functions

void begin ()
 Invoke to begin the connection to a local player device using software Serial UART. Initialize the DFPlayer device and restore previously saved settings (from SPIFFs file) for the DFPLayer device. More...
 
bool begin (uint8_t i2cBusNum, uint8_t i2cSlaveAddressOffset)
 Invoke to begin the connection to a remote player device using Serial I2C. More...
 
void play (uint8_t fileNum, uint8_t volume)
 sends the 'play' command (play mp3 file once) to either a local or remote player device. More...
 
void loop (uint8_t fileNum, uint8_t volume)
 sends the 'loop' command (play mp3 file continously) to either a local or remote player device. More...
 
void pause ()
 sends the 'pause' command (play mp3 file once) to either a local or remote player device.
The player will be paused until either a 'play' or 'loop' request is received. More...
 
void reset ()
 clears the players settings. Note that after each play/loop/pause request, the player's settings are saved in a SPIFFs file. Saved settings are restored later after a player powered on. Clearing the settings causes the player to not play (until a play or loop request is received). More...
 

Private Attributes

SoftwareSerial swSerial_
 Object for I2C connection to remote player.
 
DefaultDeviceSettings defaultDeviceSettings_
 True = Node is connected to a local player, False = Node is connected via I2C to a remote player.
 

Detailed Description

Parameters
playerNumis the number of the player (1-nn) the object is being created for.
Usage:
static uint8_t playerNum
Global counter to assign unique player numbers to each instance.

Definition at line 58 of file SoundPlayerDevice.h.

Member Function Documentation

◆ begin() [1/2]

void SoundPlayerDevice::begin ( )
inline

Invoke to begin the connection to a local player device using software Serial UART. Initialize the DFPlayer device and restore previously saved settings (from SPIFFs file) for the DFPLayer device.


Definition at line 88 of file SoundPlayerDevice.h.

◆ begin() [2/2]

bool SoundPlayerDevice::begin ( uint8_t  i2cBusNum,
uint8_t  i2cSlaveAddressOffset 
)
inline

Invoke to begin the connection to a remote player device using Serial I2C.


Parameters
i2cBusNumis the I2C bus to be used for the connection (0 or 1).
i2cSlaveAddressOffsetis the I2C slave address offset to be added to the base address.
The offset is configured by the administrator in the CDI to match the offset configured on the an I2C enabled card (address offset switch settings).

Definition at line 113 of file SoundPlayerDevice.h.

Here is the call graph for this function:

◆ loop()

void SoundPlayerDevice::loop ( uint8_t  fileNum,
uint8_t  volume 
)
inline

sends the 'loop' command (play mp3 file continously) to either a local or remote player device.


Parameters
fileNumis the file number to be played.
For DFPlayer, this is the position in a sorted list of files in the root directory of the SD card, each name '0000n.mp3'.
volumeis the % of volume to be played (0-100).

Definition at line 153 of file SoundPlayerDevice.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pause()

void SoundPlayerDevice::pause ( )
inline

sends the 'pause' command (play mp3 file once) to either a local or remote player device.
The player will be paused until either a 'play' or 'loop' request is received.


Definition at line 175 of file SoundPlayerDevice.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ play()

void SoundPlayerDevice::play ( uint8_t  fileNum,
uint8_t  volume 
)
inline

sends the 'play' command (play mp3 file once) to either a local or remote player device.


Parameters
fileNumis the file number to be played.
For DFPlayer, this is the position in a sorted list of files in the root directory of the SD card, each name '0000n.mp3'.
volumeis the % of volume to be played (0-100).

Definition at line 127 of file SoundPlayerDevice.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reset()

void SoundPlayerDevice::reset ( )
inline

clears the players settings. Note that after each play/loop/pause request, the player's settings are saved in a SPIFFs file. Saved settings are restored later after a player powered on. Clearing the settings causes the player to not play (until a play or loop request is received).


Definition at line 211 of file SoundPlayerDevice.h.

Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following file: