Sha256: 644e18287ae3bec5f9056790a1fe00da5499f2bc61bb40c34e46fbf5257c69b7

Contents?: true

Size: 1.4 KB

Versions: 21

Compression:

Stored size: 1.4 KB

Contents

#include "stdafx.h"

#if defined(_WIN32_WCE)

#include <nled.h>
#include "Vibrate.h"
#include <common/RhodesApp.h>

IMPLEMENT_LOGCLASS(CVibrate, "Vibrate");

CVibrate *CVibrate::m_pInstance = NULL;
CMutex CVibrate::m_mxLocker;

CVibrate::CVibrate (IRhoClassFactory* factory) : CRhoThread(factory), m_nDuration(2), m_bToggled(false)
{
}

CVibrate::~CVibrate ()
{
    untoggle();
}

void CVibrate::createCVibrate()
{
    static CVibrate instance(createClassFactory());
    m_pInstance = &instance;
}

CVibrate &CVibrate::getCVibrate()
{
    m_mxLocker.Lock();

    if (!m_pInstance)
        createCVibrate();
    
    m_mxLocker.Unlock();
    
    return *m_pInstance;
}

void CVibrate::toggle()
{
    toggle (m_nDuration);
}

void CVibrate::toggle(int seconds)
{
    m_nDuration = seconds;
    start(epNormal);
}

void CVibrate::untoggle()
{
    NLED_SETTINGS_INFO settings;
    settings.LedNum= 1; 
    settings.OffOnBlink= 0; 
    NLedSetDevice (NLED_SETTINGS_INFO_ID, &settings);
    m_bToggled = false;
	stop(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);
		untoggle();
    }
}

#endif // _WIN32_WCE

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
rhodes-2.0.3 platform/wm/rhodes/Vibrate.cpp
rhodes-2.0.2 platform/wm/rhodes/Vibrate.cpp
rhodes-2.0.0 platform/wm/rhodes/Vibrate.cpp
rhodes-2.0.0.rc2 platform/wm/rhodes/Vibrate.cpp
rhodes-2.0.0.rc1 platform/wm/rhodes/Vibrate.cpp
rhodes-2.0.0.beta11 platform/wm/rhodes/Vibrate.cpp
rhodes-2.0.0.beta10 platform/wm/rhodes/Vibrate.cpp
rhodes-2.0.0.beta9 platform/wm/rhodes/Vibrate.cpp
rhodes-2.0.0.beta8 platform/wm/rhodes/Vibrate.cpp
rhodes-2.0.0.beta7 platform/wm/rhodes/Vibrate.cpp
rhodes-2.0.0.beta6 platform/wm/rhodes/Vibrate.cpp
rhodes-2.0.0.beta4 platform/wm/rhodes/Vibrate.cpp
rhodes-2.0.0.beta3 platform/wm/rhodes/Vibrate.cpp
rhodes-1.5.5 platform/wm/rhodes/Vibrate.cpp
rhodes-2.0.0.beta2 platform/wm/rhodes/Vibrate.cpp
rhodes-2.0.0.beta1 platform/wm/rhodes/Vibrate.cpp
rhodes-1.5.4 platform/wm/rhodes/Vibrate.cpp
rhodes-1.5.3 platform/wm/rhodes/Vibrate.cpp
rhodes-1.5.2 platform/wm/rhodes/Vibrate.cpp
rhodes-1.5.1 platform/wm/rhodes/Vibrate.cpp