/****************************************************************************
Name          : plms_mds_callback

Description   : This callback routine will be called by MDS on event arrival

Arguments     : info - pointer to the mds callback info

Return Values : NCSCC_RC_SUCCESS/NCSCC_RC_FAILURE

Notes         : None.
*****************************************************************************/
SaUint32T plms_mds_callback(struct ncsmds_callback_info *info)
{
	uns32 rc = NCSCC_RC_SUCCESS;
	PLMS_CB *cb = plms_cb;

	assert(info != NULL);

	switch (info->i_op) {
		case MDS_CALLBACK_COPY:
			rc = plms_mds_cpy(info);
			break;
		case MDS_CALLBACK_ENC:
			rc = plms_mds_enc(&info->info.enc, &cb->edu_hdl);
			break;
		case MDS_CALLBACK_DEC:
			rc = plms_mds_dec(&info->info.dec,&cb->edu_hdl);
			break;
		case MDS_CALLBACK_ENC_FLAT:
			if (1) {        /*Set to zero for righorous testing of byteorderr
				   enc/dec. */
				rc = plms_mds_enc_flat( info,&cb->edu_hdl);
			} else {
				rc = plms_mds_enc( &info->info.enc_flat,&cb->edu_hdl);
			}
			break;
		case MDS_CALLBACK_DEC_FLAT:
			if (1) {        /*Set to zero for righorous testing of byteorderr
				    enc/dec. */
				rc = plms_mds_dec_flat( info,&cb->edu_hdl);
			} else {
				rc = plms_mds_dec( &info->info.dec_flat,&cb->edu_hdl);
			}
			break;
		case MDS_CALLBACK_RECEIVE:
			rc = plms_mds_rcv(&(info->info.receive));
			break;
		case MDS_CALLBACK_SVC_EVENT:
			rc = plms_mds_svc_evt(&(info->info.svc_evt));
			break;
		case MDS_CALLBACK_QUIESCED_ACK:
			rc = plms_proc_quiesced_ack_evt();
			break;
		case MDS_CALLBACK_DIRECT_RECEIVE:
			rc = NCSCC_RC_FAILURE;
			TRACE_1("MDS_CALLBACK_DIRECT_RECEIVE - do nothing");
			break;
		default:
			LOG_ER("Illegal type of MDS message");
			rc = NCSCC_RC_FAILURE;
			break;
	}
	return rc;
}
/*!
 * \param *dc The DecodingContext containing macroblock array we want to freed.
 *
 * This function free **mb_array, which is an array of pointers to macroblock elements.
 * mb_array is in a DecodingContext structure. There can only be one mb_array at a time.
 * Please note that in order to avoid memory leak, this function begin by calling freeMbArrayContent().
 */
void freeMbArray(DecodingContext_t *dc)
{
    if (dc->mb_array != NULL)
    {
        freeMbArrayContent(dc);

        free(dc->mb_array);
        dc->mb_array = NULL;

        TRACE_1(MB, ">> mb_array freed\n");
    }
}
Exemple #3
0
/****************************************************************************
 * Name          : gld_mds_glnd_down
 *
 * Description   : MDS indicated that a glnd has gone down
 *
 * Arguments     : evt  - Event structure
 *
 * Return Values : NCSCC_RC_SUCCESS/ NCSCC_RC_FAILURE
 *
 * Notes         : None.
 *****************************************************************************/
