parts of p60dock handler
This commit is contained in:
12
bsp_linux/comIF/cookies/ArduinoCookie.cpp
Normal file
12
bsp_linux/comIF/cookies/ArduinoCookie.cpp
Normal file
@ -0,0 +1,12 @@
|
||||
//#include <mission/Arduino/ArduinoCookie.h>
|
||||
//
|
||||
//ArduinoCookie::ArduinoCookie(Protocol_t protocol, uint8_t address,
|
||||
// size_t maxReplySize) :
|
||||
// command(protocol), address(address), receivedDataLen(0), maxReplySize(
|
||||
// maxReplySize) {
|
||||
// replyBuffer = new uint8_t[maxReplySize];
|
||||
//}
|
||||
//
|
||||
//ArduinoCookie::~ArduinoCookie() {
|
||||
// delete[] replyBuffer;
|
||||
//}
|
25
bsp_linux/comIF/cookies/ArduinoCookie.h
Normal file
25
bsp_linux/comIF/cookies/ArduinoCookie.h
Normal file
@ -0,0 +1,25 @@
|
||||
//#ifndef MISSION_ARDUINO_ARDUINOCOOKIE_H_
|
||||
//#define MISSION_ARDUINO_ARDUINOCOOKIE_H_
|
||||
//
|
||||
//#include <framework/devicehandlers/Cookie.h>
|
||||
//
|
||||
//#include <stdint.h>
|
||||
//#include <stdlib.h>
|
||||
//
|
||||
//class ArduinoCookie: public Cookie {
|
||||
//public:
|
||||
// enum Protocol_t {
|
||||
// INVALID = 0, SPI = 1
|
||||
// };
|
||||
// ArduinoCookie(Protocol_t protocol, uint8_t address, size_t maxReplySize);
|
||||
// virtual ~ArduinoCookie();
|
||||
//
|
||||
// uint8_t command;
|
||||
// uint8_t address;
|
||||
// uint8_t *replyBuffer;
|
||||
// size_t receivedDataLen;
|
||||
// size_t maxReplySize;
|
||||
//
|
||||
//};
|
||||
//
|
||||
//#endif /* MISSION_ARDUINO_ARDUINOCOOKIE_H_ */
|
38
bsp_linux/comIF/cookies/P60DockCookie.cpp
Normal file
38
bsp_linux/comIF/cookies/P60DockCookie.cpp
Normal file
@ -0,0 +1,38 @@
|
||||
#include "bsp_linux/comIF/cookies/P60DockCookie.h"
|
||||
|
||||
|
||||
P60DockCookie::P60DockCookie(char* canInterface_, uint8_t cspAddress_) :
|
||||
canInterface(canInterface_), cspAddress(cspAddress_) {
|
||||
|
||||
}
|
||||
|
||||
P60DockCookie::~P60DockCookie() {
|
||||
}
|
||||
|
||||
uint8_t P60DockCookie::getCspAddress(){
|
||||
return cspAddress;
|
||||
}
|
||||
|
||||
char* P60DockCookie::getCanIf(){
|
||||
return canInterface;
|
||||
}
|
||||
|
||||
int P60DockCookie::getBitrate(){
|
||||
return bitrate;
|
||||
}
|
||||
|
||||
void P60DockCookie::setPingMessage(){
|
||||
nextMessage = PING;
|
||||
}
|
||||
|
||||
void P60DockCookie::setRebootMessage(){
|
||||
nextMessage = REBOOT;
|
||||
}
|
||||
|
||||
void P60DockCookie::setReadModuleCfgMessage(){
|
||||
nextMessage = READ_MODULE_CONFIG;
|
||||
}
|
||||
|
||||
MessageType_t P60DockCookie::getMessageType(){
|
||||
return nextMessage;
|
||||
}
|
49
bsp_linux/comIF/cookies/P60DockCookie.h
Normal file
49
bsp_linux/comIF/cookies/P60DockCookie.h
Normal file
@ -0,0 +1,49 @@
|
||||
#ifndef BSP_LINUX_COMIF_COOKIES_P60DockCookie_H_
|
||||
#define BSP_LINUX_COMIF_COOKIES_P60DockCookie_H_
|
||||
|
||||
#include <fsfw/devicehandlers/CookieIF.h>
|
||||
|
||||
typedef uint32_t MessageType_t;
|
||||
|
||||
/**
|
||||
* @brief This is the cookie for the communication interface to the cubesat
|
||||
* space protocol (CSP) implementation of gomspace. The communication
|
||||
* interface uses CAN as the physical layer. Therefore the cookie also
|
||||
* holds the CAN instance to use.
|
||||
* @author Jakob Meier
|
||||
*/
|
||||
class P60DockCookie: public CookieIF {
|
||||
public:
|
||||
/**
|
||||
* Constructor for the CSP cookie
|
||||
* @param canInterface_ The CAN interface to use. E.g. "can0" or "can1".
|
||||
* @param cspAddress_ The CSP address of the target device.
|
||||
*/
|
||||
P60DockCookie(char* canInterface_, uint8_t cspAddress_);
|
||||
virtual ~P60DockCookie();
|
||||
|
||||
uint8_t getCspAddress();
|
||||
char* getCanIf();
|
||||
int getBitrate();
|
||||
void setPingMessage();
|
||||
void setRebootMessage();
|
||||
void setReadModuleCfgMessage();
|
||||
MessageType_t getMessageType();
|
||||
|
||||
/* Message type defines the type of the next data transfer between the
|
||||
* CSP device and the OBC. */
|
||||
static const MessageType_t MESSAGE_NONE = 0x0;
|
||||
static const MessageType_t PING = 0x1;
|
||||
static const MessageType_t REBOOT = 0x4;
|
||||
static const MessageType_t READ_MODULE_CONFIG = 0x71;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
char* canInterface;
|
||||
uint8_t cspAddress;
|
||||
int bitrate = 1000;
|
||||
MessageType_t nextMessage = MESSAGE_NONE;
|
||||
};
|
||||
|
||||
#endif /* BSP_LINUX_COMIF_COOKIES_P60DockCookie_H_ */
|
Reference in New Issue
Block a user