Example #1
0
//http://4pda.ru/forum/index.php?showtopic=112068
//code by constv http://4pda.ru/forum/index.php?showuser=151002
UINT GetVibratorLedNum(void)//-1 means no vibrator
{ 
    NLED_COUNT_INFO nci;  
    UINT wCount = 0,
        VibrLed = -1;  
    NLED_SUPPORTS_INFO sup;  
    if(NLedGetDeviceInfo(0, (PVOID) &nci))  
        wCount = (UINT) nci.cLeds;     
    for (UINT i=0; i<wCount; i++) 
    {  
        sup.LedNum = i;   
        NLedGetDeviceInfo(1,&sup);  
        if (sup.lCycleAdjust == -1)  
        {   
            VibrLed = i;   
            break;
        } 
    } 
    return VibrLed;
}
Example #2
0
void CVibrate::run() 
{
    NLED_SETTINGS_INFO settings;

    settings.LedNum= 1;
    NLedGetDeviceInfo(NLED_SETTINGS_INFO_ID,  &settings);

    if (!m_bToggled && settings.OffOnBlink == 0) {
        settings.LedNum= 1; 
        settings.OffOnBlink= 1;
        NLedSetDevice (NLED_SETTINGS_INFO_ID, &settings);
        m_bToggled = true;        
        wait (m_nDuration_ms/1000);
		untoggle();
    }
}