static uint32_t gld_mds_glnd_down(GLSV_GLD_EVT *evt)
{
	GLSV_GLD_CB *gld_cb = evt->gld_cb;
	GLSV_GLD_GLND_DETAILS *node_details = NULL;
	GLSV_GLD_RSC_INFO *rsc_info;
	uint32_t node_id;
	uint32_t rc = NCSCC_RC_FAILURE;
	TRACE_ENTER2("mds identification %u",gld_cb->my_dest_id );

	node_id = m_NCS_NODE_ID_FROM_MDS_DEST(evt->info.glnd_mds_info.mds_dest_id);

	if ((evt == GLSV_GLD_EVT_NULL) || (gld_cb == NULL))
		goto end;

	memcpy(&evt->fr_dest_id, &evt->info.glnd_mds_info.mds_dest_id, sizeof(MDS_DEST)
	    );

	if ((node_details = (GLSV_GLD_GLND_DETAILS *)ncs_patricia_tree_get(&gld_cb->glnd_details,
									   (uint8_t *)&node_id)) == NULL) {
		TRACE_1("Resource details is empty for glnd on node_id %u ", node_id);
		rc = NCSCC_RC_SUCCESS;
		goto end;
	}
	node_details->status = GLND_RESTART_STATE;

	TRACE("EVT Processing MDS GLND DOWN: node_id %u", node_details->node_id);
	memcpy(&node_details->restart_timer.mdest_id, &node_details->dest_id, sizeof(MDS_DEST));

	/* Start GLSV_GLD_GLND_RESTART_TIMEOUT timer */
	gld_start_tmr(gld_cb, &node_details->restart_timer, GLD_TMR_NODE_RESTART_TIMEOUT, GLD_NODE_RESTART_TIMEOUT, 0);

	/* Check whether this node is master for any resource, if yes send the status to all
	   the
	   non master nodes */
	if (gld_cb->ha_state == SA_AMF_HA_ACTIVE) {
		/* Check whether this node is master for any resource, if yes send the status to all the non master nodes */
		rsc_info = gld_cb->rsc_info;
		while (rsc_info != NULL) {
			if (rsc_info->node_list) {
				if (rsc_info->node_list->node_id == node_details->node_id)
					gld_snd_master_status(gld_cb, rsc_info, GLND_RESOURCE_MASTER_RESTARTED);
			}
			rsc_info = rsc_info->next;
		}

		/* If this node is non master for any resource, then send node status to the master */
		gld_process_send_non_master_status(gld_cb, node_details, GLND_RESTART_STATE);

	}
 end:
	TRACE_LEAVE2("Return value: %u", rc);
	return rc;
}
Exemple #4
0
void launchServer( void )
{
    TRACE_2( SERVER , "lanchServer()");

    TRACE_1( SERVER , "Start server on port %d..." , portCli );

    pthread_create( &serverCliThread , NULL , ( void * )&createServer , &portCli );

    /* We have to increment the thread count by 2, because we don't use createThread() function. */
    incrementThreadCount( 2 );

}
Exemple #5
0
uint8_t *read_ebml_data_binary(Bitstream_t *bitstr, EbmlElement_t *element,
                               FILE *xml, const char *name)
{
    TRACE_2(MKV, "read_ebml_data_binary2(%i bytes)", element->size);

    uint8_t *value = new uint8_t [element->size+1];
    if (value)
    {
        for (int i = 0; i < element->size; i++)
            value[i] = read_bits(bitstr, 8);
        value[element->size] = '\0';

        if (name)
        {
#if ENABLE_DEBUG
            TRACE_1(MKV, "* %s  = 0x", name);

            if (element->size > 1023)
                TRACE_1(MKV, "* %s  = (first 1024B) 0x", name);
            else
                TRACE_1(MKV, "* %s  = 0x", name);
            for (int i = 0; i < element->size && i < 1024; i++)
                printf("%02X", value[i]);
#endif // ENABLE_DEBUG

            if (xml)
            {
                if (element->size > 1023)
                    fprintf(xml, "  <%s>(first 1024B) 0x", name);
                else
                    fprintf(xml, "  <%s>0x", name);
                for (int i = 0; i < element->size && i < 1024; i++)
                    fprintf(xml, "%02X", value[i]);
                fprintf(xml, "</%s>\n", name);
            }
        }
    }

    return value;
}
Exemple #6
0
static int mp3_indexer_track(MediaFile_t *media, mp3_t *mp3)
{
    TRACE_1(MP3, BLD_GREEN "mp3_indexer_track()" CLR_RESET);
    int retcode = FAILURE;

    // Write track metadata (samples have been written already)
    if (media && media->tracks_audio[0])
    {
        MediaStream_t *track = media->tracks_audio[0];
        track->stream_type = stream_AUDIO;

        if (mp3->mpeg_layer == 1)
            track->stream_codec = CODEC_MPEG_L1;
        else if (mp3->mpeg_layer == 2)
            track->stream_codec = CODEC_MPEG_L2;
        else
            track->stream_codec = CODEC_MPEG_L3;

        if (mp3->audio_channels == 0)
        {
            track->channel_count = 2;
            //track->channel_mode = CHAN_STEREO;
        }
        else if (mp3->audio_channels == 1)
        {
            track->channel_count = 2;
            //track->channel_mode = CHAN_STEREO_JOINT;
        }
        else if (mp3->audio_channels == 2)
        {
            track->channel_count = 2;
            //track->channel_mode = CHAN_DUAL;
        }
        else if (mp3->audio_channels == 3)
        {
            track->channel_count = 1;
            //track->channel_mode = CHAN_MONO;
        }

        track->sampling_rate = mp3->audio_samplingrate;
        track->bit_per_sample = 16;

        // SAMPLES
        track->stream_packetized = false;
        track->frame_count = mp3->sample_count;
        track->stream_size = mp3->sample_size_total;

        retcode = SUCCESS;
    }

    return retcode;
}
// -----------------------------------------------------------------------------
// CXIMPSrvSessionAdapter::~CXIMPSrvSessionAdapter()
// -----------------------------------------------------------------------------
//
EXPORT_C CXIMPSrvSessionAdapter::~CXIMPSrvSessionAdapter()
    {
    delete iMessage;
    
    iServer.SessionDied();
    delete iSessionImp;

    TRACE_1( _L("CXIMPSrvSessionAdapter[%d]::~CXIMPSrvSessionAdapter()"),
                 this );
    #if _BullseyeCoverage
    cov_write();
    #endif
    }
