static int Character_forNameImpl(JNIEnv* env, jclass, jstring javaBlockName) {
    ScopedUtfChars blockName(env, javaBlockName);
    if (blockName.c_str() == NULL) {
        return 0;
    }
    return u_getPropertyValueEnum(UCHAR_BLOCK, blockName.c_str());
}
Exemple #2
0
static Agraph_t *mkBlock(Agraph_t * g, bcstate * stp)
{
    Agraph_t *sg;

    stp->nComp++;
    sg = agsubg(g, blockName(agnameof(g), stp->nComp), 1);
    agbindrec(sg, "info", sizeof(Agraphinfo_t), TRUE);
    NEXTBLK(sg) = stp->blks;
    stp->blks = sg;
    return sg;
}
int fastiva_vm_Character_C$__forNameImpl(jstring javaBlockName) {
#if 1
	FASTIVA_DBREAK();
	return 0;
#else
    ScopedUtfChars blockName(env, javaBlockName);
    if (blockName.c_str() == NULL) {
        return 0;
    }
    return u_getPropertyValueEnum(UCHAR_BLOCK, blockName.c_str());
#endif
}
Exemple #4
0
/**
 * This function is called when the control program is loaded to zenom.
 * Use this function to register control parameters, to register log variables
 * and to initialize control parameters.
 *
 * @return Return non-zero to indicate an error.
 */
