Axis Customer Forum

It is currently Sun Jun 16, 2019 2:54 am

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Tue Nov 03, 2015 12:53 pm 

Joined: Thu Nov 20, 2014 9:10 am
Posts: 3
Hello, all.

Help me understand how can subscribe to the event use axsdk/axevent.h

For example:
How can I access to the IO ports from within the app? I try to use example ax_event_subscription_example.c from axis/emb-app-sdk_2_0_2/apps/axevent/

Code:
static guint subscribe_to_manual_trigger_port(AXEventHandler *event_handler,  gint port, guint *token)
{
  AXEventKeyValueSet *key_value_set;
  guint subscription;

  key_value_set = ax_event_key_value_set_new();

  gboolean res =  ax_event_key_value_set_add_key_values(key_value_set,
        NULL,
        "topic0", "tns1", "Device", AX_VALUE_TYPE_STRING,
        "topic1", "tnsaxis", "IO", AX_VALUE_TYPE_STRING,
        "topic2", "tnsaxis", "Port", AX_VALUE_TYPE_STRING,
        "port", NULL, &port, AX_VALUE_TYPE_INT,
        "state", NULL, NULL, AX_VALUE_TYPE_BOOL,
        NULL);
  g_message("ax_event_key_value_set_add_key_values: %d", res);

  res = ax_event_handler_subscribe(event_handler, key_value_set,
        &subscription, (AXSubscriptionCallback)subscription_callback, token,
        NULL);
  g_message("ax_event_handler_subscribe: %d", res);


  ax_event_key_value_set_free(key_value_set);

  return subscription;
}

I close curcuit between 1 and 3 pins on camera IO port but subscription_callback() not running again.


Top
 Profile  
 
PostPosted: Mon Nov 09, 2015 12:54 pm 

Joined: Mon Nov 09, 2015 12:52 pm
Posts: 3
Can you get your callback to be executed upon e.g. manual trigger but fails on IO/Port/state?

If the later, try removing the following lines

Code:

"port", NULL, &port, AX_VALUE_TYPE_INT,
"state", NULL, NULL, AX_VALUE_TYPE_BOOL,


This will capture all events for all IO ports at any state. If this works, add additional filters such as port and state.

I recommend to validate the electrical circuits by toggling the ports and read out the values on the cameras interface for IO ports.


Top
 Profile  
 
PostPosted: Tue Nov 10, 2015 6:27 am 

Joined: Thu Nov 20, 2014 9:10 am
Posts: 3
Pandos Me wrote:

If the later, try removing the following lines

Code:

"port", NULL, &port, AX_VALUE_TYPE_INT,
"state", NULL, NULL, AX_VALUE_TYPE_BOOL,


It helped me, tanks.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron
Powered by phpBB® Forum Software © phpBB Group