Ejemplo n.º 1
0
MapWidget::MapWidget(QQuickItem* parent)
    : QQuickPaintedItem(parent),
      center(0.0,0.0),
      angle(0.0),
      magnification(64),
      requestNewMap(true)

{
    setOpaquePainting(true);
    setAcceptedMouseButtons(Qt::LeftButton);

    DBThread *dbThread=DBThread::GetInstance();
    //setFocusPolicy(Qt::StrongFocus);

    connect(dbThread,SIGNAL(InitialisationFinished(DatabaseLoadedResponse)),
            this,SLOT(initialisationFinished(DatabaseLoadedResponse)));

    connect(this,SIGNAL(TriggerMapRenderingSignal()),
            dbThread,SLOT(TriggerMapRendering()));

    connect(dbThread,SIGNAL(HandleMapRenderingResult()),
            this,SLOT(redraw()));

    connect(dbThread,SIGNAL(Redraw()),
            this,SLOT(redraw()));
}
Ejemplo n.º 2
0
static void hal_initialising_handler(Task task, MessageId id, Message message) {
	
	switch (id) {
		
		case PIO_RAW:
			{
				DEBUG(("hal initialising state, PIO_RAW message arrived...\n"));
			
				/** update charging state, and no check, even battery low we have nothing to do **/
				pio_raw_handler(message);
				update_indication();
			}
			break;			
		
		case BATTERY_READING_MESSAGE:
			{
				DEBUG(("hal warming-up state, BATTERY_READING_MESSAGE message arrived...\n"));
				/** update battery reading and no check, even battery low we have nothing to do **/
				if (hal.voltage == K_VoltageInit) {

					BatteryInit(&hal.battery_state, getHalTask(), BATTERY_READING_SOURCE, BATTERY_POLLING_PERIOD);
				}
				battery_message_handler(message);
				update_indication();
			}
			break;		
			
		case HAL_POWER_BUTTON_HELD_SHORT:
			{
				DEBUG(("hal initialising state, POWER_BUTTON_HELD_SHORT message arrived...\n"));
			
				/** let error mananger check initialization result, and determing the control flow **/
				initialisationFinished();
				hal_set_state(ACTIVATING);
			}
			break;
			
		case POWER_BUTTON_PRESS:
			
			DEBUG(("hal initialising state, POWER_BUTTON_PRESS message arrived...\n"));

			MessageSendLater(getHalTask(), HAL_POWER_BUTTON_HELD_SHORT, 0, 2000);
			MessageSendLater(getHalTask(), HAL_POWER_BUTTON_HELD_LONG, 0, 8000);
			break;

			
		case POWER_BUTTON_RELEASE:
			
			DEBUG(("hal initialising state, POWER_BUTTON_RELEASE message arrived...\n"));
			
			MessageCancelAll(getHalTask(), HAL_POWER_BUTTON_HELD_SHORT);
			MessageCancelAll(getHalTask(), HAL_POWER_BUTTON_HELD_LONG);
			break;
            
        case FUNCTION_BUTTON_DFU:
            
            DEBUG(("hal initialising state, FUNCTION_BUTTON_DFU message arrived...\n"));
            ledsPlay(BEEP_ONCE);/*if need beep we should add a timeout message then to enter DFU mode*/
            MessageSendLater(getHalTask(), HAL_FUNCTION_BUTTON_DFU_TIMEOUT, 0, BEEP_ONCE_DURATION + 100);
            break;
            
        case HAL_FUNCTION_BUTTON_DFU_TIMEOUT:
            
            DEBUG(("hal initialising state, HAL_FUNCTION_BUTTON_DFU_TIMEOUT message arrived...\n"));
            BootSetMode(0);
            break;            
			
		default:
			break;
	}
}