Example #1
0
/*******************************************************************************
* Function Name: HandleBleProcessing
********************************************************************************
*
* Summary:
*   Handles the BLE state machine for intiating different procedures
*   during different states of BLESS.
*
* Parameters:
*   None.
*
* Return:
*   None.
*
*******************************************************************************/
void HandleBleProcessing(void)
{    
    CYBLE_API_RESULT_T      cyble_api_result;
    
    switch (cyBle_state)
    {
        case CYBLE_STATE_SCANNING:
            if(peerDeviceFound)
            {
                CyBle_GapcStopScan();
            }
            break;
    
        case CYBLE_STATE_CONNECTED:
            
            /* if Client does not has all the information about attribute handles 
             * call procedure for getting it */
            if((INFO_EXCHANGE_COMPLETE != infoExchangeState))
            {
                attrHandleInit();
            }
            
            /* enable notifications if not enabled already */
            else if(false == notificationEnabled)
            {
                enableNotifications();
            }
            
            /* if client has all required info and stack is free, handle UART traffic */
            else if(CyBle_GattGetBusStatus() != CYBLE_STACK_STATE_BUSY)
            {
                HandleUartTxTraffic();
            }
            
            break;
                
        case CYBLE_STATE_DISCONNECTED:
        {
            if(peerDeviceFound)
            {
                cyble_api_result = CyBle_GapcConnectDevice(&peerAddr);
                
			    if(CYBLE_ERROR_OK == cyble_api_result)
			    {
				    peerDeviceFound = false;
			    }
            }
            else
            {
                CyBle_GapcStartScan(CYBLE_SCANNING_FAST);  
            }
            break;
        }
        
        default:
            break;       
    }
}
Example #2
0
void Comm5TCP::OnConnect()
{
	_log.Log(LOG_STATUS, "Comm5 MA-5XXX: connected to: %s:%ld", m_szIPAddress.c_str(), m_usIPPort);
	m_bIsStarted = true;
	notificationEnabled = false;

	sOnConnected(this);
	queryRelayState();
	querySensorState();
	enableNotifications();
}
void CPropBrowserEngineGeneral::show(QWidget* parentWindow)
{
	setPropertiesWithoutValueMarked(true); // so that group properties stand out
	setRootIsDecorated(true); // keep true, otherwise subcategories won't work correctly
	setAlternatingRowColors(true);
	setHeaderVisible(true);
	//setIndentation(60);
	//setStatusTip("bla");
	//setToolTip("Bla");
	setResizeMode(QtTreePropertyBrowser::Interactive);
	setSplitterPosition(_splitterPos);
	setWindowTitle("Physics Engines Properties - General");


	variantManager = new QtVariantPropertyManager();
	variantFactory = new QtVariantEditorFactory();
	setFactoryForManager(variantManager,variantFactory);


	buttonManager = new ButtonEditManager();
	buttonFactory  = new PushButtonEditFactory();
	setFactoryForManager(buttonManager,buttonFactory);


	QStringList configurationEnum;
	configurationEnum << "Very accurate" << "Accurate (default)" << "Fast" << "Very fast" << "Customized";
	p_configuration = variantManager->addProperty(QtVariantPropertyManager::enumTypeId(),"");
	p_configuration->setAttribute("enumNames", configurationEnum);
	QtBrowserItem* anItem=addProperty(p_configuration);
	setBackgroundColor(anItem,QTPROPERTYBROWSER_COLOR_GREY);


	QtProperty *bulletGroup = variantManager->addProperty(QtVariantPropertyManager::groupTypeId(),"Bullet properties");
	bulletGroup->theBrightness=140;
	bulletGroupItem=addProperty(bulletGroup);
	setBackgroundColor(bulletGroupItem,QTPROPERTYBROWSER_COLOR_RED);
	setExpanded(bulletGroupItem,_bulletPropertiesExpanded);

	QtProperty *odeGroup = variantManager->addProperty(QtVariantPropertyManager::groupTypeId(),"ODE properties");
	odeGroup->theBrightness=140;
	odeGroupItem=addProperty(odeGroup);
	setBackgroundColor(odeGroupItem,QTPROPERTYBROWSER_COLOR_GREEN);
	setExpanded(odeGroupItem,_odePropertiesExpanded);

	QtProperty *vortexGroup = variantManager->addProperty(QtVariantPropertyManager::groupTypeId(),"Vortex properties");
	vortexGroup->theBrightness=140;
	vortexGroupItem=addProperty(vortexGroup);
	setBackgroundColor(vortexGroupItem,QTPROPERTYBROWSER_COLOR_BLUE);
	setExpanded(vortexGroupItem,_vortexPropertiesExpanded);

	// Bullet:
	p_bulletTimeStep = variantManager->addProperty(QVariant::String,"");
	bulletGroup->addSubProperty(p_bulletTimeStep);
	p_bulletConstraintSolvIterat = variantManager->addProperty(QVariant::String,"");
	bulletGroup->addSubProperty(p_bulletConstraintSolvIterat);
	p_bulletInternalScaling = variantManager->addProperty(QVariant::String,"");
	bulletGroup->addSubProperty(p_bulletInternalScaling);
	p_bulletInternalFullScaling = variantManager->addProperty(QVariant::Bool,"");
	bulletGroup->addSubProperty(p_bulletInternalFullScaling);
	p_bulletCollMarginScaling = variantManager->addProperty(QVariant::String,"");
	bulletGroup->addSubProperty(p_bulletCollMarginScaling);

	// ODE:
	p_odeTimeStep = variantManager->addProperty(QVariant::String,"");
	odeGroup->addSubProperty(p_odeTimeStep);
	p_odeQuickStep = variantManager->addProperty(QVariant::Bool,"");
	odeGroup->addSubProperty(p_odeQuickStep);
	p_odeIterations = variantManager->addProperty(QVariant::String,"");
	odeGroup->addSubProperty(p_odeIterations);
	p_odeInternalScaling = variantManager->addProperty(QVariant::String,"");
	odeGroup->addSubProperty(p_odeInternalScaling);
	p_odeInternalFullScaling = variantManager->addProperty(QVariant::Bool,"");
	odeGroup->addSubProperty(p_odeInternalFullScaling);
	p_odeGlobalErp = variantManager->addProperty(QVariant::String,"");
	odeGroup->addSubProperty(p_odeGlobalErp);
	p_odeGlobalCfm = variantManager->addProperty(QVariant::String,"");
	odeGroup->addSubProperty(p_odeGlobalCfm);

	// Vortex:
	p_vortexTimeStep = variantManager->addProperty(QVariant::String,"");
	vortexGroup->addSubProperty(p_vortexTimeStep);
	p_vortexContactTolerance = variantManager->addProperty(QVariant::String,"");
	vortexGroup->addSubProperty(p_vortexContactTolerance);
	p_vortexInternalScaling = variantManager->addProperty(QVariant::String,"");
	vortexGroup->addSubProperty(p_vortexInternalScaling);
	p_vortexInternalFullScaling = variantManager->addProperty(QVariant::Bool,"");
	vortexGroup->addSubProperty(p_vortexInternalFullScaling);
	p_vortexAutoSleep = variantManager->addProperty(QVariant::Bool,"");
	vortexGroup->addSubProperty(p_vortexAutoSleep);
	p_vortexMultithreading = variantManager->addProperty(QVariant::Bool,"");
	vortexGroup->addSubProperty(p_vortexMultithreading);

	QtProperty* vortexConstraint = variantManager->addProperty(QtVariantPropertyManager::groupTypeId(),"Constraint properties");
	vortexGroup->addSubProperty(vortexConstraint);
	vortexConstraintItem=getSubPropertyBrowserItem(vortexGroupItem,vortexConstraint);
	setExpanded(vortexConstraintItem,_vortexConstraintPropertiesExpanded);

	p_vortexConstraintLinearCompliance = variantManager->addProperty(QVariant::String,"");
	vortexConstraint->addSubProperty(p_vortexConstraintLinearCompliance);
	p_vortexConstraintLinearDamping = variantManager->addProperty(QVariant::String,"");
	vortexConstraint->addSubProperty(p_vortexConstraintLinearDamping);
	p_vortexConstraintLinearKinLoss = variantManager->addProperty(QVariant::String,"");
	vortexConstraint->addSubProperty(p_vortexConstraintLinearKinLoss);
	p_vortexConstraintAngularCompliance = variantManager->addProperty(QVariant::String,"");
	vortexConstraint->addSubProperty(p_vortexConstraintAngularCompliance);
	p_vortexConstraintAngularDamping = variantManager->addProperty(QVariant::String,"");
	vortexConstraint->addSubProperty(p_vortexConstraintAngularDamping);
	p_vortexConstraintAngularKinLoss = variantManager->addProperty(QVariant::String,"");
	vortexConstraint->addSubProperty(p_vortexConstraintAngularKinLoss);


	refresh();

	enableNotifications(true);

//	setWindowFlags(Qt::CustomizeWindowHint|Qt::WindowMaximizeButtonHint|Qt::WindowCloseButtonHint);
//	setWindowModality(Qt::ApplicationModal);
	setGeometry(_dlgPosX,_dlgPosY,_dlgSizeX,_dlgSizeY);

}