-
-
Notifications
You must be signed in to change notification settings - Fork 18
Variables set based on module state
Main code should periodically check buffer of serial port communicating with module to catch any event sent from module which define module state(by calling BT.getNextEventFromBT()), here is list of variables and available values and that they mean.
Avalaible variables
- BTState
- CallState
- MusicState
- PowerState
- InputSelected
- MusicMode
- currentVolume
- NumberOfSongs
- CurrentlyPlayingSong
- CurrentFrequency
- CurrentPreset
All of these variables are accessible from main code, check code in example folder:
if (BTState != BT.BTState) {
printBTstate();
BTState = BT.BTState;
}
if (CallState != BT.CallState) {
printCallState();
CallState = BT.CallState;
}
if (MusicState != BT.MusicState) {
printMusicState();
MusicState = BT.MusicState;
}
if (PowerState != BT.PowerState) {
printPowerState();
PowerState = BT.PowerState;
}
if (InputSelected != BT.InputSelected) {
printInputSelected();
InputSelected = BT.InputSelected;
}
if (MusicMode != BT.MusicMode) {
printMusicMode();
MusicMode = BT.MusicMode;
}
if (CurrentFrequency != BT.CurrentFrequency) {
printCurrentFreqency();
CurrentFrequency = BT.CurrentFrequency;
}
if (CurrentPreset != BT.CurrentPreset) {
printCurrentPreset();
CurrentPreset = BT.CurrentPreset;
}
if (currentVolume != BT.currentVolume) {
printCurrentVolume();
currentVolume = BT.currentVolume;
}
State of bluetooth is indicated by variable BTState (uint16_t) which can be one of these:
- CallInProgress
- Connected
- Connecting
- Disconnected
- IncomingCall
- OutgoingCall
- Pairing
State of call is indicated by variable CallState (uint16_t) which can be one of these:
- Busy
- Idle
- IncomingCall
- OutgoingCall
State of music is indicated by variable MusicState (uint16_t) which can be one of these:
- Idle
- Playing
If module is on or off is indicated by variable PowerState (uint16_t) which can be one of these:
- PowerState
- PowerState
Selected input is indicated by variable InputSelected (uint16_t) which can be one of these:
- AUX
- BT
- FM
- SD
- USB
Current play mode is indicated by variable ModeOfPlay (uint16_t) which can be one of these:
- RepeatAll
- RepeatNone
- RepeatOne
Current volume is hold in variale currentVolume (uint16_t), values are from 0 to 15;
In mp3(USB) or TF (sdcard) mode number of songs on driver/card is in variable NumberOfSongs (uint16_t).
In mp3(USB) or TF (sdcard) mode number of song currently played is stored in variable CurrentlyPlayingSong (uint16_t).
In FM mode current tuned freq is stored in variable CurrentFrequency (uint16_t).
In FM mode, if preset is used to tune radio, this used preset is stored in variable CurrentPreset (uint8_t).
(where did I get this? it's not in datasheet!)
Caller number is stored in CallerID variable (String), automaticaly stored when call is in progress, module sent event over serial(which one???) with number and variable is set based on data sent over serial
If requested (by calling function getAddress()) module send data to MCU (AD:191919191919\r\n) this contain blue-tooth address '191919191919' which is parsed by calling function getNextEventFromBT() which parse this data and store address in variable BT_ADDR as string.
If requested (by calling function getName()) module send data to MCU (NA:BK3254\r\n) this contain blue-tooth name 'BK3254' which is parsed by calling function getNextEventFromBT() which parse this data and store blue-tooth name in variable BT_NAME as string.
If requested (by calling function getPinCode()) module send data to MCU (PN:0000\r\n) this contain pin code '0000' which is parsed by calling function getNextEventFromBT() which parse this data and store pin code in variable BT_PIN as string.