CTRE Phoenix Pro C++ 23.0.12
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 <vector>
17
18namespace ctre
19{
20 namespace phoenix
21 {
22 namespace platform
23 {
24 namespace can
25 {
26
27 CTREXPORT int32_t RegisterCANbus(char const *canbus);
28 CTREXPORT std::string GetCANivoreDevName(char const *canbus);
29
30 CTREXPORT std::vector<std::string> GetCANbusList(void);
31 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);
32 CTREXPORT int32_t CANbus_SendFrame(uint32_t messageID, uint8_t const *data, uint8_t dataSize, char const *canbus, bool printErr = true);
33
34 // Tx
35 CTREXPORT void CANComm_SendMessage(uint32_t messageID, uint8_t const *data, uint8_t dataSize, int32_t *status, char const *canbus, bool printErr = true);
36 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);
37 CTREXPORT void CANComm_StopPeriodicMessage(uint32_t messageID, uint8_t const *data, uint8_t dataSize, int32_t *status, char const *canbus, bool printErr = true);
38 // Rx
39 CTREXPORT void CANComm_ReceiveMessage(uint32_t messageID, canframe_t &frame, int32_t *status, char const *canbus, bool printErr = true);
40 CTREXPORT void CANComm_WaitForMessages(std::set<uint32_t> const &messageIDs, uint16_t timeoutMs, int32_t *status, char const *canbus, bool printErr = true);
41 // Streams
42 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);
43 CTREXPORT void CANComm_CloseStreamSession(uint32_t sessionHandle, char const *canbus, bool printErr = true);
44 // Scheduler
45 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);
46 CTREXPORT int32_t CANComm_GetTxSchedulerStatus(void *unusedControlWorld, char const *canbus, bool printErr = true); // used to be GetControlWord
47 // Thread priorities
48 CTREXPORT int32_t CANComm_SetRxSchedPriority(int priority, bool useRoundRobin, char const *canbus, bool printErr = true);
49 CTREXPORT int32_t CANComm_SetTxSchedPriority(int priority, bool useRoundRobin, char const *canbus, bool printErr = true);
50
51 } // namespace can
52 } // namespace platform
53 } // namespace phoenix
54} // namespace ctre
55
56namespace ctre
57{
58 namespace phoenix
59 {
60 namespace platform
61 {
62
63 /**
64 * Get a stack trace, ignoring the first "offset" symbols.
65 *
66 * \param offset The number of symbols at the top of the stack to ignore
67 */
68 CTREXPORT std::string GetStackTrace(int offset);
69
70 CTREXPORT int32_t SimCreate(DeviceType type, int id);
71
72 CTREXPORT int32_t SimDestroy(DeviceType type, int id);
74
75 CTREXPORT int32_t SimSetPhysicsInput(DeviceType type, int id, std::string_view physicsType, double value);
76 CTREXPORT int32_t SimGetPhysicsValue(DeviceType type, int id, std::string_view physicsType, double &value);
77 CTREXPORT int32_t SimGetLastError(DeviceType type, int id);
78
79 } // namespace platform
80 } // namespace phoenix
81} // 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 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 int32_t RegisterCANbus(char const *canbus)
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 SimDestroyAll()
CTREXPORT int32_t SimGetPhysicsValue(DeviceType type, int id, std::string_view physicsType, double &value)
CTREXPORT int32_t SimCreate(DeviceType type, int id)
DeviceType
Enumeration of all supported device types.
Definition: DeviceType.hpp:26
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 int32_t SimDestroy(DeviceType type, int id)
CTREXPORT int32_t SimGetLastError(DeviceType type, int id)
Definition: string_util.hpp:14
"plain old data" container for holding a CAN Frame Event.
Definition: canframe.hpp:20