bool iWidgetCheckBox::handleMouseKeyUp(iKeyCode key) { if (!isActive()) { return false; } iWidget::handleMouseKeyUp(key); if (_widgetAppearanceState == iWidgetAppearanceState::Clicked) { if (_radioButtons.size()) { if (!isChecked()) { _checked = true; _change(this); for (int i = 0; i < _radioButtons.size(); ++i) { _radioButtons[i]->setChecked(false); } } } else { _checked = !_checked; _change(this); } return true; } return false; }
void echonode(void) { TiCc2420Adapter * cc; TiUartAdapter * uart; char * msg = "welcome to echonode..."; uint8 buf[BUF_SIZE]; uint8 len; target_init(); HAL_SET_PIN_DIRECTIONS(); wdt_disable(); led_on(LED_ALL); hal_delay( 500 ); led_off( LED_ALL ); cc = cc2420_construct( (void *)(&g_cc), sizeof(TiCc2420Adapter) ); uart = uart_construct( (void *)(&g_uart), sizeof(TiUartAdapter) ); uart_open( uart, 0, 38400, 8, 1, 0x00 ); uart_write( uart, msg, strlen(msg), 0x00 ); cc2420_open( cc, 0, NULL, NULL, 0x00 ); cc2420_setchannel( cc, DEFAULT_CHANNEL ); cc2420_setrxmode( cc ); // Enable RX cc2420_enable_addrdecode( cc ); // 使能地址译码 cc2420_setpanid( cc, PANID ); // 网络标识 cc2420_setshortaddress( cc, LOCAL_ADDRESS ); // 网内标识 hal_enable_interrupts(); while(1) { cc2420_evolve( cc ); len = cc2420_read( cc, (char*)(&buf[0]), BUF_SIZE, 0x00 ); if (len > 6) { uart_putchar( uart, '>' ); // switch source address and destination address _change(buf[3], buf[7]); _change(buf[4], buf[8]); _change(buf[5], buf[9]); _change(buf[6], buf[10]); buf[29] = 56; // simulate data read from sensor cc2420_write( cc, (char*)(&buf[0]), len, 0x00 ); hal_delay( 10 ); // @attention // You needn't call cc2420_setrxmode() here, because the hal_cc2420 // module will handle it inside. // cc2420_setrxmode( cc ); } } }
void iWidgetSelectBox::onSelectionChanged(int32 value) { if (value > -1) { _currentSelection = value; } _change(this); }
ProblemChange& Problem::change() { assert( initialized ); assert( maxCompVal>=curCompVal); if( curCompChange||maxCompVal==curCompVal ) incrementDirection(); ProblemChange *p; int changeFound=_change(&p); curCompVal++; if( changeFound==0 ) return change(); else return *p; }
void iWidgetCheckBox::setChecked(bool check) { _checked = check; _change(this); }
void Calendar::goRight() { _change(0, 0, 1); }
void Calendar::goDown() { _change(0, 0, 7); }
void Calendar::goUp() { _change(0, 0, -7); }
void Calendar::goLeft() { _change(0, 0, -1); }
void Calendar::prevMonth() { _change(0, -1, 0); }
void Calendar::nextMonth() { _change(0, 1, 0); }
void Calendar::prevYear() { _change(-1, 0, 0); }
void Calendar::nextYear() { _change(1, 0, 0); }