Skip to content

Commit

Permalink
Merge pull request #8 from JEALG/DeleteCodeV1
Browse files Browse the repository at this point in the history
amélioration getConfigForCommunity()
  • Loading branch information
Phpvarious authored Oct 26, 2024
2 parents db7ead1 + 7348cb0 commit aa0a5e6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
5 changes: 2 additions & 3 deletions core/api/mobile.api.php
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ function saveMenuFromAppV2($menu, $mobile)
$mobile = eqLogic::byLogicalId($params['Iq'], 'mobile');
if (is_object($mobile)) {
if (isset($params['transmition']) && isset($params['transmition']['extras']) && isset($params['transmition']['extras']['method'])) {
if($params['transmition']['extras']['method'] == 'getDeviceInformations') {
if ($params['transmition']['extras']['method'] == 'getDeviceInformations') {
log::add('mobile', 'debug', '|┌─────▶︎ methodeForSpecificChannel in Background ──────────────────────');
$mobile->cmdForSpecificChannel($params, 'transmition');
log::add('mobile', 'debug', '|└───────────────────────────────────────────');
Expand Down Expand Up @@ -621,8 +621,7 @@ function saveMenuFromAppV2($menu, $mobile)
if (isset($params['Iq'])) {
log::add('mobile', 'debug', __('| [ERROR] EqLogic inconnu : ', __FILE__) . $params['Iq']);
$jsonrpc->makeError('EqLogic inconnu');
}
else {
} else {
log::add('mobile', 'debug', __('| [ERROR] Paramètre Iq inexistant !', __FILE__));
$jsonrpc->makeError('Paramètre Iq inexistant');
}
Expand Down
22 changes: 12 additions & 10 deletions core/class/mobile.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,16 @@ public static function cronDaily()
* Core callback to provide additional information for a new Community post
*
* @return string
*/
public static function getConfigForCommunity() {
*/
public static function getConfigForCommunity()
{
$hw = jeedom::getHardwareName();
if ($hw == 'diy') $hw = trim(shell_exec('systemd-detect-virt'));
if ($hw == 'none') $hw = 'diy';
$distrib = trim(shell_exec('. /etc/*-release && echo $ID $VERSION_ID'));
$res = 'OS: ' . $distrib . ' on ' . $hw;
$res .= ' ; PHP: ' . phpversion() . '<br/>';
$res = '<br>```<br>';
$res .= 'OS : ' . $distrib . ' on ' . $hw;
$res .= ' - PHP : ' . phpversion() . '<br>```';
$res .= '<br/><br/>';
$res .= '[details="Equipement(s)"]<br/>';
$res .= '|Id | LogicalId | Type | App | defaultIdMobile | Profil | hideMenuGeoloc | hideMenuCustom|<br>';
Expand All @@ -56,7 +58,7 @@ public static function getConfigForCommunity() {
if (is_object($userType)) {
$profil = $userType->getProfils();
}
$res .= '|' . $mobile->getId() . ' | ' . $mobile->getLogicalId() . ' | ' . $mobile->getConfiguration('type_mobile') . ' | v' . $mobile->getConfiguration('appVersion', 1) . ' | ' . $mobile->getConfiguration('defaultIdMobile', 'none') . ' | ' . $profil . ' | ' . $mobile->getConfiguration('hideMenuGeoloc', 0) . ' | ' . $mobile->getConfiguration('hideMenuCustom', 0) .'|<br>';
$res .= '|' . $mobile->getId() . ' | ' . $mobile->getLogicalId() . ' | ' . $mobile->getConfiguration('type_mobile') . ' | v' . $mobile->getConfiguration('appVersion', 1) . ' | ' . $mobile->getConfiguration('defaultIdMobile', 'none') . ' | ' . $profil . ' | ' . $mobile->getConfiguration('hideMenuGeoloc', 0) . ' | ' . $mobile->getConfiguration('hideMenuCustom', 0) . '|<br>';
}
$res .= '[/details]';
return $res;
Expand Down Expand Up @@ -817,9 +819,9 @@ public function cmdForSpecificChannel($params = array(), $_trigger = 'location')
$cmd->event(($params[$_trigger]['battery']['level']) * 100);
}
// charging
if (isset($params[$_trigger]['battery']['is_charging'])) {
// TODO Add cmd for is_charging
}
if (isset($params[$_trigger]['battery']['is_charging'])) {
// TODO Add cmd for is_charging
}
}
// coords
if (isset($params[$_trigger]['coords'])) {
Expand Down Expand Up @@ -868,7 +870,7 @@ public function cleaningNotifications()
foreach ($notifications as $id => $value) {
$notificationDate = strtotime($value['data']['date']);
if (($currentTime - $notificationDate) > $retentionSeconds) {
log::add('mobile', 'debug', '| -> suppression notification > N°' . $id);
log::add('mobile', 'debug', '| -> suppression notification > N°' . $id);
unset($notifications[$id]);
$notificationsModified = true;
}
Expand Down Expand Up @@ -915,7 +917,7 @@ public function postSave()
$cmd->setDisplay('showIconAndNamedashboard', 1);
$cmd->setDisplay('showIconAndNamemobile', 1);
$cmd->setOrder(0);
}
}
$cmd->setEqLogic_id($this->getId());
$cmd->setType('action');
$cmd->setSubType('message');
Expand Down

0 comments on commit aa0a5e6

Please sign in to comment.