Ejemplo n.º 1
0
static void cb_receive_taggroup_create(const uint8_t session_id,
		const uint32_t node_id,
		const uint16_t taggroup_id,
		const uint16_t custom_type)
{
	printf("%s() session_id: %d, node_id: %d, taggroup_id: %d, custom_type: %d\n",
				__FUNCTION__, session_id, node_id, taggroup_id, custom_type);

	if(node_id == my_test_node_id && custom_type == MY_TEST_TAGGROUP_CT) {
		/* Set up name of my tag group */
		my_test_taggroup_id = taggroup_id;

		/* Test that it's not possible to create tag group with the same name in
		 * on node. */
		vrs_send_taggroup_create(session_id, my_test_node_prio, node_id, custom_type);

		/* Test of subscribing to tag group */
		vrs_send_taggroup_subscribe(session_id, my_test_node_prio, node_id, taggroup_id, 0, 0);

		/* Test of uint8 tag create */
		vrs_send_tag_create(session_id, my_test_node_prio, node_id,
				taggroup_id, VRS_VALUE_TYPE_UINT8, 3, MY_TEST_TAG_CT);
#if 0
		/* Test of string tag create */
		vrs_send_tag_create(session_id, my_test_node_prio, node_id,
				taggroup_id, VRS_VALUE_TYPE_STRING8, 1, MY_TEST_TAG_TYPE);
#endif
	}
}
static void cb_receive_taggroup_create(const uint8 session_id,
		const uint32 node_id,
		const uint16 taggroup_id,
		const uint16 custom_type)
{
	struct Node *node;
	struct ParticleSceneNode *scene_node;
	struct ParticleSenderNode *sender_node;

#if NO_DEBUG_PRINT != 1
	printf("%s() session_id: %d, node_id: %d, taggroup_id: %d, custom_type: %d\n",
				__FUNCTION__, session_id, node_id, taggroup_id, custom_type);
#endif

	node = lu_find(ctx->verse.lu_table, node_id);

	if(node != NULL) {
		switch(node->type) {
		case PARTICLE_SCENE_NODE:
			scene_node = (struct ParticleSceneNode *)node;

			if(custom_type == PARTICLE_SCENE_TG) {
				scene_node->particle_taggroup_id = taggroup_id;

				vrs_send_taggroup_subscribe(session_id, VRS_DEFAULT_PRIORITY, node_id, taggroup_id, 0, 0);

				vrs_send_tag_create(session_id, VRS_DEFAULT_PRIORITY,
						node_id, taggroup_id, VRS_VALUE_TYPE_UINT16, 1, SENDER_COUNT_TAG);
			}
			break;
		case PARTICLE_SENDER_NODE:
			sender_node = (struct ParticleSenderNode*)node;

			if(custom_type == PARTICLE_SENDER_TG) {
				sender_node->particle_taggroup_id = taggroup_id;

				vrs_send_taggroup_subscribe(session_id, VRS_DEFAULT_PRIORITY, node_id, taggroup_id, 0, 0);

				vrs_send_tag_create(session_id, VRS_DEFAULT_PRIORITY,
						node_id, taggroup_id, VRS_VALUE_TYPE_UINT16, 1, PARTICLE_FRAME_TAG);
				vrs_send_tag_create(session_id, VRS_DEFAULT_PRIORITY,
						node_id, taggroup_id, VRS_VALUE_TYPE_UINT16, 1, PARTICLE_COUNT_TAG);
				vrs_send_tag_create(session_id, VRS_DEFAULT_PRIORITY,
						node_id, taggroup_id, VRS_VALUE_TYPE_UINT16, 1, SENDER_ID_TAG);
				vrs_send_tag_create(session_id, VRS_DEFAULT_PRIORITY,
						node_id, taggroup_id, VRS_VALUE_TYPE_REAL32, 3, POSITION_TAG);
			}
			break;
		}
	}
}