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 } }
/** * \brief This function is callback function for receiving of command Node_Link. * * It means, that this function is called, when verse_callback_update * is executed and there is any Node_Link command in incoming queue. * * \param[in] session_id The ID of session with some verse server * \param[in] parent_node_id The ID of new parent node * \param[in] child_node_id The ID of child node */ static void cb_receive_node_link(const uint8_t session_id, const uint32_t parent_node_id, const uint32_t child_node_id) { printf("%s() session_id: %d, parent_node_id: %d, child_node_id: %d\n", __FUNCTION__, session_id, parent_node_id, child_node_id); if(parent_node_id == VRS_SCENE_PARENT_NODE_ID && child_node_id == my_test_node_id) { /* Test of creating new Tag Group in my own node */ vrs_send_taggroup_create(session_id, my_test_node_prio, child_node_id, MY_TEST_TAGGROUP_CT); /* Test of creating new Layer in my own node */ vrs_send_layer_create(session_id, my_test_node_prio, my_test_node_id, 0xFFFF, VRS_VALUE_TYPE_REAL64, 4, MY_TEST_LAYER_CT); } }
static void cb_receive_node_create(const uint8 session_id, const uint32 node_id, const uint32 parent_id, const uint16 user_id, const uint16 custom_type) { struct ParticleSenderNode *sender_node; struct Particle_Sender *sender; #if NO_DEBUG_PRINT != 1 printf("%s() session_id: %d, node_id: %d, parent_id: %d, user_id: %d, custom_type: %d\n", __FUNCTION__, session_id, node_id, parent_id, user_id, custom_type); #endif if(user_id != ctx->verse.user_id) { return; } if(parent_id == ctx->verse.avatar_id) { switch(custom_type) { case PARTICLE_SCENE_NODE: if(ctx->verse.particle_scene_node == NULL) { /* Create node of particle scene */ ctx->verse.particle_scene_node = create_particle_scene_node(node_id); /* Add node to lookup table*/ lu_add_item(ctx->verse.lu_table, node_id, ctx->verse.particle_scene_node); vrs_send_node_link(session_id, VRS_DEFAULT_PRIORITY, VRS_SCENE_PARENT_NODE_ID, node_id); vrs_send_node_subscribe(session_id, VRS_DEFAULT_PRIORITY, node_id, 0, 0); vrs_send_taggroup_create(session_id, VRS_DEFAULT_PRIORITY, node_id, PARTICLE_SCENE_TG); } break; case PARTICLE_SENDER_NODE: if(v_list_count_items(&ctx->verse.particle_scene_node->senders) < (int32)ctx->sender_count) { sender_node = create_particle_sender_node(ctx->verse.particle_scene_node, node_id); /* Find unassigned sender */ sender = ctx->senders.first; while(sender != NULL) { if(sender->sender_node == NULL) { break; } sender = sender->next; } /* Create reference */ if(sender != NULL) { sender->sender_node = sender_node; sender_node->sender = sender; } /* Is it sender node created by this client */ if(parent_id == ctx->verse.avatar_id) { ctx->sender = sender; } /* Add node to lookup table*/ lu_add_item(ctx->verse.lu_table, node_id, sender_node); v_list_add_tail(&ctx->verse.particle_scene_node->senders, sender_node); vrs_send_node_subscribe(session_id, VRS_DEFAULT_PRIORITY, node_id, 0, 0); vrs_send_node_link(session_id, VRS_DEFAULT_PRIORITY, ctx->verse.particle_scene_node->node_id, node_id); vrs_send_taggroup_create(session_id, VRS_DEFAULT_PRIORITY, node_id, PARTICLE_SENDER_TG); vrs_send_layer_create(session_id, VRS_DEFAULT_PRIORITY, node_id, 0xFFFF, VRS_VALUE_TYPE_REAL32, 3, PARTICLE_POS_LAYER); } break; } } }