Exemple #8
0
/****************************************************************************
 * Name          : mqd_tmr_stop
 *
 * Description   : This function which is used to stop the MQD Timer
 *
 * Arguments     : tmr      - Timer needs to be stoped.
 *
 * Return Values : None.
 *
 * Notes         : None.
 *****************************************************************************/
void mqd_tmr_stop(MQD_TMR *tmr)
{
	TRACE_1("The timer stopped");
	if (tmr->is_active == true) {
		m_NCS_TMR_STOP(tmr->tmr_id);
		tmr->is_active = false;
	}
	if (tmr->tmr_id != TMR_T_NULL) {
		m_NCS_TMR_DESTROY(tmr->tmr_id);
		tmr->tmr_id = TMR_T_NULL;
	}
	return;
}
Exemple #9
0
/****************************************************************************\
 PROCEDURE NAME : mqd_quisced_process

 DESCRIPTION    : This routine process the Quisced ack event.

 ARGUMENTS      : pMqd - MQD Control block pointer
                  quisced_info - MQD_QUISCED_STATE_INFO structure pointer

 RETURNS        : NCSCC_RC_SUCCESS/NCSCC_RC_FAILURE
\*****************************************************************************/
static uint32_t mqd_quisced_process(MQD_CB *pMqd, MQD_QUISCED_STATE_INFO *quisced_info)
{
	SaAisErrorT saErr = SA_AIS_OK;
	uint32_t rc = NCSCC_RC_SUCCESS;
	TRACE_ENTER();

	if (pMqd && pMqd->is_quisced_set) {
		pMqd->ha_state = SA_AMF_HA_QUIESCED;
		rc = mqd_mbcsv_chgrole(pMqd);
		if (rc != NCSCC_RC_SUCCESS) {
			TRACE_4("Quiesced Processing at MQD ,MBCSV Changerole failed");
			return rc;
		}
		saAmfResponse(pMqd->amf_hdl, quisced_info->invocation, saErr);
		pMqd->is_quisced_set = false;
		TRACE_1("Quisced Processing at MQD is successfull");
	} else
		TRACE_1("Received Unsolicited Quisced Ack at MQD");

	TRACE_LEAVE();
	return rc;
}
Exemple #10
0
/****************************************************************************
 * Name          : mqd_tmr_start
 *
 * Description   : This function which is used to start the MQD Timer
 *
 *****************************************************************************/
uint32_t mqd_tmr_start(MQD_TMR *tmr, SaTimeT duration)
{
	TRACE_1("The timer started with the duration as %u", (uint32_t)duration);
	if (tmr->tmr_id == TMR_T_NULL) {
		m_NCS_TMR_CREATE(tmr->tmr_id, duration, mqd_timer_expiry, (void *)tmr);
	}

	if (tmr->is_active == false) {
		m_NCS_TMR_START(tmr->tmr_id, (uint32_t)duration, mqd_timer_expiry, (void *)tmr);
		tmr->is_active = true;
	}

	return (NCSCC_RC_SUCCESS);
}
// ---------------------------------------------------------------------------
// COperationSubscribePresentityPresence::RequestCompletedL()
// ---------------------------------------------------------------------------
//
void COperationSubscribePresentityPresence::RequestCompletedL()
    {
    TRACE(_L("COperationSubscribePresentityPresence::RequestCompletedL()" ) );
    CXIMPOperationBase::RequestCompletedL();

    if( iStatusObj->ResultCode() == KErrNone )
        {
        if( iSubscriptionStatus == CPresentityPresenceSubscriptionItem::ENotSubscribedAtAll )
            {
            TRACE(_L("COperationSubscribePresentityPresence::RequestCompletedL() ENotSubscribedAtAll" ) );
            MXIMPBase* object = NULL; 
            iObjCollection->GetByType( object, MXIMPIdentity::KInterfaceId );
            if( object )
                {
                TRACE(_L("COperationSubscribePresentityPresence::RequestCompletedL() identity change" ) );
                delete iIdentity;
                iIdentity = TXIMPGetImpClassOrPanic< CXIMPIdentityImp >::From( *object );

                // Got altered identity. If it differs from original
                // we'll create a new subscription item and close the old.
                CPresentityPresenceSubscriptionItem& altSubItem = 
                    iMyHost->PresenceDataAccess().PresenceDataCache().PresentityPresenceSubscriptionItemLC( *iIdentity );

                iSubItem->Close();
                iSubItem = &altSubItem;

                CleanupStack::Pop(); // altSubItem                    
                }            
            }
            
        if( iSubscriptionStatus == CPresentityPresenceSubscriptionItem::ENotSubscribedAtAll ||
            iSubscriptionStatus == CPresentityPresenceSubscriptionItem::ESubscribedForOtherCtxOnly )
            {
            TRACE(_L("COperationSubscribePresentityPresence::RequestCompletedL() calling iSubItem->AddSubscriberL" ) );
            TInt error ( KErrNone );
            TRAP( error, iSubItem->AddSubscriberL( iContext ) );
            TRACE_1( _L("COperationSubscribePresentityPresence::RequestCompletedL():  iSubItem->AddSubscriberL : error =%d"), error );
            }
            
        iContext->SetPresenceInfoFilterL( MXIMPPscContext::EPresentityPresenceFilter,
                iPif, iIdentity );
        iPif = NULL;
        iSubItem->SetSubscriptionPif( iMergedPif );
        iMergedPif = NULL;

        SynthesiseEventL();
        }
    }
