CTRE Phoenix 6 C++ 25.0.0-beta-4
Loading...
Searching...
No Matches
Platform.hpp
Go to the documentation of this file.
1 /*
2 * Copyright (C) Cross The Road Electronics.  All rights reserved.
3 * License information can be found in CTRE_LICENSE.txt
4 * For support and suggestions contact support@ctr-electronics.com or file
5 * an issue tracker at https://github.com/CrossTheRoadElec/Phoenix-Releases
6 */
7#pragma once
8
10#include "ctre/phoenix/export.h"
13#include <map>
14#include <set>
15#include <string>
16#include <string_view>
17#include <vector>
18
19namespace ctre
20{
21 namespace phoenix
22 {
23 namespace platform
24 {
25 namespace can
26 {
27
28 CTREXPORT int32_t RegisterCANbus(char const *canbus, bool printErr = true);
29 CTREXPORT std::string GetCANivoreDevName(char const *canbus);
30
31 CTREXPORT std::vector<std::string> GetCANbusList(void);
32 CTREXPORT void CANbus_GetStatus(float &busUtilPerc, uint32_t &busOffCount, uint32_t &txFullCount, uint32_t &rec, uint32_t &tec, int32_t &status, char const *canbus, bool printErr = true);
33 CTREXPORT int32_t CANbus_SendFrame(uint32_t messageID, uint8_t const *data, uint8_t dataSize, char const *canbus, bool printErr = true);
34
35 // Tx
36 CTREXPORT void CANComm_SendMessage(uint32_t messageID, uint8_t const *data, uint8_t dataSize, int32_t *status, char const *canbus, bool printErr = true);
37 CTREXPORT void CANComm_SendPeriodicMessage(uint32_t messageID, uint8_t const *data, uint8_t dataSize, int32_t periodMs, int32_t *status, char const *canbus, bool printErr = true);
38 CTREXPORT void CANComm_StopPeriodicMessage(uint32_t messageID, uint8_t const *data, uint8_t dataSize, int32_t *status, char const *canbus, bool printErr = true);
39 // Rx
40 CTREXPORT void CANComm_ReceiveMessage(uint32_t messageID, canframe_t &frame, int32_t *status, char const *canbus, bool printErr = true);
41 CTREXPORT void CANComm_WaitForMessages(std::set<uint32_t> const &messageIDs, uint16_t timeoutMs, int32_t *status, char const *canbus, bool printErr = true);
42 // Streams
43 CTREXPORT void CANComm_OpenStreamSession(uint32_t *sessionHandle, uint32_t messageID, uint32_t messageIDMask, uint32_t maxMessages, int32_t *status, char const *canbus, bool printErr = true);
44 CTREXPORT void CANComm_CloseStreamSession(uint32_t sessionHandle, char const *canbus, bool printErr = true);
45 // Scheduler
46 CTREXPORT void CANComm_ReadStreamSession(uint32_t sessionHandle, canframe_t *messages, uint32_t messagesToRead, uint32_t *messagesRead, int32_t *status, char const *canbus, bool printErr = true);
47 CTREXPORT int32_t CANComm_GetTxSchedulerStatus(void *unusedControlWorld, char const *canbus, bool printErr = true); // used to be GetControlWord
48 // Thread priorities
49 CTREXPORT int32_t CANComm_SetRxSchedPriority(int priority, bool useRoundRobin, char const *canbus, bool printErr = true);
50 CTREXPORT int32_t CANComm_SetTxSchedPriority(int priority, bool useRoundRobin, char const *canbus, bool printErr = true);
51
52 } // namespace can
53 } // namespace platform
54 } // namespace phoenix
55} // namespace ctre
56
57namespace ctre
58{
59 namespace phoenix
60 {
61 namespace platform
62 {
63
64 /**
65 * Get a stack trace, ignoring the first "offset" symbols.
66 *
67 * \param offset The number of symbols at the top of the stack to ignore
68 */
69 CTREXPORT std::string GetStackTrace(int offset);
70
71 CTREXPORT int32_t SimCreate(DeviceType type, int id);
72
73 CTREXPORT int32_t SimDestroy(DeviceType type, int id);
75
76 CTREXPORT int32_t SimSetPhysicsInput(DeviceType type, int id, std::string_view physicsType, double value);
77 CTREXPORT int32_t SimGetPhysicsValue(DeviceType type, int id, std::string_view physicsType, double &value);
78 CTREXPORT int32_t SimGetLastError(DeviceType type, int id);
79
80 CTREXPORT int32_t ReplayLoadFile(char const *filepath);
83
87 CTREXPORT bool ReplayIsRunning(uint16_t timeoutMs);
88
89 CTREXPORT void ReplaySetSpeed(double speed);
90 CTREXPORT int32_t ReplayStepTiming(double stepTimeSeconds);
91
92 } // namespace platform
93 } // namespace phoenix
94} // namespace ctre
#define CTREXPORT
Definition export.h:14
CTREXPORT std::vector< std::string > GetCANbusList(void)
CTREXPORT int32_t CANComm_SetTxSchedPriority(int priority, bool useRoundRobin, char const *canbus, bool printErr=true)
CTREXPORT int32_t RegisterCANbus(char const *canbus, bool printErr=true)
CTREXPORT int32_t CANbus_SendFrame(uint32_t messageID, uint8_t const *data, uint8_t dataSize, char const *canbus, bool printErr=true)
CTREXPORT void CANComm_WaitForMessages(std::set< uint32_t > const &messageIDs, uint16_t timeoutMs, int32_t *status, char const *canbus, bool printErr=true)
CTREXPORT void CANComm_OpenStreamSession(uint32_t *sessionHandle, uint32_t messageID, uint32_t messageIDMask, uint32_t maxMessages, int32_t *status, char const *canbus, bool printErr=true)
CTREXPORT void CANComm_SendMessage(uint32_t messageID, uint8_t const *data, uint8_t dataSize, int32_t *status, char const *canbus, bool printErr=true)
CTREXPORT void CANComm_ReadStreamSession(uint32_t sessionHandle, canframe_t *messages, uint32_t messagesToRead, uint32_t *messagesRead, int32_t *status, char const *canbus, bool printErr=true)
CTREXPORT void CANComm_SendPeriodicMessage(uint32_t messageID, uint8_t const *data, uint8_t dataSize, int32_t periodMs, int32_t *status, char const *canbus, bool printErr=true)
CTREXPORT std::string GetCANivoreDevName(char const *canbus)
CTREXPORT void CANbus_GetStatus(float &busUtilPerc, uint32_t &busOffCount, uint32_t &txFullCount, uint32_t &rec, uint32_t &tec, int32_t &status, char const *canbus, bool printErr=true)
CTREXPORT void CANComm_StopPeriodicMessage(uint32_t messageID, uint8_t const *data, uint8_t dataSize, int32_t *status, char const *canbus, bool printErr=true)
CTREXPORT int32_t CANComm_GetTxSchedulerStatus(void *unusedControlWorld, char const *canbus, bool printErr=true)
CTREXPORT void CANComm_CloseStreamSession(uint32_t sessionHandle, char const *canbus, bool printErr=true)
CTREXPORT int32_t CANComm_SetRxSchedPriority(int priority, bool useRoundRobin, char const *canbus, bool printErr=true)
CTREXPORT void CANComm_ReceiveMessage(uint32_t messageID, canframe_t &frame, int32_t *status, char const *canbus, bool printErr=true)
CTREXPORT int32_t ReplayStop()
CTREXPORT bool ReplayIsFileLoaded()
CTREXPORT int32_t SimDestroyAll()
CTREXPORT bool ReplayIsRunning(uint16_t timeoutMs)
CTREXPORT int32_t SimGetPhysicsValue(DeviceType type, int id, std::string_view physicsType, double &value)
CTREXPORT int32_t ReplayPlay()
CTREXPORT int32_t ReplayPause()
CTREXPORT int32_t SimCreate(DeviceType type, int id)
CTREXPORT void ReplayCloseFile()
DeviceType
Enumeration of all supported device types.
Definition DeviceType.hpp:26
CTREXPORT int32_t ReplayLoadFile(char const *filepath)
CTREXPORT std::string GetStackTrace(int offset)
Get a stack trace, ignoring the first "offset" symbols.
CTREXPORT int32_t SimSetPhysicsInput(DeviceType type, int id, std::string_view physicsType, double value)
CTREXPORT void ReplaySetSpeed(double speed)
CTREXPORT int32_t SimDestroy(DeviceType type, int id)
CTREXPORT int32_t ReplayStepTiming(double stepTimeSeconds)
CTREXPORT int32_t SimGetLastError(DeviceType type, int id)
Definition StatusCodes.h:18
"plain old data" container for holding a CAN Frame Event.
Definition canframe.hpp:20