@@ -58,10 +58,10 @@ enum osdp_cp_error_e {
5858static void cp_dispatch_event (struct osdp_pd * pd ,
5959 const struct osdp_event * event )
6060{
61- struct osdp * ctx = pd_to_osdp (pd );
61+ const struct osdp * ctx = pd_to_osdp (pd );
6262
6363 if (ctx -> event_callback ) {
64- ctx -> event_callback (ctx -> event_callback_arg , pd -> idx ,
64+ ctx -> event_callback (ctx -> event_callback_arg , ctx , pd -> idx ,
6565 (struct osdp_event * )event );
6666 osdp_metrics_report (pd , OSDP_METRIC_EVENT );
6767 }
@@ -966,7 +966,7 @@ static int cp_get_online_command(struct osdp_pd *pd)
966966
967967static void notify_pd_status (struct osdp_pd * pd , bool is_online )
968968{
969- struct osdp * ctx = pd_to_osdp (pd );
969+ const struct osdp * ctx = pd_to_osdp (pd );
970970 struct osdp_event evt ;
971971
972972 if (!ctx -> event_callback || !is_notifications_enabled (pd )) {
@@ -976,13 +976,13 @@ static void notify_pd_status(struct osdp_pd *pd, bool is_online)
976976 evt .type = OSDP_EVENT_NOTIFICATION ;
977977 evt .notif .type = OSDP_NOTIFICATION_PD_STATUS ;
978978 evt .notif .arg0 = is_online ;
979- ctx -> event_callback (ctx -> event_callback_arg , pd -> idx , & evt );
979+ ctx -> event_callback (ctx -> event_callback_arg , ctx , pd -> idx , & evt );
980980 osdp_metrics_report (pd , OSDP_METRIC_EVENT );
981981}
982982
983983static void notify_sc_status (struct osdp_pd * pd )
984984{
985- struct osdp * ctx = pd_to_osdp (pd );
985+ const struct osdp * ctx = pd_to_osdp (pd );
986986 struct osdp_event evt ;
987987
988988 if (!ctx -> event_callback || !is_notifications_enabled (pd )) {
@@ -993,14 +993,14 @@ static void notify_sc_status(struct osdp_pd *pd)
993993 evt .notif .type = OSDP_NOTIFICATION_SC_STATUS ;
994994 evt .notif .arg0 = sc_is_active (pd );
995995 evt .notif .arg1 = sc_use_scbkd (pd );
996- ctx -> event_callback (ctx -> event_callback_arg , pd -> idx , & evt );
996+ ctx -> event_callback (ctx -> event_callback_arg , ctx , pd -> idx , & evt );
997997 osdp_metrics_report (pd , OSDP_METRIC_EVENT );
998998}
999999
10001000void osdp_file_tx_notify_done (struct osdp_pd * pd , int file_id ,
10011001 enum osdp_file_tx_outcome outcome )
10021002{
1003- struct osdp * ctx = pd_to_osdp (pd );
1003+ const struct osdp * ctx = pd_to_osdp (pd );
10041004 struct osdp_event evt ;
10051005
10061006 if (!ctx -> event_callback || !is_notifications_enabled (pd )) {
@@ -1011,7 +1011,7 @@ void osdp_file_tx_notify_done(struct osdp_pd *pd, int file_id,
10111011 evt .notif .type = OSDP_NOTIFICATION_FILE_TX_DONE ;
10121012 evt .notif .arg0 = file_id ;
10131013 evt .notif .arg1 = outcome ;
1014- ctx -> event_callback (ctx -> event_callback_arg , pd -> idx , & evt );
1014+ ctx -> event_callback (ctx -> event_callback_arg , ctx , pd -> idx , & evt );
10151015 osdp_metrics_report (pd , OSDP_METRIC_EVENT );
10161016}
10171017
@@ -1280,7 +1280,7 @@ static void notify_command_status(struct osdp_pd *pd, int status)
12801280{
12811281 int app_cmd ;
12821282 struct osdp_event evt ;
1283- struct osdp * ctx = pd_to_osdp (pd );
1283+ const struct osdp * ctx = pd_to_osdp (pd );
12841284
12851285 if (!ctx -> event_callback || !is_notifications_enabled (pd )) {
12861286 return ;
@@ -1317,7 +1317,7 @@ static void notify_command_status(struct osdp_pd *pd, int status)
13171317 evt .notif .arg0 = app_cmd ;
13181318 evt .notif .arg1 = status ? 0 : -1 ;
13191319
1320- ctx -> event_callback (ctx -> event_callback_arg , pd -> idx , & evt );
1320+ ctx -> event_callback (ctx -> event_callback_arg , ctx , pd -> idx , & evt );
13211321 osdp_metrics_report (pd , OSDP_METRIC_EVENT );
13221322}
13231323
0 commit comments