Exemple #1
0
	void I2NPMessage::RenewI2NPMessageHeader ()
	{
		uint32_t msgID;
		RAND_bytes ((uint8_t *)&msgID, 4);
		SetMsgID (msgID);
		SetExpiration (i2p::util::GetMillisecondsSinceEpoch () + I2NP_MESSAGE_EXPIRATION_TIMEOUT); 		
	}
/**
 * The Watchdog is born.
 */
Watchdog::Watchdog()
	:	m_fpgaWatchDog(NULL)
{
	m_fpgaWatchDog = new tWatchdog(&status);
	wpi_assertCleanStatus(status);
	SetExpiration(kDefaultWatchdogExpiration);
	SetEnabled(true);
}
Exemple #3
0
/**
 * The Watchdog is born.
 */
Watchdog::Watchdog()
	:	m_fpgaWatchDog(NULL)
{
	tRioStatusCode localStatus = NiFpga_Status_Success;
	m_fpgaWatchDog = tWatchdog::create(&localStatus);
	wpi_setError(localStatus);
	SetExpiration(kDefaultWatchdogExpiration);
	SetEnabled(true);
}
Exemple #4
0
	void I2NPMessage::FillI2NPMessageHeader (I2NPMessageType msgType, uint32_t replyMsgID)
	{
		SetTypeID (msgType);
		if (!replyMsgID) RAND_bytes ((uint8_t *)&replyMsgID, 4);
		SetMsgID (replyMsgID); 
		SetExpiration (i2p::util::GetMillisecondsSinceEpoch () + I2NP_MESSAGE_EXPIRATION_TIMEOUT); 
		UpdateSize ();
		UpdateChks ();
	}		
