@@ -470,6 +470,50 @@ public static function notification($arn, $os, $titre, $message, $badge = 'null'
470470 curl_close ($ ch );
471471 log::add ('mobile ' , 'debug ' , 'notification resultat > ' . $ server_output );
472472 }
473+
474+ public function SaveGeoloc ($ geoloc ){
475+ log::add ('mobile ' , 'debug ' , '|----------------------------------- ' );
476+ log::add ('mobile ' , 'debug ' , '|--debut de la fonction SaveGeoLoc-- ' );
477+ log::add ('mobile ' , 'debug ' , '|----------------------------------- ' );
478+ log::add ('mobile ' , 'debug ' , '| ' );
479+ $ eqLogicMobile = eqLogic::byLogicalId ($ geoloc ['iQ ' ], 'mobile ' );
480+ log::add ('mobile ' , 'debug ' , '| iQ = ' .$ geoloc ['iQ ' ]);
481+ if (isset ($ eqLogicMobile )){
482+ log::add ('mobile ' , 'debug ' , '| Mobile bien trouvé dans cette Jeedom ' );
483+ log::add ('mobile ' , 'debug ' , '| Objet > ' .$ eqLogicMobile ->getId ());
484+ }
485+ $ cmdgeoloc = cmd::byEqLogicIdAndLogicalId ($ eqLogicMobile ->getId (),'geoId_ ' .$ geoloc ['id ' ]);
486+ if (!is_object ($ cmdgeoloc )){
487+ $ cmdgeoloc = new mobileCmd ();
488+ $ cmdgeoloc ->setLogicalId ('geoId_ ' .$ geoloc ['id ' ]);
489+ $ cmdgeoloc ->setEqLogic_id ($ eqLogicMobile ->getId ());
490+ $ cmdgeoloc ->setType ('info ' );
491+ $ cmdgeoloc ->setSubType ('binary ' );
492+ $ cmdgeoloc ->setIsVisible (1 );
493+ }
494+ $ cmdgeoloc ->setName (__ ($ geoloc ['name ' ], __FILE__ ));
495+ $ cmdgeoloc ->setConfiguration ('latitude ' , $ geoloc ['latitude ' ]);
496+ $ cmdgeoloc ->setConfiguration ('longitude ' , $ geoloc ['longitude ' ]);
497+ $ cmdgeoloc ->setConfiguration ('subtitle ' , $ geoloc ['subtitle ' ]);
498+ $ cmdgeoloc ->setConfiguration ('radius ' , $ geoloc ['radius ' ]);
499+ $ cmdgeoloc ->save ();
500+ }
501+
502+ public function DelGeoloc ($ geoloc ){
503+ $ eqLogicMobile = eqLogic::byLogicalId ($ geoloc ['iQ ' ], 'mobile ' );
504+ $ cmdgeoloc = cmd::byEqLogicIdAndLogicalId ($ eqLogicMobile ->getId (),'geoId_ ' .$ geoloc ['id ' ]);
505+ if (isset ($ cmdgeoloc )){
506+ $ cmdgeoloc ->remove ();
507+ }
508+ }
509+
510+ public function EventGeoloc ($ geoloc ){
511+ $ eqLogicMobile = eqLogic::byLogicalId ($ geoloc ['iQ ' ], 'mobile ' );
512+ $ cmdgeoloc = cmd::byEqLogicIdAndLogicalId ($ eqLogicMobile ->getId (),'geoId_ ' .$ geoloc ['id ' ]);
513+ if (isset ($ cmdgeoloc )){
514+ $ cmdgeoloc ->event ($ geoloc ['value ' ]);
515+ }
516+ }
473517
474518 public function postInsert () {
475519 $ key = config::genKey (32 );
0 commit comments