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

Last change on this file since 127 was 38, checked in by Bayard Gildas, 8 years ago

Modif. pour ajour manette émulée (EmulatedController)

File size: 2.7 KB
Line 
1// %flair:license{
2// This file is part of the Flair framework distributed under the
3// CECILL-C License, Version 1.0.
4// %flair:license}
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 "TargetController.h"
21#include "JoyReference.h"
22#include <Tab.h>
23#include <FrameworkManager.h>
24#include <cvmatrix.h>
25#include <Ahrs.h>
26#include <AhrsData.h>
27#include <DataPlot1D.h>
28
29using std::string;
30using namespace flair::core;
31using namespace flair::filter;
32using namespace flair::gui;
33using namespace flair::sensor;
34
35namespace flair {
36namespace meta {
37
38MetaDualShock3::MetaDualShock3(FrameworkManager *parent, string name,
39 TargetController *controller)
40 : controller(controller),IODevice((IODevice*)controller, name) {
41 pimpl_ = new MetaDualShock3_impl(this, name);
42 parent->AddDeviceToLog(pimpl_->joy_ref);
43 controller->Start();
44}
45
46MetaDualShock3::~MetaDualShock3() { delete pimpl_; }
47
48AhrsData *MetaDualShock3::GetReferenceOrientation(void) const {
49 return pimpl_->joy_ref->GetReferenceOrientation();
50}
51
52void MetaDualShock3::ErrorNotify(void) {
53 controller->FlashLed(4,10,0);
54 controller->Rumble(0xff,20,0,0);
55}
56
57void MetaDualShock3::Rumble(uint8_t left_force,uint8_t left_timeout,uint8_t right_force,uint8_t right_timeout) {
58 controller->Rumble(left_force,left_timeout,right_force,right_timeout);
59}
60
61void MetaDualShock3::SetLedON(unsigned int ledId) {
62 controller->SetLedOn(ledId);
63}
64
65void MetaDualShock3::SetLedOFF(unsigned int ledId) {
66 controller->SetLedOff(ledId);
67}
68
69void MetaDualShock3::FlashLed(unsigned int ledId,uint8_t on_timeout,uint8_t off_timeout) {
70 controller->FlashLed(ledId,on_timeout,off_timeout);
71}
72
73float MetaDualShock3::ZRef(void) const { return pimpl_->joy_ref->ZRef(); }
74
75float MetaDualShock3::DzRef(void) const { return pimpl_->joy_ref->DzRef(); }
76
77void MetaDualShock3::SetYawRef(float value) {
78 pimpl_->joy_ref->SetYawRef(value);
79}
80
81void MetaDualShock3::SetYawRef(Quaternion const &value) {
82 pimpl_->joy_ref->SetYawRef(value);
83}
84
85void MetaDualShock3::SetZRef(float value) { pimpl_->joy_ref->SetZRef(value); }
86
87float MetaDualShock3::RollTrim(void) const {
88 return pimpl_->joy_ref->RollTrim();
89}
90
91float MetaDualShock3::PitchTrim(void) const {
92 return pimpl_->joy_ref->PitchTrim();
93}
94
95void MetaDualShock3::UpdateFrom(const flair::core::io_data *data) {
96 pimpl_->UpdateFrom(data);
97}
98
99} // end namespace meta
100} // end namespace flair
Note: See TracBrowser for help on using the repository browser.