source: flair-src/trunk/lib/FlairMeta/src/MetaDualShock3.cpp@ 36

Last change on this file since 36 was 15, checked in by Bayard Gildas, 9 years ago

sources reformatted with flair-format-dir script

File size: 2.7 KB
RevLine 
[10]1// %flair:license{
[15]2// This file is part of the Flair framework distributed under the
3// CECILL-C License, Version 1.0.
[10]4// %flair:license}
[7]5// created: 2014/01/14
6// filename: MetaDualShock3.cpp
7//
8// author: Guillaume Sanahuja
9// Copyright Heudiasyc UMR UTC/CNRS 7253
10//
11// version: $Id: $
12//
13// purpose: objet integrant la manette DualShock3 et les consignes joystick
14//
15//
16/*********************************************************************/
17
18#include "MetaDualShock3.h"
19#include "MetaDualShock3_impl.h"
20#include "JoyReference.h"
21#include <Tab.h>
22#include <FrameworkManager.h>
23#include <cvmatrix.h>
24#include <Ahrs.h>
25#include <AhrsData.h>
26#include <DataPlot1D.h>
27
28using std::string;
29using namespace flair::core;
30using namespace flair::filter;
31using namespace flair::gui;
32
[15]33namespace flair {
34namespace meta {
[7]35
[15]36MetaDualShock3::MetaDualShock3(FrameworkManager *parent, string name,
37 uint16_t port, uint8_t priority)
38 : TargetEthController(parent, name, port, priority) {
39 pimpl_ = new MetaDualShock3_impl(this, name);
40 parent->AddDeviceToLog(pimpl_->joy_ref);
41 Start();
[7]42}
43
[15]44MetaDualShock3::~MetaDualShock3() { delete pimpl_; }
[7]45
[15]46AhrsData *MetaDualShock3::GetReferenceOrientation(void) const {
47 return pimpl_->joy_ref->GetReferenceOrientation();
[7]48}
49
50void MetaDualShock3::ErrorNotify(void) {
[15]51 TargetEthController::FlashLed(4, 10, 0);
52 TargetEthController::Rumble(0xff, 20, 0, 0);
[7]53}
54
[15]55void MetaDualShock3::Rumble(uint8_t left_force, uint8_t left_timeout,
56 uint8_t right_force, uint8_t right_timeout) {
57 TargetEthController::Rumble(left_force, left_timeout, right_force,
58 right_timeout);
[7]59}
60
61void MetaDualShock3::SetLedON(unsigned int ledId) {
[15]62 TargetEthController::SetLedOn(ledId);
[7]63}
64
65void MetaDualShock3::SetLedOFF(unsigned int ledId) {
[15]66 TargetEthController::SetLedOff(ledId);
[7]67}
68
[15]69void MetaDualShock3::FlashLed(unsigned int ledId, uint8_t on_timeout,
70 uint8_t off_timeout) {
71 TargetEthController::FlashLed(ledId, on_timeout, off_timeout);
[7]72}
73
[15]74float MetaDualShock3::ZRef(void) const { return pimpl_->joy_ref->ZRef(); }
[7]75
[15]76float MetaDualShock3::DzRef(void) const { return pimpl_->joy_ref->DzRef(); }
[7]77
78void MetaDualShock3::SetYawRef(float value) {
[15]79 pimpl_->joy_ref->SetYawRef(value);
[7]80}
81
82void MetaDualShock3::SetYawRef(Quaternion const &value) {
[15]83 pimpl_->joy_ref->SetYawRef(value);
[7]84}
85
[15]86void MetaDualShock3::SetZRef(float value) { pimpl_->joy_ref->SetZRef(value); }
[7]87
88float MetaDualShock3::RollTrim(void) const {
[15]89 return pimpl_->joy_ref->RollTrim();
[7]90}
91
92float MetaDualShock3::PitchTrim(void) const {
[15]93 return pimpl_->joy_ref->PitchTrim();
[7]94}
95
96} // end namespace meta
97} // end namespace flair
Note: See TracBrowser for help on using the repository browser.