int ZenomMatlab::initialize()
{
    
    int paramIdx, sigIdx;
    int nBlockParams, nSignals;
    const char* status;
    
    // İsmi gözükmeyen parametrelerin sayısını tutar.
    unknown_param_counter = 0;

    /* Here is where Q8 dirver is  loaded to kernel space */
     
    //system(STR(sudo insmod DQ8));
    fd = rt_dev_open(DEV_NAME, O_RDWR);

    if(fd < 0)
        fprintf(stderr, "target:Q8 device open error!\n");
    
    
    init_xenomai();

    rtM = MODEL();

    if (rtmGetErrorStatus(rtM) != NULL) {
        (void)fprintf(stderr,"Error during model registration: %s\n",
                      rtmGetErrorStatus(rtM));
        exit(EXIT_FAILURE);
    }
    
    MdlInitializeSizes();
    MdlInitializeSampleTimes();

    status = rt_SimInitTimingEngine(rtmGetNumSampleTimes(rtM),
                                    rtmGetStepSize(rtM),
                                    rtmGetSampleTimePtr(rtM),
                                    rtmGetOffsetTimePtr(rtM),
                                    rtmGetSampleHitPtr(rtM),
                                    rtmGetSampleTimeTaskIDPtr(rtM),
                                    rtmGetTStart(rtM),
                                    &rtmGetSimTimeStep(rtM),
                                    &rtmGetTimingData(rtM));


    if (status != NULL) {
        (void)fprintf(stderr, "Failed to initialize sample time engine: %s\n", status);
        exit(EXIT_FAILURE);
    }

    rt_CreateIntegrationData(rtM);

    mmi = &(rtmGetDataMapInfo(rtM).mmi);

    if (mmi!=NULL){
        //exception here 
    }    

    bp = rtwCAPI_GetBlockParameters(mmi);
    sig = rtwCAPI_GetSignals(mmi);

    nBlockParams = rtwCAPI_GetNumBlockParameters(mmi);
    nSignals = rtwCAPI_GetNumSignals(mmi);

    xrtpi = new XrtTargetParamInfo[nBlockParams];
    xtsi = new XrtTargetSignalInfo[nSignals];

    /** Get parameter and register */      
    
    Xrt_GetParameterInfo(mmi);
    Xrt_GetSignalInfo(mmi);

    /**************** ZENOM PART  ***************/
    
    for(paramIdx = 0; paramIdx < rtwCAPI_GetNumBlockParameters(mmi); paramIdx++){
        
        std::string paramName(xrtpi[paramIdx].paramName);
        std::string blockName(xrtpi[paramIdx].blockName);

        if(paramName.empty()){
            paramName = std::string("unknownBlock");
        }
            

        for (std::size_t found = paramName.find_first_of(" "); 
            found != std::string::npos ; 
            found = paramName.find_first_of(" "))
        {
            paramName.erase (found);
        }

        for (std::size_t found = blockName.find_first_of(" "); 
            found != std::string::npos ; 
            found = blockName.find_first_of(" "))
        {
            blockName.erase (found);
        }

        paramName = blockName + "-" + paramName;
        
        registerControlVariable( xrtpi[paramIdx].dataValue, 
                                 paramName, 
                                 xrtpi[paramIdx].numRows, 
                                 xrtpi[paramIdx].numColumns );
    }

    for (sigIdx = 0; sigIdx < rtwCAPI_GetNumSignals(mmi); ++sigIdx){

        std::string sigName(xtsi[sigIdx].signalName);  

        if(sigName.empty()){
            sigName = std::string("unknownSignal");
            sigName += unknown_param_counter;
        }

        for (std::size_t found = sigName.find_first_of(" "); 
            found != std::string::npos ; 
            found = sigName.find_first_of(" "))
        {
            sigName.erase (found);
        }

        registerLogVariable(xtsi[sigIdx].dataValue,
                        sigName,
                        xtsi[sigIdx].numRows,
                        xtsi[sigIdx].numColumns);
    }

    setFrequency( (double)rtmGetStepSize(rtM) );
    setDuration ( (double)rtmGetTFinal(rtM) );

    fprintf(stderr, "init done!");
    
    return 0;
}
Exemple #5
0
    //-----------------------------------------------------------------------------------
    void HlmsJsonPbs::saveMaterial( const HlmsDatablock *datablock, String &outString )
    {
        assert( dynamic_cast<const HlmsPbsDatablock*>(datablock) );
        const HlmsPbsDatablock *pbsDatablock = static_cast<const HlmsPbsDatablock*>(datablock);

        outString += ",\n\t\t\t\"workflow\" : ";
        toQuotedStr( pbsDatablock->getWorkflow(), outString );

        if( pbsDatablock->getBrdf() != PbsBrdf::Default )
        {
            outString += ",\n\t\t\t\"brdf\" : ";
            toQuotedStr( pbsDatablock->getBrdf(), outString );
        }

        if( pbsDatablock->getTwoSidedLighting() )
            outString += ",\n\t\t\t\"two_sided\" : true";

        if( !pbsDatablock->getReceiveShadows() )
            outString += ",\n\t\t\t\"receive_shadows\" : false";

        if( pbsDatablock->getTransparencyMode() != HlmsPbsDatablock::None )
        {
            outString += ",\n\t\t\t\"transparency\" :\n\t\t\t{";
            outString += "\n\t\t\t\t\"value\" : ";
            outString += StringConverter::toString( pbsDatablock->getTransparency() );
            outString += ",\n\t\t\t\t\"mode\" : ";
            toQuotedStr( pbsDatablock->getTransparencyMode(), outString );
            outString += ",\n\t\t\t\t\"use_alpha_from_textures\" : ";
            outString += pbsDatablock->getUseAlphaFromTextures() ? "true" : "false";
            outString += "\n\t\t\t}";
        }

        saveTexture( pbsDatablock->getDiffuse(),  "diffuse", PBSM_DIFFUSE,
                     pbsDatablock, outString, true, pbsDatablock->getBackgroundDiffuse() );
        saveTexture( pbsDatablock->getSpecular(), "specular", PBSM_SPECULAR,
                     pbsDatablock, outString,
                     pbsDatablock->getWorkflow() == HlmsPbsDatablock::SpecularWorkflow );
        if( pbsDatablock->getWorkflow() != HlmsPbsDatablock::MetallicWorkflow )
        {
            saveFresnel( pbsDatablock, outString );
        }
        else
        {
            saveTexture( pbsDatablock->getMetalness(), "metalness", PBSM_METALLIC,
                         pbsDatablock, outString );
        }

        if( pbsDatablock->getNormalMapWeight() != 1.0f ||
            !pbsDatablock->getTexture( PBSM_NORMAL ).isNull() )
        {
            saveTexture( pbsDatablock->getNormalMapWeight(), "normal", PBSM_NORMAL,
                         pbsDatablock, outString );
        }

        saveTexture( pbsDatablock->getRoughness(), "roughness", PBSM_ROUGHNESS,
                     pbsDatablock, outString );

        if( !pbsDatablock->getTexture( PBSM_DETAIL_WEIGHT ).isNull() )
            saveTexture( "detail_weight", PBSM_DETAIL_WEIGHT, pbsDatablock, outString );

        for( int i=0; i<4; ++i )
        {
            PbsBlendModes blendMode = pbsDatablock->getDetailMapBlendMode( i );
            const Vector4 &offsetScale = pbsDatablock->getDetailMapOffsetScale( i );
            const Vector2 offset( offsetScale.x, offsetScale.y );
            const Vector2 scale( offsetScale.z, offsetScale.w );

            const PbsTextureTypes textureType = static_cast<PbsTextureTypes>(PBSM_DETAIL0 + i);

            if( blendMode != PBSM_BLEND_NORMAL_NON_PREMUL || offset != Vector2::ZERO ||
                scale != Vector2::UNIT_SCALE || pbsDatablock->getDetailMapWeight( i ) != 1.0f ||
                !pbsDatablock->getTexture( textureType ).isNull() )
            {
                char tmpBuffer[64];
                LwString blockName( LwString::FromEmptyPointer( tmpBuffer, sizeof(tmpBuffer) ) );

                blockName.a( "detail_diffuse", i );

                saveTexture( pbsDatablock->getDetailMapWeight( i ), blockName.c_str(),
                             static_cast<PbsTextureTypes>(PBSM_DETAIL0 + i), pbsDatablock,
                             outString );
            }
        }

        for( int i=0; i<4; ++i )
        {
            const Vector4 &offsetScale = pbsDatablock->getDetailMapOffsetScale( i );
            const Vector2 offset( offsetScale.x, offsetScale.y );
            const Vector2 scale( offsetScale.z, offsetScale.w );

            const PbsTextureTypes textureType = static_cast<PbsTextureTypes>(PBSM_DETAIL0_NM + i);

            if( offset != Vector2::ZERO || scale != Vector2::UNIT_SCALE ||
                pbsDatablock->getDetailNormalWeight( i ) != 1.0f ||
                !pbsDatablock->getTexture( textureType ).isNull() )
            {
                char tmpBuffer[64];
                LwString blockName( LwString::FromEmptyPointer( tmpBuffer, sizeof(tmpBuffer) ) );

                blockName.a( "detail_normal", i );
                saveTexture( pbsDatablock->getDetailNormalWeight( i ), blockName.c_str(),
                             static_cast<PbsTextureTypes>(PBSM_DETAIL0_NM + i), pbsDatablock,
                             outString );
            }
        }

        if( pbsDatablock->hasEmissive() )
        {
            saveTexture( pbsDatablock->getEmissive(), "emissive", PBSM_EMISSIVE,
                         pbsDatablock, outString );
        }

        if( !pbsDatablock->getTexture( PBSM_REFLECTION ).isNull() )
            saveTexture( "reflection", PBSM_REFLECTION, pbsDatablock, outString );
    }
