improve introspection

Small cleanups
This commit is contained in:
Wim Taymans 2016-08-18 12:17:31 +02:00
parent ab0537305f
commit bdbddaf75b
15 changed files with 117 additions and 688 deletions

View file

@ -148,9 +148,8 @@ pinos_context_finalize (GObject * object)
pinos_properties_free (priv->properties);
g_list_free (priv->nodes);
g_list_free (priv->ports);
g_list_free (priv->links);
g_list_free (priv->clients);
g_list_free (priv->channels);
g_clear_object (&priv->subscribe);
g_clear_error (&priv->error);
@ -417,18 +416,11 @@ subscription_cb (PinosSubscribe *subscribe,
priv->nodes = g_list_remove (priv->nodes, object);
break;
case PINOS_SUBSCRIPTION_FLAG_PORT:
case PINOS_SUBSCRIPTION_FLAG_LINK:
if (event == PINOS_SUBSCRIPTION_EVENT_NEW)
priv->ports = g_list_prepend (priv->ports, object);
priv->links = g_list_prepend (priv->links, object);
else if (event == PINOS_SUBSCRIPTION_EVENT_REMOVE)
priv->ports = g_list_remove (priv->ports, object);
break;
case PINOS_SUBSCRIPTION_FLAG_CHANNEL:
if (event == PINOS_SUBSCRIPTION_EVENT_NEW)
priv->channels = g_list_prepend (priv->channels, object);
else if (event == PINOS_SUBSCRIPTION_EVENT_REMOVE)
priv->channels = g_list_remove (priv->channels, object);
priv->links = g_list_remove (priv->links, object);
break;
}

View file

