@@ -550,10 +550,9 @@ static int resource_value_as_double(const struct lwm2m_obj_path *path,
550
550
}
551
551
552
552
static bool value_conditions_satisfied (const struct lwm2m_obj_path * path ,
553
- uint16_t srv_obj_inst )
553
+ struct notification_attrs * attrs )
554
554
{
555
555
struct lwm2m_notify_value_register * last_notified ;
556
- struct notification_attrs attrs = { 0 };
557
556
double res_value , old_value ;
558
557
void * ref ;
559
558
int ret ;
@@ -563,15 +562,10 @@ static bool value_conditions_satisfied(const struct lwm2m_obj_path *path,
563
562
return true;
564
563
}
565
564
566
- ret = engine_observe_get_attributes (path , & attrs , srv_obj_inst );
567
- if (ret < 0 ) {
568
- return true;
569
- }
570
-
571
565
/* Check if any of the value attributes is actually set. */
572
- if ((attrs . flags & (BIT (LWM2M_ATTR_GT ) |
573
- BIT (LWM2M_ATTR_LT ) |
574
- BIT (LWM2M_ATTR_STEP ))) == 0 ) {
566
+ if ((attrs -> flags & (BIT (LWM2M_ATTR_GT ) |
567
+ BIT (LWM2M_ATTR_LT ) |
568
+ BIT (LWM2M_ATTR_STEP ))) == 0 ) {
575
569
return true;
576
570
}
577
571
@@ -603,25 +597,25 @@ static bool value_conditions_satisfied(const struct lwm2m_obj_path *path,
603
597
return true;
604
598
}
605
599
606
- if ((attrs . flags & BIT (LWM2M_ATTR_STEP )) != 0 ) {
600
+ if ((attrs -> flags & BIT (LWM2M_ATTR_STEP )) != 0 ) {
607
601
double res_diff = old_value > res_value ?
608
602
old_value - res_value : res_value - old_value ;
609
603
610
- if (res_diff >= attrs . st ) {
604
+ if (res_diff >= attrs -> st ) {
611
605
return true;
612
606
}
613
607
}
614
608
615
- if ((attrs . flags & BIT (LWM2M_ATTR_GT )) != 0 ) {
616
- if ((old_value <= attrs . gt && res_value > attrs . gt ) ||
617
- (old_value >= attrs . gt && res_value < attrs . gt )) {
609
+ if ((attrs -> flags & BIT (LWM2M_ATTR_GT )) != 0 ) {
610
+ if ((old_value <= attrs -> gt && res_value > attrs -> gt ) ||
611
+ (old_value >= attrs -> gt && res_value < attrs -> gt )) {
618
612
return true;
619
613
}
620
614
}
621
615
622
- if ((attrs . flags & BIT (LWM2M_ATTR_LT )) != 0 ) {
623
- if ((old_value <= attrs . lt && res_value > attrs . lt ) ||
624
- (old_value >= attrs . lt && res_value < attrs . lt )) {
616
+ if ((attrs -> flags & BIT (LWM2M_ATTR_LT )) != 0 ) {
617
+ if ((old_value <= attrs -> lt && res_value > attrs -> lt ) ||
618
+ (old_value >= attrs -> lt && res_value < attrs -> lt )) {
625
619
return true;
626
620
}
627
621
}
@@ -661,7 +655,7 @@ int lwm2m_notify_observer_path(const struct lwm2m_obj_path *path)
661
655
return ret ;
662
656
}
663
657
664
- if (!value_conditions_satisfied (path , sock_ctx [ i ] -> srv_obj_inst )) {
658
+ if (!value_conditions_satisfied (path , & res_attrs )) {
665
659
continue ;
666
660
}
667
661
0 commit comments