Exemple #6
0
QString KCharSelectData::block(CharSelectData* charselect, uint16_t unicode)
{
    return blockName(blockIndex(c));
}
Exemple #7
0
string IwrfExport::_assembleStatusXml()

{

  string xml;

  // main block

  xml += TaXml::writeStartTag("HcrStatus", 0);

  ///////////////////////////////////////////////////////
  // transmit block
  
  xml += TaXml::writeStartTag("HcrTransmitterStatus", 1);

  const XmitStatus &xs = _monitor.transmitterStatus();
  xml += xs.toTaXmlString(2);

  xml += TaXml::writeEndTag("HcrTransmitterStatus", 1);

  ///////////////////////////////////////////////////////
  // receive block

  xml += TaXml::writeStartTag("HcrReceiverStatus", 1);

  // Start with status from the PMC-730 card
  const HcrPmc730Status pmc730Status = _monitor.pmc730Status();
  
  // ints
  
  xml += TaXml::writeInt
    ("HmcMode", 2, pmc730Status.hmcMode());

  xml += TaXml::writeInt
    ("EmsErrorCount", 2, pmc730Status.emsErrorCount());

  // floats

  xml += TaXml::writeDouble
    ("DetectedRfPower", 2, pmc730Status.detectedRfPower());

  static const double HPA_PER_PSI = 68.94785;
  xml += TaXml::writeDouble
    ("PvForePressure", 2, pmc730Status.pvForePressure() / HPA_PER_PSI);

  xml += TaXml::writeDouble
    ("PvAftPressure", 2, pmc730Status.pvAftPressure() / HPA_PER_PSI);

  xml += TaXml::writeDouble
    ("ApsLowSidePressure", 2, pmc730Status.apsLowSidePressure() / HPA_PER_PSI);

  xml += TaXml::writeDouble
    ("ApsHighSidePressure", 2, pmc730Status.apsHighSidePressure() / HPA_PER_PSI);

  xml += TaXml::writeDouble
    ("PloTemp", 2, pmc730Status.ploTemp());

  xml += TaXml::writeDouble
    ("EikTemp", 2, pmc730Status.eikTemp());

  xml += TaXml::writeDouble
    ("VLnaTemp", 2, pmc730Status.vLnaTemp());

  xml += TaXml::writeDouble
    ("HLnaTemp", 2, pmc730Status.hLnaTemp());

  xml += TaXml::writeDouble
    ("PolarizationSwitchTemp", 2, pmc730Status.polarizationSwitchTemp());

  xml += TaXml::writeDouble
    ("RfDetectorTemp", 2, pmc730Status.rfDetectorTemp());

  xml += TaXml::writeDouble
    ("NoiseSourceTemp", 2, pmc730Status.noiseSourceTemp());

  xml += TaXml::writeDouble
    ("Ps28VTemp", 2, pmc730Status.ps28VTemp());

  xml += TaXml::writeDouble
    ("RdsInDuctTemp", 2, pmc730Status.rdsInDuctTemp());

  xml += TaXml::writeDouble
    ("RotationMotorTemp", 2, pmc730Status.rotationMotorTemp());

  xml += TaXml::writeDouble
    ("TiltMotorTemp", 2, pmc730Status.tiltMotorTemp());

  xml += TaXml::writeDouble
    ("InsTemp", 2, pmc730Status.insTemp());

  xml += TaXml::writeDouble
    ("TailconeTemp", 2, pmc730Status.tailconeTemp());

  xml += TaXml::writeDouble
    ("PsVoltage", 2, pmc730Status.psVoltage());

  // booleans

  xml += TaXml::writeBoolean
    ("ApsValveOpen", 2, pmc730Status.apsValveOpen());

  xml += TaXml::writeBoolean
    ("Locked15_5GHzPLO", 2, pmc730Status.locked15_5GHzPLO());

  xml += TaXml::writeBoolean
    ("Locked1250MHzPLO", 2, pmc730Status.locked1250MHzPLO());

  xml += TaXml::writeBoolean
    ("Locked125MHzPLO", 2, pmc730Status.locked125MHzPLO());

  xml += TaXml::writeBoolean
    ("ModPulseDisabled", 2, pmc730Status.modPulseDisabled());
  
  xml += TaXml::writeBoolean
    ("RdsXmitterFilamentOn", 2, pmc730Status.rdsXmitterFilamentOn());

  xml += TaXml::writeBoolean
    ("RdsXmitterHvOn", 2, pmc730Status.rdsXmitterHvOn());

  xml += TaXml::writeBoolean
    ("RadarPowerError", 2, pmc730Status.radarPowerError());
  
  xml += TaXml::writeBoolean
    ("EmsError1", 2, pmc730Status.emsError1());

  xml += TaXml::writeBoolean
    ("EmsError2", 2, pmc730Status.emsError2());

  xml += TaXml::writeBoolean
    ("EmsError3", 2, pmc730Status.emsError3());

  xml += TaXml::writeBoolean
    ("EmsError4Or5", 2, pmc730Status.emsError4Or5());

  xml += TaXml::writeBoolean
    ("EmsError6Or7", 2, pmc730Status.emsError6Or7());

  xml += TaXml::writeBoolean
    ("EmsPowerError", 2, pmc730Status.emsPowerError());

  xml += TaXml::writeBoolean
    ("WaveguideSwitchError", 2, pmc730Status.waveguideSwitchError());

  // Status from hcrdrx
  const DrxStatus drxStatus = _monitor.drxStatus();

  xml += TaXml::writeDouble
    ("PentekFpgaTemp", 2, drxStatus.pentekFpgaTemp());

  xml += TaXml::writeDouble
    ("PentekBoardTemp", 2, drxStatus.pentekBoardTemp());

  // end receive status

  xml += TaXml::writeEndTag("HcrReceiverStatus", 1);

  ///////////////////////////////////////////////////////
  // HcrIns1Data and HcrIns2Data blocks

  for (int insNum = 1; insNum <= 2; insNum++) {

    std::ostringstream oss;
    oss << "HcrIns" << insNum << "Data";
    std::string blockName(oss.str());    // "HcrIns1Data" or "HcrIns2Data"
    xml += TaXml::writeStartTag(blockName, 1);

    // Get latest data we got from this INS (if any).
    CmigitsFmq::MsgStruct insData = (insNum == 1) ? _latestIns1Data : _latestIns2Data;

    // serial number
    xml += TaXml::writeInt("CmigitsSerialNum", 2, insData.insSerialNum);

    // C-MIGITS status info (latest 3500 message from C-MIGITS)
    xml += TaXml::writeDouble("Cmigits3500Time", 2, 0.001 * insData.time3500);
    xml += TaXml::writeInt("Cmigits3500CurrentMode", 2, insData.currentMode);
    xml += TaXml::writeBoolean("Cmigits3500InsAvailable", 2, insData.insAvailable);
    xml += TaXml::writeBoolean("Cmigits3500GpsAvailable", 2, insData.gpsAvailable);
    xml += TaXml::writeInt("Cmigits3500NSats", 2, insData.nSats);
    xml += TaXml::writeInt("Cmigits3500PositionFOM", 2, insData.positionFOM);
    xml += TaXml::writeInt("Cmigits3500VelocityFOM", 2, insData.velocityFOM);
    xml += TaXml::writeInt("Cmigits3500HeadingFOM", 2, insData.headingFOM);
    xml += TaXml::writeInt("Cmigits3500TimeFOM", 2, insData.timeFOM);
    xml += TaXml::writeDouble("Cmigits3500HPosError", 2, insData.hPosError);
    xml += TaXml::writeDouble("Cmigits3500VPosError", 2, insData.vPosError);
    xml += TaXml::writeDouble("Cmigits3500VelocityError", 2, insData.velocityError);

    // current position/velocity (latest 3501 message from C-MIGITS)
    xml += TaXml::writeDouble("Cmigits3501Time", 2, 0.001 * insData.time3501);
    xml += TaXml::writeDouble("Cmigits3501Latitude", 2, insData.latitude);
    xml += TaXml::writeDouble("Cmigits3501Longitude", 2, insData.longitude);
    xml += TaXml::writeDouble("Cmigits3501Altitude", 2, insData.altitude);

    // current attitude (latest 3512 message from C-MIGITS)
    xml += TaXml::writeDouble("Cmigits3512Time", 2, 0.001 * insData.time3512);
    xml += TaXml::writeDouble("Cmigits3512Pitch", 2, insData.pitch);
    xml += TaXml::writeDouble("Cmigits3512Roll", 2, insData.roll);
    xml += TaXml::writeDouble("Cmigits3512Heading", 2, insData.heading);
    xml += TaXml::writeDouble("Cmigits3512VelNorth", 2, insData.velNorth);
    xml += TaXml::writeDouble("Cmigits3512VelEast", 2, insData.velEast);
    xml += TaXml::writeDouble("Cmigits3512VelUp", 2, insData.velUp);

    // end the block
    xml += TaXml::writeEndTag(blockName, 1);
  }

  // differences between INSs

  double insDeltaTime = fabs(_latestIns1Data.time3500 - _latestIns2Data.time3500);
  if (insDeltaTime > 9999) {
    insDeltaTime = 9999;
  }
  double insDeltaLatitude = fabs(_latestIns1Data.latitude - _latestIns2Data.latitude);
  double insDeltaLongitude = fabs(_latestIns1Data.longitude - _latestIns2Data.longitude);
  double insDeltaAltitude = fabs(_latestIns1Data.altitude - _latestIns2Data.altitude);
  double insDeltaPitch = fabs(_latestIns1Data.pitch - _latestIns2Data.pitch);
  double insDeltaRoll = fabs(_latestIns1Data.roll - _latestIns2Data.roll);
  double insDeltaHeading = fabs(_latestIns1Data.heading - _latestIns2Data.heading);

  xml += TaXml::writeStartTag("HcrInsDelta", 1);
  xml += TaXml::writeDouble("CmigitsDeltaTime", 2, insDeltaTime);
  xml += TaXml::writeDouble("CmigitsDeltaLatitude", 2, insDeltaLatitude);
  xml += TaXml::writeDouble("CmigitsDeltaLongitude", 2, insDeltaLongitude);
  xml += TaXml::writeDouble("CmigitsDeltaAltitude", 2, insDeltaAltitude);
  xml += TaXml::writeDouble("CmigitsDeltaPitch", 2, insDeltaPitch);
  xml += TaXml::writeDouble("CmigitsDeltaRoll", 2, insDeltaRoll);
  xml += TaXml::writeDouble("CmigitsDeltaHeading", 2, insDeltaHeading);
  xml += TaXml::writeEndTag("HcrInsDelta", 1);

  ////////////////////////////////////////////////
  // close

  xml += TaXml::writeEndTag("HcrStatus", 0);

  return xml;

}