SaAisErrorT ntfsv_filter_attr_change_alloc(SaNtfAttributeChangeNotificationFilterT *filter,
														SaUint16T numSourceIndicators)
{
	SaAisErrorT rc = SA_AIS_OK;

	filter->sourceIndicators = NULL;
	filter->numSourceIndicators = numSourceIndicators;
	if (numSourceIndicators != 0) {
	filter->sourceIndicators = (SaNtfSourceIndicatorT *) malloc(numSourceIndicators * sizeof(SaNtfSourceIndicatorT));
	if (filter->sourceIndicators == NULL) {
		TRACE_1("Out of memory in SourceIndicators field");
		rc = SA_AIS_ERR_NO_MEMORY;
		}
	}
	return rc;
}
SaAisErrorT ntfsv_filter_obj_cr_del_alloc(SaNtfObjectCreateDeleteNotificationFilterT *filter,
														SaUint16T numSourceIndicators)
{
	SaAisErrorT rc = SA_AIS_OK;

	filter->sourceIndicators = NULL;
	filter->numSourceIndicators = numSourceIndicators;
	if (numSourceIndicators != 0) {
	filter->sourceIndicators = (SaNtfSourceIndicatorT *) malloc(numSourceIndicators * sizeof(SaNtfSourceIndicatorT));
	if (filter->sourceIndicators == NULL) {
		TRACE_1("Out of memory in SourceIndicators field");
		rc = SA_AIS_ERR_NO_MEMORY;
		}
	}
	return rc;
}
Exemple #14
0
int64_t read_ebml_data_int(Bitstream_t *bitstr, EbmlElement_t *element,
                           FILE *xml, const char *name)
{
    TRACE_2(MKV, "read_ebml_data_int2(%i bits)", element->size*8);
    int64_t value = (int64_t)read_bits_64(bitstr, element->size*8);

    if (name)
    {
        TRACE_1(MKV, "* %s  = %lli", name, value);
        if (xml)
        {
            fprintf(xml, "  <%s>%" PRId64 "</%s>\n", name, value, name);
        }
    }

    return value;
}
Exemple #15
0
uint64_t read_ebml_data_uint_UID(Bitstream_t *bitstr, EbmlElement_t *element,
                                 FILE *xml, const char *name)
{
    TRACE_2(MKV, "read_ebml_data_uint_UID(%i bits)", element->size*8);
    uint64_t value = read_bits_64(bitstr, element->size * 8);

    if (name)
    {
        TRACE_1(MKV, "* %08X  = %llu", name, value);
        if (xml)
        {
            fprintf(xml, "  <%s>0x%" PRIX64 "</%s>\n", name, value, name);
        }
    }

    return value;
}
Exemple #16
0
/****************************************************************************
 * Name          : glnd_process_mbx
 *
 * Description   : This is the function which process the IPC mail box of 
 *                 GLND.
 *
 * Arguments     : mbx  - This is the mail box pointer on which IfD/IfND is 
 *                        going to block.  
 *
 * Return Values : None.
 *
 * Notes         : None.
 *****************************************************************************/
