コード例 #1
0
static void
bigboard_button_applet_realized (PanelApplet *applet,
                                 gpointer     data)
{
        ButtonData *button_data;
        GdkScreen       *screen;

        button_data = (ButtonData *) data;

        if (button_data->icon_theme != NULL)
                g_signal_handlers_disconnect_by_func (button_data->icon_theme,
                                                      theme_changed_callback,
                                                      button_data);

        screen = gtk_widget_get_screen (button_data->applet);

        button_data->icon_theme = gtk_icon_theme_get_for_screen (screen);
        wncklet_connect_while_alive (button_data->icon_theme, "changed",
                                     G_CALLBACK (theme_changed_callback),
                                     button_data,
                                     button_data->applet);

        button_data->suppress_popout_set = TRUE;
        update_button_state (button_data);
        button_data->suppress_popout_set = FALSE;
}
コード例 #2
0
ファイル: showdesktop.c プロジェクト: oz123/mate-panel
static void show_desktop_changed_callback(MatewnckScreen* screen, ShowDesktopData* sdd)
{
	if (sdd->matewnck_screen != NULL)
		sdd->showing_desktop = matewnck_screen_get_showing_desktop(sdd->matewnck_screen);

	update_button_state (sdd);
}
コード例 #3
0
ファイル: comms.c プロジェクト: Cheeseness/hidden-star
void comms_setup_intro()
{
	Travel_Node *t = (Travel_Node *)vector_get(starmap, current_node);
	int w=(int)(pow(2,(t->p->size+3)));
	int h=w;
	comms_subject_pos[0] = -w;
	comms_subject_pos[1] = h = 32 - h / 2;
	comms_subject_final_pos = 64 - w * 0.75;

	//comms_intro_text = ">incoming signal from ";
	SDL_QueryTexture(portrait_background, NULL, NULL, &w, &h);
	comms_portrait_background_pos[0] = 2;
	comms_portrait_background_pos[1] = -h;
	comms_portrait_background_final_pos = 0;

	comms_text_offset = h + 1;

	comms_portrait_pos[0] = 2;
	comms_portrait_pos[1] = 0;

	comms_state = COMMS_STATE_INTRO;
	current_npc_text = 0;
	current_player_choice = 0;
	gui_clear();

	int default_button;
	default_button = gui_add_symbol_button(SYMBOL_ARROW_RIGHT, 64 - 9, 64 - 9, -1, BUTTON_STATE_ENABLED, BUTTON_STYLE_GUI, -1, &comms_skip, -1, NULL, -1, NULL, -1);
	update_button_state(default_button, BUTTON_STATE_SELECTED);
}
コード例 #4
0
ファイル: comms.c プロジェクト: Cheeseness/hidden-star
void comms_setup_player_choices()
{
	comms_state = COMMS_STATE_PLAYER_CHOICE;
	current_player_choice = ((Comms_NPCDialogue *)vector_get(&comms_current_npc_lines, current_npc_text))->next_state_index;
	comms_subject_pos[0] = comms_subject_final_pos;
	comms_portrait_background_pos[1] = comms_portrait_background_final_pos;
	current_npc_text = ((Comms_NPCDialogue *)vector_get(&comms_current_npc_lines, current_npc_text))->next_state_index;

	gui_clear();

	int default_button;
	
	Comms_PlayerChoice * pc = (Comms_PlayerChoice *)vector_get(&comms_player_choices, current_player_choice);
	
	default_button = gui_add_text_button(pc->text0, 0, comms_text_offset - 2, 35, BUTTON_STATE_ENABLED, BUTTON_STYLE_MENU, -1, &comms_action, pc->choice0, NULL, -1, NULL, -1);

	if (pc->text1 != NULL)
	{
		gui_add_text_button(pc->text1, 0, comms_text_offset + 5, 35, BUTTON_STATE_ENABLED, BUTTON_STYLE_MENU, -1, &comms_action, pc->choice1, NULL, -1, NULL, -1);

		if (pc->text2 != NULL)
		{
			gui_add_text_button(pc->text2, 0, comms_text_offset + 12, 35, BUTTON_STATE_ENABLED, BUTTON_STYLE_MENU, -1, &comms_action, pc->choice2, NULL, -1, NULL, -1);

			if (pc->text3 != NULL)
			{
				gui_add_text_button(pc->text3, 0, comms_text_offset + 19, 35, BUTTON_STATE_ENABLED, BUTTON_STYLE_MENU, -1, &comms_action, pc->choice3, NULL, -1, NULL, -1);
			}
		}
	}
	update_button_state(default_button, BUTTON_STATE_SELECTED);
}
コード例 #5
0
void GroupFlagsWidget::setFlags(FileStorageFlags flags)
{
    for(int i=0;i<3;++i)
	{
		_buttons[i]->setChecked(flags & _flags[i]) ;
		update_button_state(_buttons[i]->isChecked(),i) ;
	}
}
コード例 #6
0
static void
update_showing_bigboard (ButtonData        *button_data,
                         gboolean           showing_bigboard)
{
        if ((showing_bigboard != FALSE) == button_data->showing_bigboard)
                return;
        
        button_data->showing_bigboard = showing_bigboard != FALSE;
        g_debug("Set showing_bigboard=%d", button_data->showing_bigboard);
        
        update_button_state (button_data);
}
コード例 #7
0
ファイル: comms.c プロジェクト: Cheeseness/hidden-star
void comms_setup_npc_text()
{
	comms_state = COMMS_STATE_NPC_TEXT;
	comms_subject_pos[0] = comms_subject_final_pos;
	Travel_Node *t = (Travel_Node *)vector_get(starmap, current_node);
	t->p->x=comms_subject_final_pos;
	comms_portrait_background_pos[1] = comms_portrait_background_final_pos;
	gui_clear();

	int default_button;
	default_button = gui_add_symbol_button(SYMBOL_ARROW_RIGHT, 64 - 9, 64 - 9, -1, BUTTON_STATE_ENABLED, BUTTON_STYLE_GUI, -1, &comms_skip, -1, NULL, -1, NULL, -1);
	update_button_state(default_button, BUTTON_STATE_SELECTED);
}
コード例 #8
0
static gboolean toggle_show_desktop(GtkWidget *widget, gpointer data)
{
        ShowDesktop *sd = (ShowDesktop *) data;
        gboolean show_desktop_flag;
        
        show_desktop_flag = !sd->is_showing_desktop;
        
        if (!sd->lock) {
                update_button_state(sd, show_desktop_flag);
                show_desktop(sd, show_desktop_flag);
        	update_tooltip(sd);
        }

	return TRUE;
}
コード例 #9
0
ファイル: wpad_driver.c プロジェクト: DSkywalk/RetroArch
static void wpad_poll(void)
{
   VPADStatus vpad;
   VPADReadError error;

   VPADRead(PAD_GAMEPAD, &vpad, 1, &error);

   if (error)
      return;

   update_button_state(&button_state, vpad.hold);
   update_analog_state(analog_state, &vpad);
   update_touch_state(analog_state, &button_state, &vpad);
   check_panic_button(vpad.hold);
}
コード例 #10
0
/*QString GroupFlagsWidget::_tooltips_on[4] = {
	QObject::tr("Directory is browsable for friends from groups"),
	QObject::tr("Directory is accessible by anonymous tunnels from friends from groups"),
	QObject::tr("Directory is browsable for any friend"),
	QObject::tr("Directory is accessible by anonymous tunnels from any friend") 
};
QString GroupFlagsWidget::_tooltips_off[4] = {
	QObject::tr("Directory is NOT browsable for friends from groups"),
	QObject::tr("Directory is NOT accessible by anonymous tunnels from friends from groups"),
	QObject::tr("Directory is NOT browsable for any friend"),
	QObject::tr("Directory is NOT accessible by anonymous tunnels from any friend")
};
*/
GroupFlagsWidget::GroupFlagsWidget(QWidget *parent,FileStorageFlags flags)
	: QWidget(parent)
{
	_layout = new QHBoxLayout(this) ;

    setMinimumSize(128 * QFontMetricsF(font()).height()/14.0,32 * QFontMetricsF(font()).height()/14.0) ;
    setMaximumSize(128 * QFontMetricsF(font()).height()/14.0,32 * QFontMetricsF(font()).height()/14.0) ;
	setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);

	_icons[INDEX_GROUP_BROWSABLE] = new QIcon(FLAGS_GROUP_BROWSABLE_ICON) ;
	_icons[INDEX_GROUP_NETWORK_W] = new QIcon(FLAGS_GROUP_NETWORK_WIDE_ICON) ;
	_icons[INDEX_OTHER_BROWSABLE] = new QIcon(FLAGS_OTHER_BROWSABLE_ICON) ;
	_icons[INDEX_OTHER_NETWORK_W] = new QIcon(FLAGS_OTHER_NETWORK_WIDE_ICON) ;
	_icons[INDEX_GROUP_UNCHECKED] = new QIcon(FLAGS_GROUP_UNCHECKED) ;
	_icons[INDEX_OTHER_UNCHECKED] = new QIcon(FLAGS_OTHER_UNCHECKED) ;

	setLayout(_layout) ;

	_flags[0] = DIR_FLAGS_BROWSABLE_GROUPS ;
	_flags[1] = DIR_FLAGS_NETWORK_WIDE_GROUPS ;
	_flags[2] = DIR_FLAGS_BROWSABLE_OTHERS ;
	_flags[3] = DIR_FLAGS_NETWORK_WIDE_OTHERS ;

	for(int i=0;i<4;++i)
	{
		_buttons[i] = new QPushButton(this) ;
		_buttons[i]->setCheckable(true) ;
		_buttons[i]->setChecked(flags & _flags[i]) ;
        _buttons[i]->setIconSize(QSize(32 * QFontMetricsF(font()).height()/14.0,32 * QFontMetricsF(font()).height()/14.0));
		update_button_state(_buttons[i]->isChecked(),i) ;
		_layout->addWidget(_buttons[i]) ;
	}
	_buttons[INDEX_GROUP_NETWORK_W]->setHidden(true);
		
	connect(_buttons[INDEX_GROUP_NETWORK_W],SIGNAL(toggled(bool)),this,SLOT(update_GN_button(bool))) ;
	connect(_buttons[INDEX_OTHER_NETWORK_W],SIGNAL(toggled(bool)),this,SLOT(update_ON_button(bool))) ;
	connect(_buttons[INDEX_GROUP_BROWSABLE],SIGNAL(toggled(bool)),this,SLOT(update_GB_button(bool))) ;
	connect(_buttons[INDEX_OTHER_BROWSABLE],SIGNAL(toggled(bool)),this,SLOT(update_OB_button(bool))) ;

	_layout->setSpacing(0);
	_layout->setContentsMargins(0, 0, 0, 0);

	_layout->update() ;
}
コード例 #11
0
/*QString GroupFlagsWidget::_tooltips_on[4] = {
    QObject::tr("Directory is visible to friends"),
    QObject::tr("Directory can be search anonymously"),
    QObject::tr("Directory is accessible by anonymous tunnels")
};
QString GroupFlagsWidget::_tooltips_off[4] = {
    QObject::tr("Directory is not visible to friends"),
    QObject::tr("Directory cannot be searched anonymously"),
    QObject::tr("Directory is NOT accessible by anonymous tunnels")
};
*/
GroupFlagsWidget::GroupFlagsWidget(QWidget *parent,FileStorageFlags flags)
	: QWidget(parent)
{
	_layout = new QHBoxLayout(this) ;

    setMinimumSize(128 * QFontMetricsF(font()).height()/14.0,32 * QFontMetricsF(font()).height()/14.0) ;
    setMaximumSize(128 * QFontMetricsF(font()).height()/14.0,32 * QFontMetricsF(font()).height()/14.0) ;
	setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);

    _icons[2*INDEX_BROWSABLE+0]   = new QIcon(FLAGS_BROWSABLE_OFF) ;
    _icons[2*INDEX_BROWSABLE+1]    = new QIcon(FLAGS_BROWSABLE_ON) ;
    _icons[2*INDEX_ANON_SEARCH+0] = new QIcon(FLAGS_ANONYMOUS_SEARCH_OFF) ;
    _icons[2*INDEX_ANON_SEARCH+1]  = new QIcon(FLAGS_ANONYMOUS_SEARCH_ON) ;
    _icons[2*INDEX_ANON_DL+0]     = new QIcon(FLAGS_ANONYMOUS_DL_OFF) ;
    _icons[2*INDEX_ANON_DL+1]      = new QIcon(FLAGS_ANONYMOUS_DL_ON) ;

	setLayout(_layout) ;

    _flags[INDEX_BROWSABLE  ] = DIR_FLAGS_BROWSABLE ;
    _flags[INDEX_ANON_SEARCH] = DIR_FLAGS_ANONYMOUS_SEARCH ;
    _flags[INDEX_ANON_DL    ] = DIR_FLAGS_ANONYMOUS_DOWNLOAD ;

    for(int i=0;i<3;++i)
	{
		_buttons[i] = new QPushButton(this) ;
		_buttons[i]->setCheckable(true) ;
		_buttons[i]->setChecked(flags & _flags[i]) ;
        _buttons[i]->setIconSize(QSize(32 * QFontMetricsF(font()).height()/14.0,32 * QFontMetricsF(font()).height()/14.0));

		update_button_state(_buttons[i]->isChecked(),i) ;
		_layout->addWidget(_buttons[i]) ;
	}
		
    connect(_buttons[INDEX_ANON_DL    ],SIGNAL(toggled(bool)),this,SLOT(update_DL_button(bool))) ;
    connect(_buttons[INDEX_ANON_SEARCH],SIGNAL(toggled(bool)),this,SLOT(update_SR_button(bool))) ;
    connect(_buttons[INDEX_BROWSABLE  ],SIGNAL(toggled(bool)),this,SLOT(update_BR_button(bool))) ;

	_layout->setSpacing(0);
	_layout->setContentsMargins(0, 0, 0, 0);

	_layout->update() ;
}
コード例 #12
0
static void show_desktop_changed(WnckScreen *screen)
{
        ShowDesktop *sd;

        sd = (ShowDesktop *) g_object_get_data(G_OBJECT(screen), "sd");
        
        g_signal_handlers_block_by_func(G_OBJECT(screen),
                                        G_CALLBACK(show_desktop_changed),
                                        NULL);
       
        sd->lock = TRUE;
        
        sd->is_showing_desktop = wnck_screen_get_showing_desktop(screen);
        update_button_state(sd, sd->is_showing_desktop);
        update_tooltip(sd);
        
        sd->lock = FALSE;
        
        g_signal_handlers_unblock_by_func(G_OBJECT(screen),
                                          G_CALLBACK(show_desktop_changed),
                                          NULL);
}
コード例 #13
0
ファイル: dialog.cpp プロジェクト: kangear/DebuggingAssistant
void Dialog::update_ui()
{
    check_if_can_run(false);
    update_button_state(is_can_run, push_button, PUSH_BUTTON_MAX_NUMBER);
    update_target_product_path();
}
コード例 #14
0
void GroupFlagsWidget::update_GN_button(bool b) { update_button_state(b,INDEX_GROUP_NETWORK_W) ; updated() ; }
コード例 #15
0
void GroupFlagsWidget::update_BR_button(bool b) { update_button_state(b,INDEX_BROWSABLE  ) ; updated() ; }
コード例 #16
0
void GroupFlagsWidget::update_SR_button(bool b) { update_button_state(b,INDEX_ANON_SEARCH) ; updated() ; }
コード例 #17
0
void GroupFlagsWidget::update_DL_button(bool b) { update_button_state(b,INDEX_ANON_DL    ) ; updated() ; }
コード例 #18
0
void GroupFlagsWidget::update_ON_button(bool b) { update_button_state(b,INDEX_OTHER_NETWORK_W) ; updated() ; }
コード例 #19
0
void ClientPSNaviView::ApplyControllerDataFrame(const PSMoveProtocol::DeviceOutputDataFrame_ControllerDataPacket *data_frame)
{
    if (data_frame->isconnected())
    {
        const PSMoveProtocol::DeviceOutputDataFrame_ControllerDataPacket_PSNaviState &psnavi_data_frame= data_frame->psnavi_state();

        unsigned int button_bitmask= data_frame->button_down_bitmask();
        update_button_state(L1Button, button_bitmask, PSMoveProtocol::DeviceOutputDataFrame_ControllerDataPacket_ButtonType_L1);
        update_button_state(L2Button, button_bitmask, PSMoveProtocol::DeviceOutputDataFrame_ControllerDataPacket_ButtonType_L2);
        update_button_state(L3Button, button_bitmask, PSMoveProtocol::DeviceOutputDataFrame_ControllerDataPacket_ButtonType_L3);
        update_button_state(CircleButton, button_bitmask, PSMoveProtocol::DeviceOutputDataFrame_ControllerDataPacket_ButtonType_CIRCLE);
        update_button_state(CrossButton, button_bitmask, PSMoveProtocol::DeviceOutputDataFrame_ControllerDataPacket_ButtonType_CROSS);
        update_button_state(PSButton, button_bitmask, PSMoveProtocol::DeviceOutputDataFrame_ControllerDataPacket_ButtonType_PS);
        update_button_state(TriggerButton, button_bitmask, PSMoveProtocol::DeviceOutputDataFrame_ControllerDataPacket_ButtonType_TRIGGER);
        update_button_state(DPadUpButton, button_bitmask, PSMoveProtocol::DeviceOutputDataFrame_ControllerDataPacket_ButtonType_UP);
        update_button_state(DPadRightButton, button_bitmask, PSMoveProtocol::DeviceOutputDataFrame_ControllerDataPacket_ButtonType_RIGHT);
        update_button_state(DPadDownButton, button_bitmask, PSMoveProtocol::DeviceOutputDataFrame_ControllerDataPacket_ButtonType_DOWN);
        update_button_state(DPadLeftButton, button_bitmask, PSMoveProtocol::DeviceOutputDataFrame_ControllerDataPacket_ButtonType_LEFT);

        //###bwalker $TODO make sure this is in the range [0, 255]
        this->TriggerValue= static_cast<unsigned char>(psnavi_data_frame.trigger_value());
        this->Stick_XAxis= static_cast<unsigned char>(psnavi_data_frame.stick_xaxis());
        this->Stick_YAxis= static_cast<unsigned char>(psnavi_data_frame.stick_yaxis());

        this->bValid= true;
    }
    else
    {
        Clear();
    }
}
コード例 #20
0
main(void) {  // {{{
	uchar sensor_probe_counter = 0;
	uchar timer_overflow = 0;

#if ENABLE_IDLE_RATE
	int idle_counter = 0;
#endif

	cli();

	hardware_init();

#if ENABLE_KEYBOARD
	init_keyboard_emulation();
	init_ui_system();
#endif
#if ENABLE_MOUSE
	init_mouse_emulation();
#endif

	TWI_Master_Initialise();
	usbInit();
	init_int_eeprom();
	init_button_state();

	wdt_reset();
	sei();

	// Sensor initialization must be done with interrupts enabled!
	// It uses I2C (TWI) to configure the sensor.
	sensor_init_configuration();

	LED_TURN_ON(GREEN_LED);

	for (;;) {	// main event loop
		wdt_reset();
		usbPoll();

		if (TIFR & (1<<TOV0)) {
			timer_overflow = 1;

			// Resetting the Timer0
			// Setting this bit to one will clear it.
			TIFR = 1<<TOV0;
		} else {
			timer_overflow = 0;
		}

		update_button_state(timer_overflow);

		// Red LED lights up if there is any kind of error in I2C communication
		if ( TWI_statusReg.lastTransOK ) {
			LED_TURN_OFF(RED_LED);
		} else {
			LED_TURN_ON(RED_LED);
		}

		// Handling the state change of the main switch
		if (ON_KEY_UP(BUTTON_SWITCH)) {
			// Upon releasing the switch, stop the continuous reading.
			sensor_stop_continuous_reading();

#if ENABLE_KEYBOARD
			// And also reset the menu system.
			init_ui_system();
#endif
		} else if (ON_KEY_DOWN(BUTTON_SWITCH)) {
			// Upon pressing the switch, start the continuous reading for
			// mouse emulation code.
			sensor_start_continuous_reading();
		}

		// Continuous reading of sensor data
		if (sensor.continuous_reading) {  // {{{
			// Timer is set to 1.365ms
			if (timer_overflow) {
				// The sensor is configured for 75Hz measurements.
				// I'm using this timer to read the values twice that rate.
				// 5 * 1.365ms = 6.827ms ~= 146Hz
				if (sensor_probe_counter > 0){
					// Waiting...
					sensor_probe_counter--;
				}
			}
			if (sensor_probe_counter == 0) {
				// Time for reading new data!
				uchar return_code;

				return_code = sensor_read_data_registers();
				if (return_code == SENSOR_FUNC_DONE || return_code == SENSOR_FUNC_ERROR) {
					// Restart the counter+timer
					sensor_probe_counter = 5;
				}
			}
		}  // }}}

#if ENABLE_IDLE_RATE
		// Timer is set to 1.365ms
		if (timer_overflow) {  // {{{
			// Implementing the idle rate...
			if (idle_rate != 0) {
				if (idle_counter > 0){
					idle_counter--;
				} else {
					// idle_counter counts how many Timer0 overflows are
					// required before sending another report.
					// The exact formula is:
					// idle_counter = (idle_rate * 4)/1.365;
					// But it's better to avoid floating point math.
					// 4/1.365 = 2.93, so let's just multiply it by 3.
					idle_counter = idle_rate * 3;

					//keyDidChange = 1;
					LED_TOGGLE(YELLOW_LED);
					// TODO: Actually implement idle rate... Should re-send
					// the current status.
				}
			}
		}  // }}}
#endif

		// MAIN code. Code that emulates the mouse or implements the menu
		// system.
		if (button.state & BUTTON_SWITCH) {
			// Code for when the switch is held down
			// Should read data and do things

#if ENABLE_MOUSE
			// nothing here
#endif
		} else {
			// Code for when the switch is "off"
			// Basically, this is the menu system (implemented as keyboard)

#if ENABLE_KEYBOARD
			ui_main_code();
#endif
		}

		// Sending USB Interrupt-in report
		if(usbInterruptIsReady()) {
			if (0) {
				// This useless "if" is here to make all the following
				// conditionals an "else if", and thus making it a lot
				// easier to add/remove them using preprocessor directives.
			}
#if ENABLE_KEYBOARD
			else if(string_output_pointer != NULL){
				// Automatically send keyboard report if there is something
				// in the buffer
				send_next_char();
				usbSetInterrupt((void*) &keyboard_report, sizeof(keyboard_report));
			}
#endif
#if ENABLE_MOUSE
			else if (button.state & BUTTON_SWITCH) {
				if (mouse_prepare_next_report()) {
					usbSetInterrupt((void*) &mouse_report, sizeof(mouse_report));
				}
			}
#endif
		}
	}
}  // }}}
コード例 #21
0
void ClientPSMoveView::ApplyControllerDataFrame(
    const PSMoveProtocol::DeviceOutputDataFrame_ControllerDataPacket *data_frame)
{
    if (data_frame->isconnected())
    {
        const auto &psmove_data_frame = data_frame->psmove_state();

        this->bHasValidHardwareCalibration= psmove_data_frame.validhardwarecalibration();
        this->bIsTrackingEnabled= psmove_data_frame.istrackingenabled();
        this->bIsCurrentlyTracking= psmove_data_frame.iscurrentlytracking();

        this->Pose.Orientation.w= psmove_data_frame.orientation().w();
        this->Pose.Orientation.x= psmove_data_frame.orientation().x();
        this->Pose.Orientation.y= psmove_data_frame.orientation().y();
        this->Pose.Orientation.z= psmove_data_frame.orientation().z();

        this->Pose.Position.x= psmove_data_frame.position().x();
        this->Pose.Position.y= psmove_data_frame.position().y();
        this->Pose.Position.z= psmove_data_frame.position().z();

        if (psmove_data_frame.has_raw_sensor_data())
        {
            const auto &raw_sensor_data = psmove_data_frame.raw_sensor_data();

            this->RawSensorData.Magnetometer.i= raw_sensor_data.magnetometer().i();
            this->RawSensorData.Magnetometer.j= raw_sensor_data.magnetometer().j();
            this->RawSensorData.Magnetometer.k= raw_sensor_data.magnetometer().k();

            this->RawSensorData.Accelerometer.i= raw_sensor_data.accelerometer().i();
            this->RawSensorData.Accelerometer.j= raw_sensor_data.accelerometer().j();
            this->RawSensorData.Accelerometer.k= raw_sensor_data.accelerometer().k();

            this->RawSensorData.Gyroscope.i= raw_sensor_data.gyroscope().i();
            this->RawSensorData.Gyroscope.j= raw_sensor_data.gyroscope().j();
            this->RawSensorData.Gyroscope.k= raw_sensor_data.gyroscope().k();
        }
        else
        {
            this->RawSensorData.Clear();
        }

        if (psmove_data_frame.has_raw_tracker_data())
        {
            const auto &raw_tracker_data = psmove_data_frame.raw_tracker_data();

            this->RawTrackerData.ValidTrackerLocations = 
                std::min(raw_tracker_data.valid_tracker_count(), PSMOVESERVICE_MAX_TRACKER_COUNT);

            for (int listIndex = 0; listIndex < this->RawTrackerData.ValidTrackerLocations; ++listIndex)
            {
                const PSMoveProtocol::Pixel &locationOnTracker = raw_tracker_data.screen_locations(listIndex);
                const PSMoveProtocol::Position &positionOnTracker = raw_tracker_data.relative_positions(listIndex);

                this->RawTrackerData.TrackerIDs[listIndex]= raw_tracker_data.tracker_ids(listIndex);
                this->RawTrackerData.ScreenLocations[listIndex] =
                    PSMoveScreenLocation::create(locationOnTracker.x(), locationOnTracker.y());
                this->RawTrackerData.RelativePositions[listIndex] =
                    PSMovePosition::create(
                        positionOnTracker.x(), positionOnTracker.y(), positionOnTracker.z());

                if (raw_tracker_data.projected_spheres_size() > 0)
                {
                    const PSMoveProtocol::Ellipse &protocolEllipse = raw_tracker_data.projected_spheres(listIndex);
                    PSMoveTrackingProjection &projection= this->RawTrackerData.TrackingProjections[listIndex];

                    projection.shape.ellipse.center.x = protocolEllipse.center().x();
                    projection.shape.ellipse.center.y = protocolEllipse.center().y();
                    projection.shape.ellipse.half_x_extent = protocolEllipse.half_x_extent();
                    projection.shape.ellipse.half_y_extent = protocolEllipse.half_y_extent();
                    projection.shape.ellipse.angle = protocolEllipse.angle();
                    projection.shape_type = PSMoveTrackingProjection::eShapeType::Ellipse;
                }
                else if (raw_tracker_data.projected_blobs_size() > 0)
                {
                    const PSMoveProtocol::Polygon &protocolPolygon = raw_tracker_data.projected_blobs(listIndex);
                    PSMoveTrackingProjection &projection = this->RawTrackerData.TrackingProjections[listIndex];

                    assert(protocolPolygon.vertices_size() == 4);
                    for (int vert_index = 0; vert_index < 4; ++vert_index)
                    {
                        const PSMoveProtocol::Pixel &pixel= protocolPolygon.vertices(vert_index);

                        projection.shape.quad.corners[vert_index].x = pixel.x();
                        projection.shape.quad.corners[vert_index].y = pixel.y();
                    }
                }
                else
                {
                    PSMoveTrackingProjection &projection = this->RawTrackerData.TrackingProjections[listIndex];

                    projection.shape_type = PSMoveTrackingProjection::eShapeType::INVALID_PROJECTION;
                }
            }            
        }
        else
        {
            this->RawTrackerData.Clear();
        }

        if (psmove_data_frame.has_physics_data())
        {
            const auto &raw_physics_data = psmove_data_frame.physics_data();

            this->PhysicsData.Velocity.i = raw_physics_data.velocity().i();
            this->PhysicsData.Velocity.j = raw_physics_data.velocity().j();
            this->PhysicsData.Velocity.k = raw_physics_data.velocity().k();

            this->PhysicsData.Acceleration.i = raw_physics_data.acceleration().i();
            this->PhysicsData.Acceleration.j = raw_physics_data.acceleration().j();
            this->PhysicsData.Acceleration.k = raw_physics_data.acceleration().k();

            this->PhysicsData.AngularVelocity.i = raw_physics_data.angular_velocity().i();
            this->PhysicsData.AngularVelocity.j = raw_physics_data.angular_velocity().j();
            this->PhysicsData.AngularVelocity.k = raw_physics_data.angular_velocity().k();

            this->PhysicsData.AngularAcceleration.i = raw_physics_data.angular_acceleration().i();
            this->PhysicsData.AngularAcceleration.j = raw_physics_data.angular_acceleration().j();
            this->PhysicsData.AngularAcceleration.k = raw_physics_data.angular_acceleration().k();
        }
        else
        {
            this->PhysicsData.Clear();
        }

        unsigned int button_bitmask= data_frame->button_down_bitmask();
        update_button_state(TriangleButton, button_bitmask, PSMoveProtocol::DeviceOutputDataFrame_ControllerDataPacket_ButtonType_TRIANGLE);
        update_button_state(CircleButton, button_bitmask, PSMoveProtocol::DeviceOutputDataFrame_ControllerDataPacket_ButtonType_CIRCLE);
        update_button_state(CrossButton, button_bitmask, PSMoveProtocol::DeviceOutputDataFrame_ControllerDataPacket_ButtonType_CROSS);
        update_button_state(SquareButton, button_bitmask, PSMoveProtocol::DeviceOutputDataFrame_ControllerDataPacket_ButtonType_SQUARE);
        update_button_state(SelectButton, button_bitmask, PSMoveProtocol::DeviceOutputDataFrame_ControllerDataPacket_ButtonType_SELECT);
        update_button_state(StartButton, button_bitmask, PSMoveProtocol::DeviceOutputDataFrame_ControllerDataPacket_ButtonType_START);
        update_button_state(PSButton, button_bitmask, PSMoveProtocol::DeviceOutputDataFrame_ControllerDataPacket_ButtonType_PS);
        update_button_state(MoveButton, button_bitmask, PSMoveProtocol::DeviceOutputDataFrame_ControllerDataPacket_ButtonType_MOVE);
        update_button_state(TriggerButton, button_bitmask, PSMoveProtocol::DeviceOutputDataFrame_ControllerDataPacket_ButtonType_TRIGGER);

        //###bwalker $TODO make sure this is in the range [0, 255]
        this->TriggerValue= static_cast<unsigned char>(psmove_data_frame.trigger_value());

        this->bValid= true;
    }
    else
    {
        Clear();
    }
}