Exemple #5
0
CLCDPage::CLCDPage(void)
:   m_dwStartTime(0),
    m_dwEllapsedTime(0),
    m_dwExpirationTime(0)
{
    SetExpiration(INFINITE);
    m_bUseBitmapBackground = FALSE;
    m_bUseColorBackground = FALSE;
}
Drivetrain::Drivetrain(UINT32 left1, UINT32 left2, UINT32 right1, UINT32 right2, Encoder* leftEncoder, Encoder* rightEncoder) 
: RobotDrive(left1, left2, right1, right2), DeadReckoner(leftEncoder, rightEncoder)
{
	rightMotorSetting = 0.0;
	leftMotorSetting = 0.0;
	SetExpiration(0.5);//changed from .1 to .5 for debuging

	speedMatchLeftCounterStart = 0;
	speedMatchRightCounterStart = 0;
}
//************************************************************************
// Called when an LCD-button event is repeated
//************************************************************************
void CNotificationScreen::OnLCDButtonRepeated(int iButton)
{
	CScreen::OnLCDButtonDown(iButton);	
	if(m_MessageText.IsVisible()) {
		if(iButton == LGLCDBUTTON_BUTTON1 || iButton == LGLCDBUTTON_DOWN) {
			m_MessageText.ScrollDown();
		} else if(iButton == LGLCDBUTTON_BUTTON0 || iButton == LGLCDBUTTON_UP) {
			m_MessageText.ScrollUp();
		}
		SetExpiration(CConfig::GetIntSetting(NOTIFY_DURATION)*1000);
	}
}
//************************************************************************
// Called when an LCD-button is pressed
//************************************************************************
void CNotificationScreen::OnLCDButtonDown(int iButton)
{
	CScreen::OnLCDButtonDown(iButton);	

	if(m_MessageText.IsVisible() &&
		( iButton <= 1 || iButton >=4))
	{
		if(iButton== 1 || iButton == 5)
			m_MessageText.ScrollDown();
		else
			m_MessageText.ScrollUp();

		SetExpiration(CConfig::GetIntSetting(NOTIFY_DURATION)*1000);
	}
	else if(iButton == 2 && m_LNotifications.size() >= 1)
	{
		CNotificationEntry *pEntry = *(m_LNotifications.begin());
		m_LNotifications.pop_front();
		
		if(m_LNotifications.size() >= 1)
			SetButtonBitmap(2,IDB_NEXT);
		else
			SetButtonBitmap(2,NULL);

		DisplayNotification(pEntry);
		SetExpiration(CConfig::GetIntSetting(NOTIFY_DURATION)*1000);
	}
	else if(iButton == 3 && m_pEntry && m_pEntry->pContact)
	{
		SetExpiration(0);

		CLCDConnection *pLCDCon =  CAppletManager::GetInstance()->GetLCDConnection();
		pLCDCon->SetAsForeground(1);
		pLCDCon->SetAsForeground(0);
		CAppletManager::GetInstance()->ActivateChatScreen(m_pEntry->pContact,m_pEntry->iConnectionID);
	}
	else
		SetExpiration(0);
}
//************************************************************************
// Called when an LCD-button event is repeated
//************************************************************************
void CNotificationScreen::OnLCDButtonRepeated(int iButton)
{
	CScreen::OnLCDButtonDown(iButton);	
	if(m_MessageText.IsVisible() &&
		iButton <= 1)
	{
		if(iButton== 1)
			m_MessageText.ScrollDown();
		else
			m_MessageText.ScrollUp();

		SetExpiration(CConfig::GetIntSetting(NOTIFY_DURATION)*1000);
	}
}
//************************************************************************
// Called when an LCD-button is pressed
//************************************************************************
void CNotificationScreen::OnLCDButtonDown(int iButton)
{
	CScreen::OnLCDButtonDown(iButton);	

	if((iButton == LGLCDBUTTON_BUTTON2 || iButton == LGLCDBUTTON_RIGHT) && m_LNotifications.size() >= 1)
	{
		CNotificationEntry *pEntry = *(m_LNotifications.begin());
		m_LNotifications.pop_front();
		
		if(m_LNotifications.size() >= 1)
			SetButtonBitmap(2,IDB_NEXT);
		else
			SetButtonBitmap(2,NULL);

		DisplayNotification(pEntry);
		SetExpiration(CConfig::GetIntSetting(NOTIFY_DURATION)*1000);
	}
	else if((iButton == LGLCDBUTTON_BUTTON3 || iButton == LGLCDBUTTON_OK) && m_pEntry && m_pEntry->hContact)
	{
		SetExpiration(0);

		CLCDConnection *pLCDCon =  CAppletManager::GetInstance()->GetLCDConnection();
		pLCDCon->SetAsForeground(1);
		pLCDCon->SetAsForeground(0);
		CAppletManager::GetInstance()->ActivateChatScreen(m_pEntry->hContact);
	} else if(!m_MessageText.IsVisible()) {
		SetExpiration(0);
	} else {
		if(iButton == LGLCDBUTTON_BUTTON1 || iButton == LGLCDBUTTON_DOWN) {
			m_MessageText.ScrollDown();
		} else if(iButton == LGLCDBUTTON_BUTTON0 || iButton == LGLCDBUTTON_UP) {
			m_MessageText.ScrollUp();
		}
		SetExpiration(CConfig::GetIntSetting(NOTIFY_DURATION)*1000);
	}	
}
Exemple #11
0
BOOL CEzLcd::Connect()
{
	if (!m_initNeeded)
		return true;

	SetExpiration(INFINITE);

	m_output.AddScreen(this);

	// Setup registration and configure contexts.
	lgLcdConnectContext lgdConnectContext;
	lgLcdConfigureContext lgdConfigureContext;

	// Further expansion of registration and configure contexts.
	lgdConfigureContext.configCallback = NULL;

	lgdConnectContext.appFriendlyName = m_friendlyName;
	lgdConnectContext.isPersistent = FALSE;
	lgdConnectContext.isAutostartable = FALSE;
	lgdConnectContext.onConfigure = lgdConfigureContext;

	if (FAILED(m_output.Initialize(&lgdConnectContext, FALSE)))
	{
		// This means the LCD SDK's lgLcdInit failed, and therefore
		// we will not be able to ever connect to the LCD, even if
		// a G-series keyboard is actually connected.
		m_initSucceeded = FALSE;
	}
	else
	{
		m_output.LockScreen(this);
		m_initSucceeded = TRUE;
	}

	m_initNeeded = FALSE;
	m_output.EnumerateDevices();
	return IsConnected();
}