void glnd_process_mbx(GLND_CB *cb, SYSF_MBX *mbx)
{
	GLSV_GLND_EVT *evt = NULL;
	TRACE_ENTER();

	while ((evt = (GLSV_GLND_EVT *)m_NCS_IPC_NON_BLK_RECEIVE(mbx, evt))) {
		if ((evt->type >= GLSV_GLND_EVT_BASE) && (evt->type < GLSV_GLND_EVT_MAX)) {
			/* process mail box */
			glnd_process_evt((NCSCONTEXT)cb, evt);
		} else {
			TRACE_1("Unknown glnd evt rcvd: event_type %d", evt->type);
			m_MMGR_FREE_GLND_EVT(evt);
		}
	}
	TRACE_LEAVE();
	return;
}
Exemple #17
0
int loadMusic( sp_session *session, char *uri , char *name , playqueue_fifo_t *playqueue )
{
    TRACE_2( PLAYERMANAGER , "loadMusic().");

    int status = PC_SUCCESS;
    char response[255] = { 0 };

    /* If it's the first time we load a track, we have to init the audio driver and the playqueue */
//    if( firstTime++ == 0 )
//        initPlayerEnv();

    LOCK_MUTEX( PLAYERMANAGER , &mutexSession );

    sp_track *track = NULL;

    currentTrack = track;

    if( createTrackFromUri( uri , name ) == PC_ERROR )
        status = PC_ERROR;

    if( currentTrack != NULL)
    {
        TRACE_1( PLAYERMANAGER , "Adding track to the playlist.");

        addTracksToPlayqueue( playqueue , currentTrack );

        snprintf( response , 255 , "OK");

        sendVoid( ( void * )response , strlen( response ) );
    }
    else
    {
        TRACE_ERROR( PLAYERMANAGER , "Cannot add track to the playlist because track is NULL.");

        status = PC_ERROR;

        snprintf( response , 255 , "NOK: Cannot add the track to the playlist because the URI might be invalid.");

        sendVoid( ( void * )response , strlen( response ) );
    }

    UNLOCK_MUTEX( PLAYERMANAGER , &mutexSession );

    return status;
}
/****************************************************************************
 * Name          : glsv_gld_standby_rsc_set_orphan
 *
 * Description   : Instruction from the GLND to set the orphan flag
 *
 * Arguments     : async_evt  - Event structure
 *
 * Return Values : NCSCC_RC_SUCCESS/ NCSCC_RC_FAILURE
 *
 * Notes         : None.
 *****************************************************************************/
