Warning: session_start(): open(/var/lib/php/sessions/sess_pp35p5bh806srs24h3b57hlqm1, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
!7
cmodule HeadphoneDetection > DynBigNumber {
Bool pluggedIn; // null if unknown
int minValue = 100, maxValue;
start {
setDescription("HEADPHONES");
if (!isLinux()) ret with setValue("Linux only, sorry");
doEveryAndNow(10.0, r actualUpdate);
dm_registerAs('headphoneDetector);
}
void actualUpdate enter {
//time "Headphone detect" {
int raw = linux_rawHeadphonesCount();
setField(minValue := min(minValue, raw));
setField(maxValue := max(maxValue, raw));
if (setField(pluggedIn := minValue == maxValue ? null : raw > minValue))
vmBus_sendMessage('headphoneChange, pluggedIn);
setValue(nullFalseTrue(pluggedIn,
"Please plug/unplug headphones once to enable detection",
"NO", "YES"));
//}
}
// API
Bool headphonesDetected() { ret pluggedIn; }
}