@ -434,57 +434,44 @@ pinos_direction_as_string (PinosDirection direction)
}
static void
port_fill_info (PinosPortInfo *info, GDBusProxy *proxy)
link_fill_info (PinosLinkInfo *info, GDBusProxy *proxy)
{
GHashTable *changed = g_object_get_data (G_OBJECT (proxy), "pinos-changed-properties");
info->id = proxy;
info->port_path = g_dbus_proxy_get_object_path (proxy);
SET_UINT32 ("Direction", direction, 0, PINOS_DIRECTION_INVALID);
SET_STRING ("Node", node_path, 0);
info->link_path = g_dbus_proxy_get_object_path (proxy);
info->change_mask = 0;
SET_STRING ("Name", name, 0);
SET_OBJV ("Peers", peers, 1);
SET_PROPERTIES ("Properties", properties, 2);
SET_BYTES ("PossibleFormats", possible_formats, 3);
SET_BYTES ("Format", format, 4);
SET_STRING ("SrcPort", source_port_path, 0);
SET_STRING ("DestPort", destination_port_path, 1);
if (changed)
g_hash_table_remove_all (changed);
}
static void
port_clear_info (PinosPortInfo *info)
link_clear_info (PinosLinkInfo *info)
{
if (info->peers)
g_strfreev (info->peers);
if (info->properties)
pinos_properties_free (info->properties);
if (info->possible_formats)
g_bytes_unref (info->possible_formats);
if (info->format)
g_bytes_unref (info->format);
}
/**
* pinos_context_list_port_info:
* pinos_context_list_link_info:
* @context: a connected #PinosContext
* @flags: extra #PinosPortInfoFlags
* @cb: a #PinosPortInfoCallback
* @flags: extra #PinosLinkInfoFlags
* @cb: a #PinosLinkInfoCallback
* @cancelable: a #GCancellable
* @callback: a #GAsyncReadyCallback to call when the operation is finished
* @user_data: user data passed to @cb
*
* Call @cb for each port.
* Call @cb for each link.
*/
void
pinos_context_list_port_info (PinosContext *context,
PinosPortInfoFlags flags,
PinosPortInfoCallback cb,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
pinos_context_list_link_info (PinosContext *context,
PinosLinkInfoFlags flags,
PinosLinkInfoCallback cb,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
PinosContextPrivate *priv;
GList *walk;
@ -497,13 +484,13 @@ pinos_context_list_port_info (PinosContext *context,
priv = context->priv;
for (walk = priv->ports; walk; walk = g_list_next (walk)) {
for (walk = priv->links; walk; walk = g_list_next (walk)) {
GDBusProxy *proxy = walk->data;
PinosPortInfo info;
PinosLinkInfo info;
port_fill_info (&info, proxy);
link_fill_info (&info, proxy);
cb (context, &info, user_data);
port_clear_info (&info);
link_clear_info (&info);
}
g_task_return_boolean (task, TRUE);
@ -511,27 +498,27 @@ pinos_context_list_port_info (PinosContext *context,
}
/**
* pinos_context_get_port_info_by_id:
* pinos_context_get_link_info_by_id:
* @context: a connected #PinosContext
* @id: a port id
* @flags: extra #PinosPortInfoFlags
* @cb: a #PinosPortInfoCallback
* @id: a link id
* @flags: extra #PinosLinkInfoFlags
* @cb: a #PinosLinkInfoCallback
* @cancelable: a #GCancellable
* @callback: a #GAsyncReadyCallback to call when the operation is finished
* @user_data: user data passed to @cb
*
* Call @cb for the port with @id.
* Call @cb for the link with @id.
*/
void
pinos_context_get_port_info_by_id (PinosContext *context,
pinos_context_get_link_info_by_id (PinosContext *context,
gpointer id,
PinosPortInfoFlags flags,
PinosPortInfoCallback cb,
PinosLinkInfoFlags flags,
PinosLinkInfoCallback cb,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
PinosPortInfo info;
PinosLinkInfo info;
GDBusProxy *proxy;
GTask *task;
@ -543,270 +530,9 @@ pinos_context_get_port_info_by_id (PinosContext *context,
proxy = G_DBUS_PROXY (id);
port_fill_info (&info, proxy);
link_fill_info (&info, proxy);
cb (context, &info, user_data);
port_clear_info (&info);
g_task_return_boolean (task, TRUE);
g_object_unref (task);
}
/**
* pinos_port_state_as_string:
* @state: a #PinosPortState
*
* Return the string representation of @state.
*
* Returns: the string representation of @state.
*/
const gchar *
pinos_port_state_as_string (PinosPortState state)
{
GEnumValue *val;
val = g_enum_get_value (G_ENUM_CLASS (g_type_class_ref (PINOS_TYPE_PORT_STATE)),
state);
return val == NULL ? "invalid-state" : val->value_nick;
}
/**
* pinos_channel_state_as_string:
* @state: a #PinosChannelState
*
* Return the string representation of @state.
*
* Returns: the string representation of @state.
*/
const gchar *
pinos_channel_state_as_string (PinosChannelState state)
{
GEnumValue *val;
val = g_enum_get_value (G_ENUM_CLASS (g_type_class_ref (PINOS_TYPE_CHANNEL_STATE)),
state);
return val == NULL ? "invalid-state" : val->value_nick;
}
static void
channel_fill_info (PinosChannelInfo *info, GDBusProxy *proxy)
{
GHashTable *changed = g_object_get_data (G_OBJECT (proxy), "pinos-changed-properties");
info->id = proxy;
info->channel_path = g_dbus_proxy_get_object_path (proxy);
SET_UINT32 ("Direction", direction, 2, PINOS_DIRECTION_INVALID);
SET_STRING ("Client", client_path, 0);
info->change_mask = 0;
SET_STRING ("Port", port_path, 0);
SET_PROPERTIES ("Properties", properties, 1);
SET_UINT32 ("State", state, 2, PINOS_CHANNEL_STATE_ERROR);
SET_BYTES ("PossibleFormats", possible_formats, 3);
SET_BYTES ("Format", format, 4);
if (changed)
g_hash_table_remove_all (changed);
}
static void
channel_clear_info (PinosChannelInfo *info)
{
if (info->possible_formats)
g_bytes_unref (info->possible_formats);
if (info->format)
g_bytes_unref (info->format);
if (info->properties)
pinos_properties_free (info->properties);
}
/**
* pinos_context_list_channel_info:
* @context: a connected #PinosContext
* @flags: extra #PinosChannelInfoFlags
* @cb: a #PinosChannelInfoCallback
* @cancelable: a #GCancellable
* @callback: a #GAsyncReadyCallback to call when the operation is finished
* @user_data: user data passed to @cb
*
* Call @cb for each channel.
*/
void
pinos_context_list_channel_info (PinosContext *context,
PinosChannelInfoFlags flags,
PinosChannelInfoCallback cb,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
PinosContextPrivate *priv;
GList *walk;
GTask *task;
g_return_if_fail (PINOS_IS_CONTEXT (context));
g_return_if_fail (cb != NULL);
task = g_task_new (context, cancellable, callback, user_data);
priv = context->priv;
for (walk = priv->channels; walk; walk = g_list_next (walk)) {
GDBusProxy *proxy = walk->data;
PinosChannelInfo info;
channel_fill_info (&info, proxy);
cb (context, &info, user_data);
channel_clear_info (&info);
}
g_task_return_boolean (task, TRUE);
g_object_unref (task);
}
/**
* pinos_context_get_channel_info_by_id:
* @context: a connected #PinosContext
* @id: a channel id
* @flags: extra #PinosChannelInfoFlags
* @cb: a #PinosChannelInfoCallback
* @cancelable: a #GCancellable
* @callback: a #GAsyncReadyCallback to call when the operation is finished
* @user_data: user data passed to @cb
*
* Call @cb for the channel with @id.
*/
void
pinos_context_get_channel_info_by_id (PinosContext *context,
gpointer id,
PinosChannelInfoFlags flags,
PinosChannelInfoCallback cb,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
PinosChannelInfo info;
GDBusProxy *proxy;
GTask *task;
g_return_if_fail (PINOS_IS_CONTEXT (context));
g_return_if_fail (id != NULL);
g_return_if_fail (cb != NULL);
task = g_task_new (context, cancellable, callback, user_data);
proxy = G_DBUS_PROXY (id);
channel_fill_info (&info, proxy);
cb (context, &info, user_data);
channel_clear_info (&info);
g_task_return_boolean (task, TRUE);
g_object_unref (task);
}
static void
connection_fill_info (PinosConnectionInfo *info, GDBusProxy *proxy)
{
GHashTable *changed = g_object_get_data (G_OBJECT (proxy), "pinos-changed-properties");
info->id = proxy;
info->connection_path = g_dbus_proxy_get_object_path (proxy);
info->change_mask = 0;
SET_STRING ("SourcePort", source_port_path, 0);
SET_STRING ("DestinationPort", destination_port_path, 1);
if (changed)
g_hash_table_remove_all (changed);
}
static void
connection_clear_info (PinosConnectionInfo *info)
{
}
/**
* pinos_context_list_connection_info:
* @context: a connected #PinosContext
* @flags: extra #PinosConnectionInfoFlags
* @cb: a #PinosConnectionInfoCallback
* @cancelable: a #GCancellable
* @callback: a #GAsyncReadyCallback to call when the operation is finished
* @user_data: user data passed to @cb
*
* Call @cb for each connection.
*/
void
pinos_context_list_connection_info (PinosContext *context,
PinosConnectionInfoFlags flags,
PinosConnectionInfoCallback cb,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
PinosContextPrivate *priv;
GList *walk;
GTask *task;
g_return_if_fail (PINOS_IS_CONTEXT (context));
g_return_if_fail (cb != NULL);
task = g_task_new (context, cancellable, callback, user_data);
priv = context->priv;
for (walk = priv->connections; walk; walk = g_list_next (walk)) {
GDBusProxy *proxy = walk->data;
PinosConnectionInfo info;
connection_fill_info (&info, proxy);
cb (context, &info, user_data);
connection_clear_info (&info);
}
g_task_return_boolean (task, TRUE);
g_object_unref (task);
}
/**
* pinos_context_get_connection_info_by_id:
* @context: a connected #PinosContext
* @id: a connection id
* @flags: extra #PinosConnectionInfoFlags
* @cb: a #PinosConnectionInfoCallback
* @cancelable: a #GCancellable
* @callback: a #GAsyncReadyCallback to call when the operation is finished
* @user_data: user data passed to @cb
*
* Call @cb for the connection with @id.
*/
void
pinos_context_get_connection_info_by_id (PinosContext *context,
gpointer id,
PinosConnectionInfoFlags flags,
PinosConnectionInfoCallback cb,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
PinosConnectionInfo info;
GDBusProxy *proxy;
GTask *task;
g_return_if_fail (PINOS_IS_CONTEXT (context));
g_return_if_fail (id != NULL);
g_return_if_fail (cb != NULL);
task = g_task_new (context, cancellable, callback, user_data);
proxy = G_DBUS_PROXY (id);
connection_fill_info (&info, proxy);
cb (context, &info, user_data);
connection_clear_info (&info);
link_clear_info (&info);
g_task_return_boolean (task, TRUE);
g_object_unref (task);

View file

@ -64,24 +64,6 @@ typedef enum {
const gchar * pinos_direction_as_string (PinosDirection direction);
/**
* PinosPortState:
* @PINOS_PORT_STATE_ERROR: the port is in error
* @PINOS_PORT_STATE_STOPPED: the port is stopped
* @PINOS_PORT_STATE_STARTING: the port is starting
* @PINOS_PORT_STATE_STREAMING: the port is streaming
*
* The different port states
*/
typedef enum {
PINOS_PORT_STATE_ERROR = -1,
PINOS_PORT_STATE_STOPPED = 0,
PINOS_PORT_STATE_STARTING = 1,
PINOS_PORT_STATE_STREAMING = 2,
} PinosPortState;
const gchar * pinos_port_state_as_string (PinosPortState state);
#include <pinos/client/context.h>
#include <pinos/client/properties.h>
@ -261,217 +243,60 @@ void pinos_context_get_node_info_by_id (PinosContext *context,
/**
* PinosPortInfo:
* @id: generic id of the port
* @port_path: the unique path of the port, suitable for connecting
* @node_path: the node path of the port
* @direction: the direction of the port
* @change_mask: bitfield of changed fields since last call
* @name: name the port, suitable for display
* @peers: paths to peer ports
* @properties: the properties of the port
* @possible_formats: the possible formats this port can consume
* @format: the current format on this port
*
* The port information. Extra information can be added in later
* versions.
*/
typedef struct {
gpointer id;
const char *port_path;
const char *node_path;
PinosDirection direction;
guint64 change_mask;
const char *name;
PinosProperties *properties;
gchar **peers;
GBytes *possible_formats;
GBytes *format;
} PinosPortInfo;
/**
* PinosPortInfoFlags:
* @PINOS_PORT_INFO_FLAGS_NONE: no flags
* @PINOS_PORT_INFO_FLAGS_FORMATS: include formats
*
* Extra flags to pass to pinos_context_get_port_info_list.
*/
typedef enum {
PINOS_PORT_INFO_FLAGS_NONE = 0,
PINOS_PORT_INFO_FLAGS_FORMATS = (1 << 0)
} PinosPortInfoFlags;
/**
* PinosPortInfoCallback:
* @c: a #PinosContext
* @info: a #PinosPortInfo
* @user_data: user data
*
* Callback with information about the Pinos port in @info.
*/
typedef void (*PinosPortInfoCallback) (PinosContext *c,
const PinosPortInfo *info,
gpointer user_data);
void pinos_context_list_port_info (PinosContext *context,
PinosPortInfoFlags flags,
PinosPortInfoCallback cb,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
void pinos_context_get_port_info_by_id (PinosContext *context,
gpointer id,
PinosPortInfoFlags flags,
PinosPortInfoCallback cb,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
/**
* PinosChannelState:
* @PINOS_CHANNEL_STATE_ERROR: the channel is in error
* @PINOS_CHANNEL_STATE_STOPPED: the channel is stopped
* @PINOS_CHANNEL_STATE_STARTING: the channel is starting
* @PINOS_CHANNEL_STATE_STREAMING: the channel is streaming
*
* The different channel states
*/
typedef enum {
PINOS_CHANNEL_STATE_ERROR = -1,
PINOS_CHANNEL_STATE_STOPPED = 0,
PINOS_CHANNEL_STATE_STARTING = 1,
PINOS_CHANNEL_STATE_STREAMING = 2,
} PinosChannelState;
const gchar * pinos_channel_state_as_string (PinosChannelState state);
/**
* PinosChannelInfo:
* @id: generic id of the channel_
* @channel_path: the unique path of the channel
* @direction: the channel direction
* @client_path: the owner client
* @change_mask: bitfield of changed fields since last call
* @port_path: the owner port
* @properties: the properties of the channel
* @state: the state
* @possible_formats: the possible formats
* @format: when streaming, the current format
*
* The channel information. Extra information can be added in later
* versions.
*/
typedef struct {
gpointer id;
const char *channel_path;
PinosDirection direction;
const char *client_path;
guint64 change_mask;
const char *port_path;
PinosProperties *properties;
PinosChannelState state;
GBytes *possible_formats;
GBytes *format;
} PinosChannelInfo;
/**
* PinosChannelInfoFlags:
* @PINOS_CHANNEL_INFO_FLAGS_NONE: no flags
* @PINOS_CHANNEL_INFO_FLAGS_NO_INPUT: don't list input channels
* @PINOS_CHANNEL_INFO_FLAGS_NO_OUTPUT: don't list output channels
*
* Extra flags to pass to pinos_context_list_channel_info() and
* pinos_context_get_channel_info_by_id().
*/
typedef enum {
PINOS_CHANNEL_INFO_FLAGS_NONE = 0,
PINOS_CHANNEL_INFO_FLAGS_NO_INPUT = (1 << 0),
PINOS_CHANNEL_INFO_FLAGS_NO_OUTPUT = (1 << 1),
} PinosChannelInfoFlags;
/**
* PinosChannelInfoCallback:
* @c: a #PinosContext
* @info: a #PinosChannelInfo
* @user_data: user data
*
* Callback with information about the Pinos channel in @info.
*/
typedef void (*PinosChannelInfoCallback) (PinosContext *c,
const PinosChannelInfo *info,
gpointer user_data);
void pinos_context_list_channel_info (PinosContext *context,
PinosChannelInfoFlags flags,
PinosChannelInfoCallback cb,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
void pinos_context_get_channel_info_by_id (PinosContext *context,
gpointer id,
PinosChannelInfoFlags flags,
PinosChannelInfoCallback cb,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
/**
* PinosConnectionInfo:
* @id: generic id of the connection
* @connection_path: the unique path of the connection
* PinosLinkInfo:
* @id: generic id of the link
* @link_path: the unique path of the link
* @change_mask: bitfield of changed fields since last call
* @source_port_path: the source port
* @destination_port_path: the destination port
*
* The connection information. Extra information can be added in later
* The link information. Extra information can be added in later
* versions.
*/
typedef struct {
gpointer id;
const char *connection_path;
const char *link_path;
guint64 change_mask;
const char *source_port_path;
const char *destination_port_path;
} PinosConnectionInfo;
} PinosLinkInfo;
/**
* PinosConnectionInfoFlags:
* @PINOS_CONNECTION_INFO_FLAGS_NONE: no flags
* PinosLinkInfoFlags:
* @PINOS_LINK_INFO_FLAGS_NONE: no flags
*
* Extra flags to pass to pinos_context_list_connection_info() and
* pinos_context_get_connection_info_by_id().
* Extra flags to pass to pinos_context_list_link_info() and
* pinos_context_get_link_info_by_id().
*/
typedef enum {
PINOS_CONNECTION_INFO_FLAGS_NONE = 0,
} PinosConnectionInfoFlags;
PINOS_LINK_INFO_FLAGS_NONE = 0,
} PinosLinkInfoFlags;
/**
* PinosConnectionInfoCallback:
* PinosLinkInfoCallback:
* @c: a #PinosContext
* @info: a #PinosConnectionInfo
* @info: a #PinosLinkInfo
* @user_data: user data
*
* Callback with information about the Pinos connection in @info.
* Callback with information about the Pinos link in @info.
*/
typedef void (*PinosConnectionInfoCallback) (PinosContext *c,
const PinosConnectionInfo *info,
gpointer user_data);
typedef void (*PinosLinkInfoCallback) (PinosContext *c,
const PinosLinkInfo *info,
gpointer user_data);
void pinos_context_list_connection_info (PinosContext *context,
PinosConnectionInfoFlags flags,
PinosConnectionInfoCallback cb,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
void pinos_context_get_connection_info_by_id (PinosContext *context,
gpointer id,
PinosConnectionInfoFlags flags,
PinosConnectionInfoCallback cb,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
void pinos_context_list_link_info (PinosContext *context,
PinosLinkInfoFlags flags,
PinosLinkInfoCallback cb,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
void pinos_context_get_link_info_by_id (PinosContext *context,
gpointer id,
PinosLinkInfoFlags flags,
PinosLinkInfoCallback cb,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
G_END_DECLS
#endif /* __PINOS_INTROSPECT_H__ */

View file

@ -40,9 +40,7 @@ struct _PinosContextPrivate
GList *clients;
GList *nodes;
GList *ports;
GList *connections;
GList *channels;
GList *links;
};
void pinos_subscribe_get_proxy (PinosSubscribe *subscribe,

View file

@ -240,14 +240,14 @@ subscription_cb (PinosSubscribe *subscribe,
PinosStreamPrivate *priv = stream->priv;
switch (flags) {
case PINOS_SUBSCRIPTION_FLAG_CHANNEL:
case PINOS_SUBSCRIPTION_FLAG_NODE:
if (event == PINOS_SUBSCRIPTION_EVENT_REMOVE) {
if (object == priv->node && !priv->disconnecting) {
stream_set_state (stream,
PINOS_STREAM_STATE_ERROR,
g_error_new_literal (G_IO_ERROR,
G_IO_ERROR_CLOSED,
"Channel disappeared"));
"Node disappeared"));
}
}
break;
@ -888,7 +888,7 @@ do_node_init (PinosStream *stream)
pu.direction = priv->direction;
pu.n_possible_formats = priv->possible_formats->len;
pu.possible_formats = (const SpaFormat **)priv->possible_formats->pdata;
pu.possible_formats = (SpaFormat **)priv->possible_formats->pdata;
pu.props = NULL;
pu.info = &priv->port_info;
priv->port_info.flags = SPA_PORT_INFO_FLAG_NONE |

View file

@ -108,11 +108,8 @@ notify_event (PinosSubscribe *subscribe,
else if (g_strcmp0 (interface_name, "org.pinos.Node1") == 0) {
flags = PINOS_SUBSCRIPTION_FLAG_NODE;
}
else if (g_strcmp0 (interface_name, "org.pinos.Port1") == 0) {
flags = PINOS_SUBSCRIPTION_FLAG_PORT;
}
else if (g_strcmp0 (interface_name, "org.pinos.Channel1") == 0) {
flags = PINOS_SUBSCRIPTION_FLAG_CHANNEL;
else if (g_strcmp0 (interface_name, "org.pinos.Link1") == 0) {
flags = PINOS_SUBSCRIPTION_FLAG_LINK;
}
g_signal_emit (subscribe, signals[SIGNAL_SUBSCRIPTION_EVENT], 0,
event, flags, data->proxy);

View file

@ -48,11 +48,10 @@ typedef enum {
PINOS_SUBSCRIPTION_FLAG_DAEMON = (1 << 0),
PINOS_SUBSCRIPTION_FLAG_CLIENT = (1 << 1),
PINOS_SUBSCRIPTION_FLAG_NODE = (1 << 2),
PINOS_SUBSCRIPTION_FLAG_PORT = (1 << 3),
PINOS_SUBSCRIPTION_FLAG_CHANNEL = (1 << 4)
PINOS_SUBSCRIPTION_FLAG_LINK = (1 << 3)
} PinosSubscriptionFlags;
#define PINOS_SUBSCRIPTION_FLAGS_ALL 0x1f
#define PINOS_SUBSCRIPTION_FLAGS_ALL 0x0f
typedef enum {
PINOS_SUBSCRIPTION_EVENT_NEW = 0,