/* acc_open() * ===================================================================== * Accessory Open Messages * * IN: int *msg: message buffer; * OUT: void * * GLOBAL: WINFO w: window structure * int ctrl_id: application id */ void acc_open( const int *msg ) { if( msg[4] == ctrl_id ) { if( w.id == NO_WINDOW ) { if( xres >= MIN_RESOLUTION ) { if( Create_Window() ) { ActiveTree( ad_front ); initialize(); open_window(); Activity(); } else form_alert( 1, alert13 ); } else form_alert( 1, wider ); } else wind_set( w.id, WF_TOP ); } }
/* wind_init() * ===================================================================== * Initialize window structure. */ void wind_init( void ) { if(( AES_Version >= 0x0330 ) && ( gl_ncolors > LWHITE ) ) { Do3D(); } init_window(); if( _app ) { if( xres >= MIN_RESOLUTION ) { if( Create_Window() ) { ActiveTree( ad_front ); initialize(); open_window(); graf_mouse( ARROW, 0L ); Activity(); } else form_alert( 1, alert13 ); } else { form_alert( 1, wider ); gem_exit( 0 ); } } }
void cEITScanner::Process(void) { if (Setup.EPGScanTimeout || !lastActivity) { // !lastActivity means a scan was forced time_t now = time(NULL); if (now - lastScan > ScanTimeout && now - lastActivity > ActivityTimeout) { if (Channels.Lock(false, 10)) { if (!scanList) { scanList = new cScanList; if (transponderList) { scanList->AddTransponders(transponderList); delete transponderList; transponderList = NULL; } scanList->AddTransponders(&Channels); } bool AnyDeviceSwitched = false; for (int i = 0; i < cDevice::NumDevices(); i++) { cDevice *Device = cDevice::GetDevice(i); if (Device && Device->ProvidesEIT()) { for (cScanData *ScanData = scanList->First(); ScanData; ScanData = scanList->Next(ScanData)) { const cChannel *Channel = ScanData->GetChannel(); if (Channel) { if (!Channel->Ca() || Channel->Ca() == Device->DeviceNumber() + 1 || Channel->Ca() >= CA_ENCRYPTED_MIN) { if (Device->ProvidesTransponder(Channel)) { if (Device->Priority() < 0) { bool MaySwitchTransponder = Device->MaySwitchTransponder(Channel); if (MaySwitchTransponder || Device->ProvidesTransponderExclusively(Channel) && now - lastActivity > Setup.EPGScanTimeout * 3600) { if (!MaySwitchTransponder) { if (Device == cDevice::ActualDevice() && !currentChannel) { cDevice::PrimaryDevice()->StopReplay(); // stop transfer mode currentChannel = Device->CurrentChannel(); Skins.Message(mtInfo, tr("Starting EPG scan")); } } //dsyslog("EIT scan: device %d source %-8s tp %5d", Device->DeviceNumber() + 1, *cSource::ToString(Channel->Source()), Channel->Transponder()); Device->SwitchChannel(Channel, false); scanList->Del(ScanData); AnyDeviceSwitched = true; break; } } } } } } } } if (!scanList->Count() || !AnyDeviceSwitched) { delete scanList; scanList = NULL; if (lastActivity == 0) // this was a triggered scan Activity(); } Channels.Unlock(); } lastScan = time(NULL); } } }
void * UART_Get(void) { uart_tx_task(); // Rx Task static uint8_t rx_pos = 0; static uint8_t rx_len = 0; static MQ_t * pRx_buf; static uint32_t rx_wd = 0; while(hal_uart_datardy(UART_PHY_PORT)) { uint8_t data = hal_uart_get(UART_PHY_PORT); rx_wd = hal_get_ms() + 50; if(rx_len == 0) { if(data >= 2) { pRx_buf = mqAlloc(sizeof(MQ_t)); if(pRx_buf != NULL) rx_len = data; rx_pos = 0; } } else { if(rx_pos < sizeof(MQTTSN_MESSAGE_t)) pRx_buf->raw[rx_pos++] = data; if(rx_pos == rx_len) { memcpy(pRx_buf->phy1addr, (const void *)&uart_addr, sizeof(UART_ADDR_t)); pRx_buf->Length = rx_len; rx_len = 0; Activity(UART_PHY); return pRx_buf; } } } if((rx_len != 0) && (rx_wd < hal_get_ms())) rx_len = 0; return NULL; }
static void uart_tx_task(void) { static MQ_t * pTx_buf = NULL; if(hal_uart_free(UART_PHY_PORT)) { if(pTx_buf != NULL) { mqFree(pTx_buf); pTx_buf = NULL; } if(uart_tx_queue.Size != 0) { pTx_buf = mqDequeue(&uart_tx_queue); assert(pTx_buf != NULL); Activity(UART_PHY); hal_uart_send(UART_PHY_PORT, (pTx_buf->Length + 1), &pTx_buf->Length); } } }
Activity LearntConstraint::activity() const{ return Activity(0, (1u<<7)-1); }