static uint32_t glsv_gld_standby_rsc_set_orphan(GLSV_GLD_A2S_CKPT_EVT *async_evt)
{
	GLSV_GLD_CB *gld_cb;
	GLSV_GLD_GLND_DETAILS *node_details;
	uint32_t node_id;
	uint32_t rc = NCSCC_RC_FAILURE;
	TRACE_ENTER();

	if (async_evt == NULL)
		goto end;

	node_id = m_NCS_NODE_ID_FROM_MDS_DEST(async_evt->info.rsc_details.mdest_id);

	if ((gld_cb = (NCSCONTEXT)ncshm_take_hdl(NCS_SERVICE_ID_GLD, gl_gld_hdl))
	    == NULL) {
		LOG_ER("Handle take failed");
		goto end;
	}

	/* Find if the node details are available */
	if ((node_details =
	     (GLSV_GLD_GLND_DETAILS *)ncs_patricia_tree_get(&gld_cb->glnd_details, (uint8_t *)&node_id)) == NULL) {
		LOG_ER("Patricia tree get failed: node_id %u", node_id);
		goto error;
	}
	if (gld_rsc_ref_set_orphan(node_details, async_evt->info.rsc_details.rsc_id,
				   async_evt->info.rsc_details.orphan,
				   async_evt->info.rsc_details.lck_mode) == NCSCC_RC_SUCCESS) {
		TRACE_1("GLD a2s evt set orphan success: rsc_id %u node_id %u",
			      async_evt->info.rsc_details.rsc_id, node_id);
		ncshm_give_hdl(gld_cb->my_hdl);
		rc = NCSCC_RC_SUCCESS;
		goto end;
	} else
		goto error;

 error:
	LOG_ER("GLD a2s evt set orphan failed: rsc_id %u node_id %u",
		      async_evt->info.rsc_details.rsc_id, node_id);
	ncshm_give_hdl(gld_cb->my_hdl);
 end:
	TRACE_LEAVE();
	return rc;

}
Exemple #19
0
static int searchCliCmd( const char *cmd )
{
    TRACE_2( CLI , "searchCliCmd( %s )." , cmd );

    int i = 0;

    for( i = 0 ; i < CLI_COUNT_COMMAND ; i++ )
    {
        if( strstr( cmd , cliCmd[i].command ) != NULL )
        {
            TRACE_1( CLI , "Command found, id: %d" , i );

            return i;
        }
    }

    return -EINVAL;
}
Exemple #20
0
void end_of_track( sp_session *session )
{
    TRACE_2( PLAYERMANAGER , "end_of_track().");

    TRACE_3( PLAYERMANAGER , "End of track...");

//    LOCK_MUTEX( PLAYERMANAGER , &mutexSession );

    TRACE_3( PLAYERMANAGER , "Removing the track which have been played.");

    sp_track_release( currentTrack );

//    UNLOCK_MUTEX( PLAYERMANAGER , &mutexSession );

//    if( hasNextTrack() == TRUE )
//    {
//        TRACE_1( PLAYERMANAGER , "Load next music !");

//        playMusic( session , "" , currentStreamName );
//    }
    if( nextTrackInStream( currentStreamName ) == PC_SUCCESS )
    {
        TRACE_1( PLAYERMANAGER , "Load next music !");

    }
    else
    {
        TRACE_WARNING( PLAYERMANAGER , "No more music in the mainplaylist");

        audio_fifo_flush( &g_audiofifo );

        LOCK_MUTEX( PLAYERMANAGER , &mutexSession );

        sp_session_player_play( session , 0 );
        sp_session_player_unload( session );

        UNLOCK_MUTEX( PLAYERMANAGER , &mutexSession );

        playing = FALSE;
    }



}
/****************************************************************************
  Name          : avnd_send_pid_exit_evt

  Description   : This routine creates a PID exit event and send to AVND 
		  thread for further processing.

  Arguments     : cb - ptr to AVND control block
		  pm_rec - ptr to AVND_COMP_PM_REC struct

  Return Values : NCSCC_RC_SUCCESS/NCSCC_RC_FAILURE

  Notes         : None
******************************************************************************/
uns32 avnd_send_pid_exit_evt(AVND_CB *cb, AVND_COMP_PM_REC *pm_rec)
{
	AVND_EVT *evt;
	uns32 rc = NCSCC_RC_FAILURE;

	/* create & send the timer event */
	evt = avnd_evt_create(cb, AVND_EVT_PID_EXIT, 0, 0, (void *)pm_rec, 0, 0);
	if (evt) {
		rc = avnd_evt_send(cb, evt);
	}

	if (rc == NCSCC_RC_SUCCESS) {
		TRACE_1("Sent PM (PID: %lld) Exit event", pm_rec->pid);
	} else {
		LOG_ER("Failed to send PM (PID: %lld) exit event", pm_rec->pid);
	}

	return rc;
}
Exemple #22
0
void cpd_a2s_ckpt_unlink_set(CPD_CB *cb, CPD_CKPT_INFO_NODE *ckpt_node)
{
	CPD_MBCSV_MSG cpd_msg;
	uint32_t rc = SA_AIS_OK;

	TRACE_ENTER();
	memset(&cpd_msg, '\0', sizeof(CPD_MBCSV_MSG));
	cpd_msg.type = CPD_A2S_MSG_CKPT_UNLINK;
	cpd_msg.info.ckpt_ulink.is_unlink_set = ckpt_node->is_unlink_set;
	cpd_msg.info.ckpt_ulink.ckpt_name = ckpt_node->ckpt_name;

	/* send it to MBCSv  */
	rc = cpd_mbcsv_async_update(cb, &cpd_msg);
	if (rc != SA_AIS_OK)
		TRACE_4("cpd A2S ckpt unlink async failed %s",ckpt_node->ckpt_name.value);
	else
		TRACE_1("cpd A2S ckpt unlink async successfull ");
	TRACE_LEAVE();
}
Exemple #23
0
/*************************************************************************************
 * Name                  : cpd_a2s_ckpt_arep_set
 *
 * Description           : Function to set the active replica and send it to standby
 *
 * Arguments             : CPD_CKPT_INFO_NODE   -  CPD Checkpoint info node
 *
 * Return Values         : None , Error message is logged
 *
 * Notes                 : None
 ************************************************************************************/
