the end
This commit is contained in:
parent
31bc2d0b75
commit
44dff6bfef
|
|
@ -49,5 +49,6 @@
|
||||||
"main3": "cpp",
|
"main3": "cpp",
|
||||||
"cstring": "cpp",
|
"cstring": "cpp",
|
||||||
"iomanip": "cpp"
|
"iomanip": "cpp"
|
||||||
}
|
},
|
||||||
|
"C_Cpp.errorSquiggles": "disabled"
|
||||||
}
|
}
|
||||||
30
main8.cpp
30
main8.cpp
|
|
@ -21,18 +21,31 @@ int generateRandomHeartRate() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// === Simulate buzzer activation ===
|
// === Simulate buzzer activation ===
|
||||||
void activateBuzzer() {
|
void activateBuzzer(bool activationBuz) {
|
||||||
|
if (activationBuz) {
|
||||||
std::cout << " Buzzer activated (CARDIAC ALERT)!" << std::endl;
|
std::cout << " Buzzer activated (CARDIAC ALERT)!" << std::endl;
|
||||||
|
} else {
|
||||||
|
std::cout << " Buzzer desactivated" << std::endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// === Simulate vibration motor activation ===
|
// === Simulate vibration motor activation ===
|
||||||
void activateVibration() {
|
void activateVibration(bool activationVib) {
|
||||||
|
if (activationVib) {
|
||||||
std::cout << " Vibration activated (CARDIAC ALERT)!" << std::endl;
|
std::cout << " Vibration activated (CARDIAC ALERT)!" << std::endl;
|
||||||
|
} else {
|
||||||
|
std::cout << " Vibration desactivated" << std::endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// === Simulate Bluetooth transmission ===
|
// === Simulate Bluetooth transmission ===
|
||||||
void sendMessageBluetooth(bool urgence) {
|
void sendMessageBluetooth(bool urgence) {
|
||||||
std::cout << " Message Bluetooth send : " << (urgence ? "TRUE (urgence)" : "FALSE (normal)") << std::endl;
|
if (urgence) {
|
||||||
|
std::cout << " Message Bluetooth send : TRUE (urgence)" << std::endl;
|
||||||
|
} else {
|
||||||
|
std::cout << " Message Bluetooth send : FALSE (normal)" << std::endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// send avg bvpm of the last minute
|
// send avg bvpm of the last minute
|
||||||
|
|
@ -72,24 +85,27 @@ int main() {
|
||||||
|
|
||||||
if (bpm < BPM_MIN && bpm > BPM_TACHYCARDIA){
|
if (bpm < BPM_MIN && bpm > BPM_TACHYCARDIA){
|
||||||
std::cout << " [BRADYCARDIA]" << std::endl;
|
std::cout << " [BRADYCARDIA]" << std::endl;
|
||||||
activateVibration();
|
activateVibration(true);
|
||||||
i=0;
|
i=0;
|
||||||
|
|
||||||
} else if(bpm < BPM_BRADYCARDIA && bpm > BPM_MAX) {
|
} else if(bpm < BPM_BRADYCARDIA && bpm > BPM_MAX) {
|
||||||
std::cout << " [TACHYCARDIA]" << std::endl;
|
std::cout << " [TACHYCARDIA]" << std::endl;
|
||||||
activateVibration();
|
activateVibration(true);
|
||||||
i=0;
|
i=0;
|
||||||
|
|
||||||
}else if(bpm < BPM_MAX && bpm > BPM_MIN){
|
}else if(bpm < BPM_MAX && bpm > BPM_MIN){
|
||||||
std::cout << " [NORMAL]" << std::endl;
|
std::cout << " [NORMAL]" << std::endl;
|
||||||
|
activateBuzzer(false);
|
||||||
|
activateVibration(false);
|
||||||
|
sendMessageBluetooth(false);
|
||||||
i=0;
|
i=0;
|
||||||
|
|
||||||
} else if (bpm < BPM_TACHYCARDIA){
|
} else if (bpm < BPM_TACHYCARDIA){
|
||||||
if (i=THRESHOLD_CARDIAC_ARREST && lastBPM < BPM_TACHYCARDIA){
|
if (i=THRESHOLD_CARDIAC_ARREST && lastBPM < BPM_TACHYCARDIA){
|
||||||
i=0;
|
i=0;
|
||||||
std::cout << " \n !! Number = 2 [HEART ATTACK]" << std::endl;
|
std::cout << " \n !! Number = 2 [HEART ATTACK]" << std::endl;
|
||||||
activateBuzzer();
|
activateBuzzer(true);
|
||||||
activateVibration();
|
activateVibration(true);
|
||||||
sendMessageBluetooth(true);
|
sendMessageBluetooth(true);
|
||||||
}else{
|
}else{
|
||||||
i+=1;
|
i+=1;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue