trikRuntime
i2cCommunicator.h
Go to the documentation of this file.
1 /* Copyright 2018 Aleksey Fefelov 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 
20 #include "deviceState.h"
21 
22 namespace trikKernel {
23 class Configurer;
24 }
25 
26 namespace trikHal {
27 class MspI2cInterface;
28 }
29 
30 namespace trikControl {
31 
34 {
35 public:
41  , uint8_t bus, uint8_t deviceId);
42 
43  ~I2cCommunicator();
44 
46  void send(const QByteArray &data);
47 
49  int read(const QByteArray &data);
50 
51  Status status() const override;
52 
53 private:
54  void disconnect();
55 
56  QMutex mLock;
58  DeviceState mState;
59 };
60 
61 }
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
Helper class to track device state (off, starting, ready, stopping, fail).
Definition: deviceState.h:26
Status
Device status.
Definition: deviceInterface.h:33
Definition: trikCommunicator.h:27
TRIK device interface, base interface for everything that can be plugged to a brick or already on boa...
Definition: deviceInterface.h:23
Definition: brickFactory.h:21
Implementation of i2c communicator.
Definition: i2cCommunicator.h:33