void cpd_a2s_ckpt_arep_set(CPD_CB *cb, CPD_CKPT_INFO_NODE *ckpt_node)
{
	CPD_MBCSV_MSG cpd_msg;
	uint32_t rc = SA_AIS_OK;

	TRACE_ENTER();
	memset(&cpd_msg, '\0', sizeof(CPD_MBCSV_MSG));
	cpd_msg.type = CPD_A2S_MSG_CKPT_AREP_SET;
	cpd_msg.info.arep_set.ckpt_id = ckpt_node->ckpt_id;
	cpd_msg.info.arep_set.mds_dest = ckpt_node->active_dest;

	/* send it to MBCSv */
	rc = cpd_mbcsv_async_update(cb, &cpd_msg);
	if (rc != SA_AIS_OK)
		TRACE_4("cpd A2S ckpt arep set async failed for ckpt_id :%llx active_dest :%"PRIu64,ckpt_node->ckpt_id,ckpt_node->active_dest);
	else
		TRACE_1("cpd A2S ckpt arep set async success for ckpt_id :%llx active_dest :%"PRIu64,ckpt_node->ckpt_id,ckpt_node->active_dest);
	TRACE_LEAVE();
}
Exemple #24
0
/*******************************************************************************************
 * Name                   : cpd_a2s_ckpt_dest_down
 * 
 * Description            : Function to delete the destination of the already existing 
 *                          checkpoint
 *
 * Arguments              : CPD_CKPT_INFO_NODE - CPD Checkpoint info node
 *
 * Return Values          : None , Error message is logged
 *
********************************************************************************************/
void cpd_a2s_ckpt_dest_down(CPD_CB *cb, CPD_CKPT_INFO_NODE *ckpt_node, MDS_DEST *dest)
{
	CPD_MBCSV_MSG cpd_msg;
	uint32_t rc = SA_AIS_OK;

	TRACE_ENTER();
	memset(&cpd_msg, '\0', sizeof(CPD_MBCSV_MSG));
	cpd_msg.type = CPD_A2S_MSG_CKPT_DEST_DOWN;
	cpd_msg.info.dest_down.ckpt_id = ckpt_node->ckpt_id;
	cpd_msg.info.dest_down.mds_dest = *dest;

	TRACE("CPND 1 IS IN RESTART NOW ");

	rc = cpd_mbcsv_async_update(cb, &cpd_msg);
	if (rc != SA_AIS_OK)
		TRACE_4("cpd A2S ckpt async update failed for ckptid:%llx,dest: %"PRIu64,cpd_msg.info.dest_down.ckpt_id, *dest);
	else
		TRACE_1("cpd A2S ckpt async update del success for ckptid:%llx,dest:%"PRIu64,cpd_msg.info.dest_down.ckpt_id, *dest);
	TRACE_LEAVE();
}
std::vector <int> DynamixelSimpleAPI::servoScan(int start, int stop)
{
    // Check start/stop boundaries
    if (start < 0 || start > (maxId - 1))
        start = 0;

    if (stop < 1 || stop > maxId || stop < start)
        stop = maxId;

    TRACE_INFO(DAPI, "> Scanning for Dynamixel devices on '%s'... Range is [%i,%i]\n",
               serialGetCurrentDevice().c_str(), start, stop);

    // A vector of Dynamixel IDs found during the scan
    std::vector <int> ids;

    for (int id = start; id <= stop; id++)
    {
        PingResponse pingstats;

        // If the ping gets a response, then we have found a servo
        if (dxl_ping(id, &pingstats) == true)
        {
            setLed(id, 1, LED_GREEN);

            ids.push_back(id);

            TRACE_INFO(DAPI, "[#%i] Dynamixel servo found!\n", id);
            TRACE_INFO(DAPI, "[#%i] model: '%i' (%s)\n", id, pingstats.model_number,
                       dxl_get_model_name(pingstats.model_number).c_str());

            // Other informations, not printed by default:
            TRACE_1(DAPI, "[#%i] firmware: '%i' \n", id, pingstats.firmware_version);
            TRACE_1(DAPI, "[#%i] position: '%i' \n", id, readCurrentPosition(id));
            TRACE_1(DAPI, "[#%i] speed: '%i' \n", id, readCurrentSpeed(id));
            TRACE_1(DAPI, "[#%i] torque: '%i' \n", id, getTorqueEnabled(id));
            TRACE_1(DAPI, "[#%i] load: '%i' \n", id, readCurrentLoad(id));
            TRACE_1(DAPI, "[#%i] baudrate: '%i' \n", id, getSetting(id, REG_BAUD_RATE));

            setLed(id, 0);
        }
        else
        {
            printf(".");
        }
    }

    printf("\n");
    return ids;
}
Exemple #26
0
int disconnectClient( int *socket )
{
    TRACE_2( SERVERMANAGER , "disconnectClient()");

    int status = PC_SUCCESS;


    if( close( *socket ) < 0 )
    {
        TRACE_ERROR( SERVERMANAGER , "Cannot close client socket.");

        status = PC_ERROR;
    }
    else
    {
        TRACE_1( SERVERMANAGER , "Client disconnect.");
    }

    return status;
}
Exemple #27
0
int disconnectClient( int *socket )
{
    TRACE_2( SERVER , "disconnectClient()");

    int status = 0;


    if( close( *socket ) < 0 )
    {
        TRACE_ERROR( SERVER , "Cannot close client socket.");

        status = -ENOTSOCK;
    }
    else
    {
        TRACE_1( SERVER , "Client disconnect.");
    }

    return status;
}
SaAisErrorT ntfsv_v_data_cp(v_data * dest, const v_data * src)
{
	TRACE_ENTER2("src alloc v_data max_size %u, size %zd, p_base %p", src->max_data_size, src->size, src->p_base);
	dest->max_data_size = src->max_data_size;
	dest->size = src->size;
	if (src->size) {
		dest->p_base = calloc(1, src->size);
		TRACE_1("alloc v_data.p_base %p", dest->p_base);
		if (dest->p_base == NULL) {
			TRACE_LEAVE();
			return SA_AIS_ERR_NO_MEMORY;
		}
		memcpy(dest->p_base, src->p_base, src->size);
	} else {
		dest->p_base = NULL;
	} 
	TRACE_LEAVE2("dest alloc v_data max_size %u, size %zd, p_base %p",
		     dest->max_data_size, dest->size, dest->p_base);
	return SA_AIS_OK;
}
Exemple #29
0
/***********************************************************************************
 * Name                 : cpd_a2s_ckpt_rdset
 *
 * Description          : Function to set the retention duration of the checkpoint
 *                        and to send it to standby
 *
 * Arguments            : CPD_CKPT_INFO_NODE   - CPD Checkpoint info node
 *
 * Return Values        : None, Error message is logged
 *
 * Notes                : None
 ************************************************************************************/
