trikRuntime
mspI2cCommunicator.h
Go to the documentation of this file.
1 /* Copyright 2013 - 2015 Yurii Litvinov and CyberTech Labs Ltd.
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License. */
14 
15 #pragma once
16 
17 #include <QtCore/QString>
18 #include <QtCore/QMutex>
19 
21 
22 namespace trikKernel {
23 class Configurer;
24 }
25 
26 namespace trikHal {
27 class MspI2cInterface;
28 }
29 
30 namespace trikControl {
31 
34 {
35 public:
39 
40  ~MspI2cCommunicator() override;
41 
43  void send(const QByteArray &data) override;
44 
46  int read(const QByteArray &data) override;
47 
48  Status status() const override;
49 
50 private:
51  void disconnect();
52 
53  QMutex mLock;
55  DeviceState mState;
56 };
57 
58 }
Definition: analogSensor.h:23
Communicates with MSP processor over I2C bus.
Definition: mspI2cInterface.h:22
Generic configuration helper, parses configuration XML files and presents configuration as a set of a...
Definition: configurer.h:28
Provides direct interaction with I2C device.
Definition: mspI2cCommunicator.h:33
Helper class to track device state (off, starting, ready, stopping, fail).
Definition: deviceState.h:26
Status
Device status.
Definition: deviceInterface.h:33
Abstract interface for communication with MSP, may be implemented by I2C or USB buses, depending on current MSP configuration.
Definition: mspCommunicatorInterface.h:26
Definition: trikCommunicator.h:27
Definition: brickFactory.h:21