void cpd_a2s_ckpt_rdset(CPD_CB *cb, CPD_CKPT_INFO_NODE *ckpt_node)
{
	CPD_MBCSV_MSG cpd_msg;
	uint32_t rc = SA_AIS_OK;
	
	TRACE_ENTER();

	memset(&cpd_msg, '\0', sizeof(CPD_MBCSV_MSG));
	cpd_msg.type = CPD_A2S_MSG_CKPT_RDSET;
	cpd_msg.info.rd_set.ckpt_id = ckpt_node->ckpt_id;
	cpd_msg.info.rd_set.reten_time = ckpt_node->ret_time;

	/* send it to MBCSv */
	rc = cpd_mbcsv_async_update(cb, &cpd_msg);
	if (rc != SA_AIS_OK)
		TRACE_4("cpd A2S ckpt rdset async failed for ckpt_id :%llx",ckpt_node->ckpt_id);
	else
		TRACE_1("cpd A2S ckpt rdes async success for ckpt_id :%llx",ckpt_node->ckpt_id);

	TRACE_LEAVE();
}
Exemple #30
0
/*!
 * \brief Print informations about reference_picture_list_modification decoding.
 * \param *dc The current DecodingContext.
 * \param *rplm (rplm_t) data structure.
 */
static void printRPLM(DecodingContext_t *dc, rplm_t *rplm)
{
#if ENABLE_DEBUG
    TRACE_INFO(SLICE, "  > " BLD_GREEN "printRPLM()\n" CLR_RESET);

    // Check structure
    if (rplm == NULL)
    {
        TRACE_ERROR(SLICE, "    Invalid RPML structure!\n");
        return;
    }

    // Print values
    if (rplm->ref_pic_list_modification_flag_l0)
    {
        TRACE_1(SLICE, "    - l0  modification_of_pic_nums_idc\t= %i\n", rplm->modification_of_pic_nums_idc);

        TRACE_1(SLICE, "    - l0  abs_diff_pic_num_minus1\t\t= %i\n", rplm->abs_diff_pic_num_minus1);
        TRACE_1(SLICE, "    - l0  long_term_pic_num\t\t\t= %i\n", rplm->long_term_pic_num);
    }
    else
    {
        TRACE_1(SLICE, "    - ref_pic_list_modification_flag_l0 is not defined\n");
    }

    if (rplm->ref_pic_list_modification_flag_l1)
    {
        TRACE_1(SLICE, "    - l1  modification_of_pic_nums_idc\t= %i\n", rplm->modification_of_pic_nums_idc);

        TRACE_1(SLICE, "    - l1  abs_diff_pic_num_minus1\t\t= %i\n", rplm->abs_diff_pic_num_minus1);
        TRACE_1(SLICE, "    - l1  long_term_pic_num\t\t\t= %i\n", rplm->long_term_pic_num);
    }
    else
    {
        TRACE_1(SLICE, "    - ref_pic_list_modification_flag_l1 is not defined\n");
    }
#endif /* ENABLE_DEBUG */
}