Go to the documentation of this file.
69 #include <semaphore.h>
93 #define MULTICAST_ID 0x00
94 #define UART_DUMMY_ID 0x01
98 #define PARAM_BYTE_5_IDX 6
102 #define PARAM_BYTE_6_IDX 7
112 #define SET_U8_U8_LEN 5
117 #define SET_U8_U16_LEN 6
122 #define SET_U16_LEN 5
127 #define SET_U32_LEN 7
131 #define NUMBER_OF_ADC_DUMP_DATAPOINTS_PER_LINE 8
136 #define FLOAT_CONVERSION_FACTOR 1000.0
141 #define REQUEST_RESPONSE_INDEX 0
142 #define UART_CHECKSUM_TARGET 256
197 static void FrameReadCallback(
struct can_frame* frame);
208 static void UARTReadCallback(uint8_t* ReceivedUARTMsg_pu8, uint16_t UARTMsgLength_u16,
209 uint8_t InterfaceId_u8);
228 static bool ParseMessage_b(uint16_t SenderId_u16, uint8_t* msg, uint8_t len);
303 static bool IsSessionEndFrame_b(uint16_t SenderId_u16,
const uint8_t* ReceivedPayload_pu8);
322 static bool IsNearFieldFrame_b(uint16_t SenderId_u16,
const uint8_t* ReceivedPayload_pu8);
332 static bool IsNoiseLevelFrame_b(uint16_t SenderId_u16,
const uint8_t* ReceivedPayload_pu8);
343 static bool Is1DFrame_b(uint16_t SenderId_u16,
const uint8_t* ReceivedPayload_pu8);
354 static bool Is3DFrame_b(uint16_t SenderId_u16,
const uint8_t* ReceivedPayload_pu8);
364 static bool IsLogMessage(uint16_t SenderId_u16, uint8_t* ReceivedPayload_pu8);
387 static bool IsADCDataFrame_b(uint16_t SenderId_u16, uint8_t* ReceivedPayload_pu8, uint8_t len);
396 static void PrintCanFrame(
struct can_frame* frame);
431 static void SendCommand(uint8_t* payload, uint16_t length);
565 char* InterfaceName_cp);
579 static void SendViaCAN(uint8_t* payload, uint16_t length);
587 static void SendViaUART(uint8_t* payload, uint16_t length, uint8_t InterfaceId_u8);
733 static void (*
LogMsgCallback)(uint16_t Sender_u16, uint8_t* ReceivedPayload_pu8) = NULL;
776 uint8_t* value = NULL;
952 ackstatus->
ACK_b = ack;
960 value = ackstatus->
ACK_b;
990 uint8_t* value = NULL;
999 int16_t InterfaceIndex = -1;
1002 if (strncmp(
KnownInterfaces_tp[Idx_u8].InterfaceName, InterfaceName, strlen(InterfaceName)) ==
1005 InterfaceIndex = Idx_u8;
1009 return InterfaceIndex;
1012 char* InterfaceName_cp)
1018 strlen(InterfaceName_cp));
1019 MPRINTF(
"Added Interface: %s at Postion:%d\n",
1026 MPRINTF(
"ERROR - CAN NOT ADD MORE SENSORS - LIMIT REACHED\n");
1033 uint16_t PayloadSum_u16 = 0;
1034 for (uint8_t Idx_u8 = 0; Idx_u8 < PayloadLength_u8; Idx_u8++)
1036 PayloadSum_u16 += Payload_pu8[Idx_u8];
1038 Checksum_u8 = PayloadSum_u16 + Checksum_u8;
1039 Checksum_u8 = UINT8_MAX + 1 - Checksum_u8;
1045 uint8_t PayloadLength_u8 = ReceivedUARTMsg_pt->
PayloadLen_u8;
1046 uint8_t CalculatedChecksum_u8 =
1048 return CalculatedChecksum_u8 == ReceivedUARTMsg_pt->
Checksum_u8;
1053 #ifdef CAN_AVAILABLE
1054 struct can_frame frame;
1055 memset(&frame, 0x00,
sizeof(frame));
1058 memcpy(frame.data, payload,
length >
sizeof(frame.data) ?
sizeof(frame.data) :
length);
1060 PrintCanFrame(&frame);
1064 static void SendViaUART(uint8_t* payload, uint16_t length, uint8_t InterfaceId_u8)
1081 MPRINTF(
"---PrintCurrentSensors---\n");
1084 MPRINTF(
"KnownSensors[%d].InterfaceSensorId_u16: %d\n", Idx_u8,
1086 MPRINTF(
"KnownSensors[%d].InterfaceIndex_u8: %d\n", Idx_u8,
1089 MPRINTF(
"-------------------------\n");
1094 MPRINTF(
"---PrintKnownInterfaces---\n");
1097 MPRINTF(
"KnownInterfaces_tp[%d].InterfaceName: %s\n", Idx_u8,
1099 MPRINTF(
"KnownInterfaces_tp[%d].SensorInterface_t: %d\n", Idx_u8,
1102 MPRINTF(
"-------------------------\n");
1110 SensorInterface_t =
IF_CAN;
1112 switch (SensorInterface_t)
1120 if (payload != NULL)
1122 MPRINTF(
"SendCommand to Target: Id:%d %s\n",
1134 if (payload != NULL)
1143 MPRINTF(
"Interface currently unsupported\n");
1152 SensorInterface_t =
IF_CAN;
1155 switch (SensorInterface_t)
1167 for (
int i = 0; i < loopCondition; i++)
1173 #ifdef CAN_AVAILABLE
1175 static void PrintCanFrame(
struct can_frame* frame)
1177 MPRINTF(
"0x%03X [%d] ", frame->can_id, frame->can_dlc);
1179 for (
int i = 0; i < frame->can_dlc; i++)
1181 MPRINTF(
"%02X ", frame->data[i]);
1230 MPRINTF(
"Unknown Number of Sensors on Bus, but wait for ack is called\n");
1245 bool retval_b =
false;
1246 bool can_release_sem =
true;
1256 MPRINTF(
"SenderId_u16: %d\n", SenderId_u16);
1260 MPRINTF(
"CurrentACKStatus[%d].SenderId_u16: %d\n", Idx_u8,
1268 if (CurrentACK_u8 == ExpectedACK || CurrentACK_u8 == ExpectedNACK ||
1272 if (CurrentSubControlByte_u8 == ExpectedSubControlByte_u8)
1301 can_release_sem =
false;
1304 if (retval_b && can_release_sem)
1341 MPRINTF(
"Try to Add %d to List of known Sensors - SensorInterfaceIndex_u8:%d\n", Sender_u16,
1342 SensorInterfaceIndex_u8);
1345 bool SensorAlreadyKnown =
false;
1350 MPRINTF(
"Sensor was known - not adding\n");
1351 SensorAlreadyKnown =
true;
1355 if (!SensorAlreadyKnown)
1365 MPRINTF(
"WARNING: To many sensors on Bus\n");
1381 if (NewIndex_i8 == -1)
1394 "No free session-memory left. Looks like there are more sensors on bus then expected\n");
1402 MPRINTF(
"Delete Old Session Data\n");
1406 MPRINTF(
"Starting new Session at index: %d\n", NewIndex_i8);
1411 MPRINTF(
"Created Empty Session Record for sender %d with index: %d\n", SenderId_u16, NewIndex_i8);
1420 MPRINTF(
"Session Start Detected!\n");
1424 MPRINTF(
"Error while trying to start new session\n");
1467 int8_t Index_i8 = -1;
1470 MPRINTF(
"CurrentSessions.ActiveSessions[%d].SenderId_u16:%d\n", Index_u8,
1474 Index_i8 = (int8_t)Index_u8;
1482 uint8_t Index_u8 = 0;
1485 MPRINTF(
"CurrentSessions.ActiveSessions[%d].SenderId_u16:%d\n", Index_u8,
1489 Index_i8 = (int8_t)Index_u8;
1493 MPRINTF(
"New Session index created at: %d\n", Index_i8);
1497 MPRINTF(
"GetCurrentSendersSessionIndex found index at %d\n", Index_i8);
1503 int8_t Index_i8 = -1;
1504 MPRINTF(
"Search for sender: %d\n", SenderId_u16);
1507 MPRINTF(
"CurrentADCSessions.ActiveSessions[%d].SenderId_u16:%d\n", Index_u8,
1511 Index_i8 = (int8_t)Index_u8;
1519 uint8_t Index_u8 = 0;
1522 MPRINTF(
"CurrentSessions.ActiveSessions[%d].SenderId_u16:%d\n", Index_u8,
1526 Index_i8 = (int8_t)Index_u8;
1530 MPRINTF(
"New Session index created at: %d\n", Index_i8);
1533 MPRINTF(
"GetCurrentSendersSessionIndex found index at %d\n", Index_i8);
1539 MPRINTF(
"CloseSessionRecord_b\n");
1541 if (CurrentSenderSessionIndex_i8 != -1)
1547 MPRINTF(
"CloseSessionRecord_b: SessionIndex for Sender %d found: %d!\n", SenderId_u16,
1548 CurrentSenderSessionIndex_i8);
1558 MPRINTF(
"CloseSessionRecord_b\n");
1560 if (CurrentSenderADCSessionIndex_i8 != -1)
1563 MPRINTF(
"ADC-Session closed\n");
1564 MPRINTF(
"ReceivedDumpSize_u32:%d\n",
1574 if (CurrentSenderADCSessionIndex_i8 != -1)
1577 #ifndef NOREALPRINTF
1578 uint32_t ExpectedDumpSize_u32 =
1582 uint32_t DumpSize_u32 =
1585 #ifndef NOREALPRINTF
1586 MPRINTF(
"SenderId_u16:%d\n", SenderId_u16);
1587 MPRINTF(
"ExpectedDumpSize_u32:%d\n", ExpectedDumpSize_u32);
1589 MPRINTF(
"ReceivedDumpSize_u32:%d\n", DumpSize_u32);
1590 for (uint32_t Idx_u32 = 0; Idx_u32 < DumpSize_u32; Idx_u32++)
1603 MPRINTF(
"Waring, tried to print none existing data-blob\n");
1609 MPRINTF(
"AllSessionsActive_b NumberOfSensorsASessionStartIsExpectedFrom_u8:%d\n",
1635 MPRINTF(
"CurrentADCSessions.NumberOfActiveSessions_u8:%d\n",
1652 MPRINTF(
"End of Session Request Detected!\n");
1655 MPRINTF(
"Session no longer active\n");
1689 MPRINTF(
"ADC-Session no longer active\n");
1702 MPRINTF(
"AllADCSessionsClosed\n");
1714 "Warning: Could not close Session. Probably because no corresponding session start was "
1727 MPRINTF(
"NearFieldFrame detected\n");
1729 if (CurrentSenderSessionIndex_i8 != -1)
1735 "Warning: Could not record NearFieldFrame. Probably because no corresponding session start "
1745 MPRINTF(
"NoiseLevelFrame detected\n");
1747 if (CurrentSenderSessionIndex_i8 != -1)
1749 uint16_t NoiseLevel_u16 = 0;
1750 memcpy(&NoiseLevel_u16, &ReceivedPayload_pu8[
SUBCONTROL_BYTE_IDX],
sizeof(NoiseLevel_u16));
1752 NoiseLevel_u16 = le16toh(NoiseLevel_u16);
1757 "Warning: Could not record NoiseLevelFrame. Probably because no corresponding session "
1758 "start was recorded\n");
1763 static bool Is1DFrame_b(uint16_t SenderId_u16,
const uint8_t* ReceivedPayload_pu8)
1765 bool retval_b =
false;
1768 MPRINTF(
"1DFrame detected\n");
1770 if (CurrentSenderSessionIndex_i8 != -1)
1772 uint8_t NumberOf1DPoints_u8 =
1776 uint16_t VectorLength_u16 = 0;
1778 sizeof(VectorLength_u16));
1780 VectorLength_u16 = le16toh(VectorLength_u16);
1789 MPRINTF(
"VectorLength_u16:%d\n", VectorLength_u16);
1790 MPRINTF(
"Intensity_u8:%d\n", Intensity_u8);
1795 MPRINTF(
"Error: Could not record 1DFrame. More 1D Datapoints send then expected!\n");
1801 "Warning: Could not record 1DFrame. Probably because no corresponding session start was "
1808 static bool Is3DFrame_b(uint16_t SenderId_u16,
const uint8_t* ReceivedPayload_pu8)
1810 bool retval_b =
false;
1813 MPRINTF(
"3DFrame detected\n");
1815 if (CurrentSenderSessionIndex_i8 != -1)
1817 uint8_t NumberOf3DPoints_u8 =
1829 X_i16 = le16toh(X_i16);
1830 Y_i16 = le16toh(Y_i16);
1831 Z_i16 = le16toh(Z_i16);
1852 MPRINTF(
"Intensity_u8:%d\n", Intensity_u8);
1857 MPRINTF(
"Error: Could not record 3DFrame. More 3D Datapoints send then expected!\n");
1863 "Warning: Could not record 3DFrame. Probably because no corresponding session start was "
1877 static bool IsReadyFrame(uint16_t SenderId_u16,
const uint8_t* ReceivedPayload_pu8)
1905 return Is1DFrame_b(SenderId_u16, ReceivedPayload_pu8) ||
1911 static bool IsLogMessage(uint16_t SenderId_u16, uint8_t* ReceivedPayload_pu8)
1933 uint32_t ADCDumpSize_u32 = 0;
1935 memcpy(&ADCDumpSize_u32, &ReceivedPayload_pu8[
PARAM_BYTE_1_IDX],
sizeof(ADCDumpSize_u32));
1937 ADCDumpSize_u32 = le32toh(ADCDumpSize_u32);
1939 MPRINTF(
"Got ADC Dump Start Frame \n");
1940 MPRINTF(
"Current Sender: %d\n", SenderId_u16);
1941 MPRINTF(
"Promoted ADC Dumpsize: %d\n", ADCDumpSize_u32);
1943 if (CurrentSendersADCSessionIndex_i8 != -1)
1953 MPRINTF(
"GetCurrentSendersADCSessionIndex: %d\n", CurrentSendersADCSessionIndex_i8);
1960 malloc(ADCDumpSize_u32);
1979 if (CurrentSendersADCSessionIndex_i8 != -1)
1982 uint32_t CurrentIndex_u32 =
1985 uint32_t MaxIndex_u32 =
1998 MPRINTF(
"Warning - Received more data in dump than expected. Will not store this data\n");
2003 MPRINTF(
"WARNING - Received ADC-DATA-FRAME NOT BELONGING TO AN KNOWN SESSION\n");
2024 #ifdef CAN_AVAILABLE
2026 static void FrameReadCallback(
struct can_frame* frame)
2029 if (frame->can_id <= UINT16_MAX)
2031 uint16_t SenderId_u16 = frame->can_id;
2033 memcpy(Payload_u8p, frame->data,
2045 MPRINTF(
"Warning - Not evaluable CAN-payload received.\n");
2051 MPRINTF(
"Warning - This message from this sender ID %02X cannot be processed: ", frame->can_id);
2053 memcpy(Payload_u8p, frame->data,
2061 uint8_t InterfaceId_u8)
2064 uint16_t SenderId_u16 = 1;
2066 uint8_t SensorIndex = 0;
2069 if (
KnownSensors[SensorIndex].InterfaceIndex_u8 == InterfaceId_u8)
2075 for (uint16_t Idx_u16 = 0; Idx_u16 < UARTMsgLength_u16; Idx_u16++)
2077 MPRINTF(
"%02X ", ReceivedUARTMsg_pu8[Idx_u16]);
2086 MPRINTF(
"Found Start Flag\n");
2107 ReceivedUARTMsg_pu8[Idx_u16];
2134 MPRINTF(
"Received complete uart message\n");
2138 MPRINTF(
"Got this Msg from Sender. %d\n", SenderId_u16);
2140 if (
ParseMessage_b(SenderId_u16, Payload_u8p, UARTMsgLength_u16))
2148 MPRINTF(
"Warning - Not evaluable UART-payload received from Sender %d:\n",
2152 for (
int i = 0; i < UARTMsgLength_u16; i++)
2154 MPRINTF(
"%02X ", ReceivedUARTMsg_pu8[i]);
2161 MPRINTF(
"Warning - This uart message cannot be processed - Checksum Fail ");
2167 MPRINTF(
"------------------------------------------------\n");
2168 MPRINTF(
"ERROR in UART Message - END FLAG NOT FOUND!\n");
2169 MPRINTF(
"Current Index in UART-MSG:%d (%02X)\n", Idx_u16, ReceivedUARTMsg_pu8[Idx_u16]);
2170 MPRINTF(
"Current UART-MSG-Len:%d\n", UARTMsgLength_u16);
2171 MPRINTF(
"Current UART-MSG: ");
2172 for (uint16_t Index = 0; Index < UARTMsgLength_u16; Index++)
2174 MPRINTF(
"%02X ", ReceivedUARTMsg_pu8[Index]);
2177 MPRINTF(
"CurrentUARTMsg_t:\n");
2182 MPRINTF(
"------------------------------------------------\n");
2187 MPRINTF(
"INTERNAL ERROR: Unexpected UART Message State!\n");
2197 uint16_t length_u16 = 2;
2233 #ifdef CAN_AVAILABLE
2237 RegisterReadCallback(FrameReadCallback);
2238 SetupSocket(InterfaceName, DataRate_u32);
2244 MPRINTF(
"Warning: An attempt was made to connect to the sensor repeatedly\n");
2248 #ifdef UART_AVAILABLE
2260 #ifdef USB_AVAILABLE
2270 MPRINTF(
"Interface currently unsupported\n");
2275 MPRINTF(
"WARNING - An attempt was made to initialize the same interface repeatedly!\n");
2284 #ifdef CAN_AVAILABLE
2293 "An attempt was made to disconnect the connection to the sensor, although no "
2294 "connection has yet been established\n");
2299 #ifdef UART_AVAILABLE
2313 MPRINTF(
"Interface currently unsupported\n");
2334 uint16_t length_u16 = 2;
2350 MPRINTF(
"RequestMeasurement\n");
2353 uint16_t length_u16 = 2;
2363 MPRINTF(
"RequestFactoryReset\n");
2365 uint16_t length_u16 = 2;
2381 MPRINTF(
"RequestStoreSettings\n");
2383 uint16_t length_u16 = 2;
2393 MPRINTF(
"RequestLoadSettings\n");
2395 uint16_t length_u16 = 2;
2415 MPRINTF(
"Session State for Sessionindex %d - SensorId %d is set to EXPECTED\n", Idx_u8,
2422 MPRINTF(
"Trying to GetCurrentSendersSessionIndex\n");
2424 MPRINTF(
"Session State for Sessionindex %d - SensorId %d is will be set to EXPECTED\n",
2427 MPRINTF(
"Session State for Sessionindex %d - SensorId %d is set to EXPECTED\n", TargetIndex_u8,
2444 MPRINTF(
"ADC Session State for Sessionindex %d - SensorId %d is will be set to EXPECTED\n",
2452 bool AllSessionsStarted_b =
true;
2453 MPRINTF(
"GetSessionRunning_b TargetSensorId_u16:%d\n", TargetSensorId_u16);
2462 AllSessionsStarted_b =
false;
2473 AllSessionsStarted_b =
false;
2476 return AllSessionsStarted_b;
2481 bool AllSessionsComplete_b =
true;
2490 AllSessionsComplete_b =
false;
2501 AllSessionsComplete_b =
false;
2504 return AllSessionsComplete_b;
2509 bool AllSessionsStarted_b =
true;
2517 AllSessionsStarted_b =
false;
2527 AllSessionsStarted_b =
false;
2530 return AllSessionsStarted_b;
2535 bool AllSessionsComplete_b =
true;
2543 AllSessionsComplete_b =
false;
2553 AllSessionsComplete_b =
false;
2556 return AllSessionsComplete_b;
2564 uint16_t length_u16 = 2;
2576 MPRINTF(
"SetParameterSuccessful_b\n");
2579 if (request != NULL &&
response != NULL)
2591 if (request != NULL &&
response != NULL)
2603 MPRINTF(
"SetParameterADCUseFixedFrameRate\n");
2617 MPRINTF(
"SetParameterADCFixedFrameRate\n");
2633 MPRINTF(
"SetParameterTransducerVolume\n");
2647 MPRINTF(
"SetParameterTransducerNumOfPulses\n");
2661 MPRINTF(
"SetParameterSignalProcessingTemperature\n");
2669 Temperature_i32 = htole32(Temperature_i32);
2671 memcpy(&payload_pu8[
PARAM_BYTE_2_IDX], &Temperature_i32,
sizeof(Temperature_i32));
2678 MPRINTF(
"SetParameterSignalProcessingHumidity\n");
2692 MPRINTF(
"SetParameterSignalProcessingNoiseLevelThresholdFactor\n");
2700 Threshold_u16 = htole16(Threshold_u16);
2702 memcpy(&payload_pu8[
PARAM_BYTE_2_IDX], &Threshold_u16,
sizeof(Threshold_u16));
2709 MPRINTF(
"SetParameterSignalProcessingHumidity\n");
2723 MPRINTF(
"SetParameterSignalProcessingEnableNearFieldDetection\n");
2737 MPRINTF(
"SetParameterSignalProcessingEnableMultipathFilter\n");
2751 MPRINTF(
"SetParameterSignalProcessingEnableAutoGain\n");
2767 bool result_b =
false;
2770 MPRINTF(
"SetParameterSystemNodeID\n");
2778 NodeID_u16 = htole16(NodeID_u16);
2793 MPRINTF(
"Set Node ID does not support MULTICAST_ID!\n");
2800 MPRINTF(
"SetParameterSystemLogLevel\n");
2814 MPRINTF(
"SetParameterSystemMode\n");
2831 MPRINTF(
"Sensor Index %d Mode set to %d\n", idx_u8, Mode_t);
2844 bool retval =
false;
2880 uint16_t retval = 0;
2886 uint16_t PayloadValue_u16 = 0;
2887 memcpy(&PayloadValue_u16, &Payload_pu8[
PARAM_BYTE_2_IDX],
sizeof(PayloadValue_u16));
2889 retval = le16toh(PayloadValue_u16);
2896 uint16_t retval = 0;
2901 uint16_t PayloadValue_u16 = 0;
2902 memcpy(&PayloadValue_u16, &Payload_pu8[
PARAM_BYTE_3_IDX],
sizeof(PayloadValue_u16));
2904 retval = le16toh(PayloadValue_u16);
2916 int32_t PayloadValue_i32 = 0;
2917 memcpy(&PayloadValue_i32, &Payload_pu8[
PARAM_BYTE_2_IDX],
sizeof(PayloadValue_i32));
2919 retval = le32toh(PayloadValue_i32);
2931 int32_t PayloadValue_i32 = 0;
2932 memcpy(&PayloadValue_i32, &Payload_pu8[
PARAM_BYTE_3_IDX],
sizeof(PayloadValue_i32));
2934 retval = le32toh(PayloadValue_i32);
2941 MPRINTF(
"GetParameterADCUseFixedFrameRate\n");
2955 MPRINTF(
"GetParameterADCFixedFrameRate\n");
2971 MPRINTF(
"GetParameterTransducerVolume\n");
2985 MPRINTF(
"GetParameterTransducerNumOfPulses\n");
2999 MPRINTF(
"GetParameterSignalProcessingTemperature_f\n");
3010 MPRINTF(
"payload_value_i32: %d\n", payload_value_i32);
3012 return TemperatureInDegrees_f;
3017 MPRINTF(
"GetParameterSignalProcessingHumidity_u8\n");
3031 MPRINTF(
"GetParameterSignalProcessingNoiseLevelThresholdFactor_f\n");
3042 return payload_value_f;
3047 MPRINTF(
"GetParameterSignalProcessingNoiseRatioThreshold_u8\n");
3061 MPRINTF(
"GetParameterSignalProcessingEnableNearFieldDetection_b\n");
3075 MPRINTF(
"GetParameterSignalProcessingEnableMultipathFilter_b\n");
3089 MPRINTF(
"GetParameterSignalProcessingEnableAutoGain_b\n");
3105 MPRINTF(
"GetParameterSystemNodeID\n");
3119 MPRINTF(
"GetUARTNodeId for Interface-Id: %d\n", InterfaceId_u8);
3130 SendViaUART(payload_pu8, length_u16, InterfaceId_u8);
3140 MPRINTF(
"GetParameterSystemMCUTemperature_f\n");
3151 MPRINTF(
"payload_value_i32: %d\n", payload_value_i32);
3153 return TemperaturInDegree_f;
3158 MPRINTF(
"GetParameterSystemLogLevel\n");
3172 MPRINTF(
"GetParameterSystemResetReason_t\n");
3186 MPRINTF(
"GetParameterSystemSensorState_t\n");
3200 MPRINTF(
"GetParameterSystemUniqueID_t\n");
3219 MPRINTF(
"GetParameterSystemMode\n");
3233 MPRINTF(
"GetParameterSystemCalibrationState_b\n");
3251 MPRINTF(
"Error - attempted ack to nonexistent session\n");
3278 MPRINTF(
"Error - attempted ack to nonexistent dump\n");
3282 uint32_t PromotedDumpSize_u32 =
3291 PromotedDumpSize_u32 = htole32(PromotedDumpSize_u32);
3293 memcpy(&payload_pu8[
PARAM_BYTE_2_IDX], &PromotedDumpSize_u32,
sizeof(PromotedDumpSize_u32));
3311 MPRINTF(
"RegisterSessionStartCallback\n");
3317 int timeout = *((
int*)vargp);
3319 MPRINTF(
"Timeout occurred WaitForACK\n");
3326 int timeout = *((
int*)vargp);
3328 MPRINTF(
"Timeout occurred SessionStart\n");
3335 int timeout = *((
int*)vargp);
3337 MPRINTF(
"Timeout occurred SessionEnd\n");
3347 MPRINTF(
"Not all Sessions Started yet - wait for: %d sensors\n",
3360 MPRINTF(
"RegisterPointSessionEndCallback\n");
3366 MPRINTF(
"RegisterPointSessionEndCallback\n");
3405 MPRINTF(
"RegisterRdyCallback\n");
3411 MPRINTF(
"RegisterLogMsgCallback\n");
3416 uint32_t ADCDumpSize_32))
3418 MPRINTF(
"ADCDumpStartRequestCallback\n");
3427 MPRINTF(
"Current Index: %d\n", Index_i8);
3430 MPRINTF(
"Error - attempted access to nonexistent session data\n");
3436 MPRINTF(
"Warning attempted access to incomplete session!\n");
3440 return RequestedSessionData;
3450 MPRINTF(
"Error - attempted access to nonexistent dump data\n");
3456 MPRINTF(
"Warning attempted access to incomplete dump!\n");
3460 return RequestedDumpData;
3492 bool FoundSender_b =
false;
3498 FoundSender_b =
true;
3522 const uint8_t* ReceivedPayload_pu8)
3524 int32_t Idx_i32 = sprintf(Output_p8,
"Sensor 0x%03X - ", SenderId_u16);
3525 bool ValidSeverityByte_B =
true;
3529 Idx_i32 += sprintf(Output_p8 + Idx_i32,
"[Debug] - ");
3532 Idx_i32 += sprintf(Output_p8 + Idx_i32,
"[Info] - ");
3535 Idx_i32 += sprintf(Output_p8 + Idx_i32,
"[Warn] - ");
3538 Idx_i32 += sprintf(Output_p8 + Idx_i32,
"[Error] - ");
3541 ValidSeverityByte_B =
false;
3545 if (ValidSeverityByte_B)
3575 Idx_i32 += sprintf(Output_p8 + Idx_i32,
"Invalid log message received: ");
3578 Idx_i32 += sprintf(Output_p8 + Idx_i32,
"0x%02X ", ReceivedPayload_pu8[i]);
3589 sprintf(Output_p8,
"A reset occurred due to %s",
3594 sprintf(Output_p8,
"A reset occurred due to unknown reason - code: %d",
3604 sprintf(Output_p8,
"The bootloader cannot install older firmware versions");
3607 sprintf(Output_p8,
"The size of the firmware update is too large");
3610 sprintf(Output_p8,
"The CRC is incorrect");
3613 sprintf(Output_p8,
"The firmware signature cannot be verified");
3616 sprintf(Output_p8,
"The bootloader hasn't been initialised");
3619 uint16_t PacketNumber_u16 = 0;
3622 "The last received firmware packet number was not as expected. Expected firmware "
3628 sprintf(Output_p8,
"The firmware is not compatible with this version of hardware");
3631 sprintf(Output_p8,
"The firmware is not compatible with this sensor model");
3634 sprintf(Output_p8,
"More than one FW update init commands has been received");
3637 sprintf(Output_p8,
"The firmware is not ready to be launched");
3642 sprintf(Output_p8,
"The bootloader next state is %s",
3647 sprintf(Output_p8,
"The bootloader next state is not recognised - code: %d",
3652 sprintf(Output_p8,
"The firmware could not be properly stored in flash memory");
3655 sprintf(Output_p8,
"Not recognized bootloader log message received");
3665 sprintf(Output_p8,
"Sensor status is OK");
3668 sprintf(Output_p8,
"Microphone %d is likely covered",
3673 "The transducer is likely covered - or all three microphones may be covered");
3682 sprintf(Output_p8,
"PGA %d status could not be determined",
3686 sprintf(Output_p8,
"Not recognized self-check log message received");
3696 sprintf(Output_p8,
"The signal processing modules could not be initialized");
3699 sprintf(Output_p8,
"The near field binary detection has been disbaled");
3702 sprintf(Output_p8,
"The speed of sound could not be calculated in this frame");
3705 sprintf(Output_p8,
"No echoes were found");
3708 sprintf(Output_p8,
"The ADC signal entered clipping");
3711 sprintf(Output_p8,
"No 3D points could be calculated");
3720 sprintf(Output_p8,
"Point buffer full");
3723 sprintf(Output_p8,
"Timer overflow");
3726 sprintf(Output_p8,
"Not recognized signal processing log message received");
3736 sprintf(Output_p8,
"A memory allocation has failed");
3739 sprintf(Output_p8,
"A system reboot is required");
3742 sprintf(Output_p8,
"The settings in flash memory could not be loaded");
3745 sprintf(Output_p8,
"The settings could not be saved to flash memory");
3748 sprintf(Output_p8,
"The factory defaults are being written to flash memory");
3751 sprintf(Output_p8,
"Not recognized software log message received");
3760 Output_p8[Len_u8] =
'\0';
3768 sprintf(Output_p8,
"The sensor has not yet been calibrated");
3773 sprintf(Output_p8,
"The resonant frequency calibration routine is %d%% complete",
3778 sprintf(Output_p8,
"The near-field detection calibration routine is %d%% complete",
3783 sprintf(Output_p8,
"The calibration routine is finished");
3786 sprintf(Output_p8,
"The calibration routine could not be initialized");
3789 sprintf(Output_p8,
"An invalid calibration frame was recorded");
3792 sprintf(Output_p8,
"Not recognized calibration log message received");
bool SetParameterADCUseFixedFrameRate(bool UseFixedFrameRate_b)
Blocking Request to use the fixed framerate for current target sensor.
static bool IsADCDumpStartFrame_b(uint16_t SenderId_u16, const uint8_t *ReceivedPayload_pu8)
Validates whether the received payload represents an ADC-Dump Start Message. If so the new adc sessio...
const std::string response
struct Interface_t Interface_t
bool RequestReboot()
Request selected sensor to reboot.
struct ADCDump_Data_t ADCDump_Data_t
SensorMode_t GetParameterSystemSensorMode_t()
Blocking Request to read the Sensor Mode from current sensor.
@ SYS_PARAM_BYTE_UNIQUE_ID
@ BL_STATUS_FLASH_INCOMPLETE_ERROR
static void(* SessionStartCallback)(uint16_t Sender_u16)
@ SIG_PRO_ISSUE_KALMAN_ERROR
SensorState_t GetParameterSystemSensorState_t()
Blocking Request to read the Sensor State from current sensor.
void ParseBootloaderLogMessageToText(char *Output_p8, const uint8_t *ReceivedPayload_pu8)
Parses Bootloader specific log messages into human readable text.
static bool SemaphoresInit_b
bool GetBoolFromPayload_b(const uint8_t *Payload_pu8)
Is called from Getter functions to extract values from payload. In this case a bool-value.
static uint8_t UartPayload_pu8[UART_MAX_FRAME_LEN]
static uint16_t GetCurrentStatusInformant_u16()
ACK_Status_t * GetCurrentACKStatus(uint8_t index)
Is called internally to get the current ACKStatus.
bool RequestFactoryReset()
Request selected sensor to reset to factory defaults.
uint16_t GetU16FromPayload_u16(const uint8_t *Payload_pu8)
Is called from Getter functions to extract values from payload. In this case a uint16-value.
#define UART_MAX_FRAME_LEN
int DeinitUARTPort()
Called from the can-library, this function will close the socket and take care of ReceiverThread term...
CommsInterfaceType_t SensorInterface_t
ResetReason_t GetParameterSystemResetReason_t()
Blocking Request to read the last Reset Reason from current sensor.
@ UART_MESSAGE_STATE_UNKNOWN
static int timeoutmSeconds
static void SetWaitForACKForACKStatus(ACK_Status_t *ackstatus, bool waitforack)
static bool SetParameterSuccessful_b(const uint8_t *request, const uint8_t *response)
Compares request and response payload and validates if the response indicates a success when setting ...
static bool Is3DFrame_b(uint16_t SenderId_u16, const uint8_t *ReceivedPayload_pu8)
Validates whether the received point-data-payload is a 3D-Point-Data. If so, the associated session i...
static UART_Msg_t CurrentUARTMsg_t[MAX_NUMBER_OF_SENSORS_ON_BUS]
#define PARAM_BYTE_6_IDX
Offset of 7'th parameter in Payload.
static void PrintPayload(const uint8_t *payload)
Only for debugging - print the content of payload to stdout.
bool SetParameterSignalProcessingNoiseRatioThreshold(uint8_t Threshold_u8)
Blocking Request to set the Noise Ratio Threshold for current target sensor.
Version_t RequestVersion_t(VersionByte_t TargetComponent_t)
Blocking - Request transmition of the current version of selected component from selected sensor.
void ParseSignalProcessingLogMessageToText(char *Output_p8, const uint8_t *ReceivedPayload_pu8)
Parses signal processing specific log messages into human readable text.
uint8_t GetU8FromTwoArgumentPayload_u8(const uint8_t *Payload_pu8)
Is called from Getter functions to extract values from payload. In this case a uint8-value.
static void SetNumberOfKnownSensors(uint8_t newvalue)
ADCDump_Data_t CurrentADCSessions
@ SIGPRO_PARAM_BYTE_ENABLE_AUTO_GAIN
bool GetSessionComplete_b(uint16_t TargetSensorId_u16)
@ SIG_PRO_ISSUE_VSOUND_CAL_ERROR
UID_t GetParameterSystemUniqueID_t(uint8_t Index_u8)
Blocking Request to read the Unique ID from current sensor.
@ SC_STATUS_PGA_MALFUNCTION
@ BL_STATUS_SIGNATURE_ERROR
static void(* ADCDUmpEndCallback)(uint16_t Sender_u16)
uint8_t GetParameterTransducerNumOfPulses_u8()
Blocking Request to read the current Transducer Number of Pulses from current sensor.
void ParseSoftwareLogMessageToText(char *Output_p8, const uint8_t *ReceivedPayload_pu8)
Parses software-issue specific log messages into human readable text.
#define MAX_NUMBER_OF_SENSORS_ON_BUS
If this define is set, the library will use the linux socket interface.
static bool IsNearFieldFrame_b(uint16_t SenderId_u16, const uint8_t *ReceivedPayload_pu8)
Validates whether the received point-data-payload is a near-filed-information. If so,...
static bool ConnectedToCANBus_b
@ UART_MESSAGE_STATE_VALIDATE_MSG_END
static sem_t wait_session_end_sem
Sensor_t * GetKnownSensors()
Returns pointer to array containing all known sensors. With GetNumberOfKnownSensors() users can get l...
static pthread_mutex_t mutex_numberofknownsensors
void * WaitForSessionEndTimeout(void *vargp)
static void SetCurrentSessionsNumberOfActiveSessions_u8(uint8_t newvalue)
@ ADC_PARAM_BYTE_USE_FIXED_FRAME_RATE
void SetTargetSensor(uint16_t TargetSensor_u16)
With this function, the user can set the current target-id, all comming messages will be send to.
void ACKSessionEnd()
Accept Session End for current sensor.
static void(* SessionEndCallback)(uint16_t Sender_u16)
@ CONTROL_BYTE_TRIGGER_ACTION_ACK
bool GetParameterSignalProcessingEnableNearFieldDetection_b()
Blocking Request to read whether near field detection is enabled in the current sensor.
void DeinitInterface(CommsInterfaceType_t Interface_t)
Instruction to deinit the specified interface type.
float GetParameterSignalProcessingTemperature_f()
Blocking Request to read the current Transducer Temperature setting from current sensor.
#define START_POINT_SESSION_ACK_LEN
static void SetCurrentTarget_u16(uint16_t newvalue)
@ CONTROL_BYTE_BEGIN_ADC_DUMP_SESSION
bool GetParameterSignalProcessingEnableAutoGain_b()
Blocking Request to read whether auto gain is enabled in the current sensor.
static int16_t GetInterfaceIndex_i16(char *InterfaceName)
bool RequestLoadSettings()
Request selected sensor to load saved settings.
uint8_t GetParameterTransducerVolume_u8()
Blocking Request to read the current Transducer Volume from current sensor.
bool SetParameterSignalProcessingEnableNearFieldDetection(bool Enable_b)
Blocking Request to enable near field detection for current target sensor.
SessionState_t SessionState
static bool ConnectedToCUART_b
static void SetConnectedToCANBus(bool newvalue)
LogLevel_t GetParameterSystemLogLevel_t()
Blocking Request to read the current System Log Level from current sensor.
static bool IsSessionDataFrame_b(uint16_t SenderId_u16, const uint8_t *ReceivedPayload_pu8)
Validates whether the received payload represents a Session-Data-Information.
@ ACTION_BYTE_FACTORY_DEFAULTS
static const char * kSensorStateStrings[]
static void ResetListOfKnownSensors()
Clears the list of known Sensors.
static bool Is1DFrame_b(uint16_t SenderId_u16, const uint8_t *ReceivedPayload_pu8)
Validates whether the received point-data-payload is a 1D-Point-Data. If so, the associated session i...
@ UART_MESSAGE_STATE_READ_CHECKSUM
uint16_t VectorLength_u16
uint16_t WaitForADCSessionEnd()
Blocking Function call to wait for SessionEnd Payload.
uint8_t InterfaceIndex_u8
struct Session_Data_t Session_Data_t
static uint16_t GetInterfaceSensorIdFromSensor(Sensor_t *sensor)
void RegisterRdyCallback(void(*Callback)(uint16_t Sender_u16))
Interface function to register a callback function that is called whenever an Ready Payload is receiv...
void * WaitForACKTimeout(void *vargp)
static void SendCommand(uint8_t *payload, uint16_t length)
Generic Send-Function. Takes Payload, length and interface as arguments. Atm. only CAN-Bus is impleme...
static uint8_t GetNumberOfSensorsACKIsExpectedFrom()
@ SW_ISSUE_LOAD_FROM_FLASH_FAILED
static bool IsReadyFrame(uint16_t SenderId_u16, const uint8_t *ReceivedPayload_pu8)
Validates whether the received payload represents a "Ready"-Information. If so and a callback has bee...
static uint16_t GetCurrentTarget_u16()
bool GetParameterSystemCalibrationState_b()
Blocking Request to read whether the current sensor has been calibrated.
bool SetParameterADCFixedFrameRate(uint8_t FrameRate_u8)
Blocking Request to set the fixed framerate for current target sensor.
@ SIGPRO_PARAM_BYTE_ENABLE_DIRECT_MULTIPATH_FILTER
#define STANDARD_GET_MESSAGE_LEN
uint16_t WaitForSessionEnd()
Blocking Function call to wait for SessionEnd Payload.
bool SetParameterTransducerVolume(uint8_t Volume_u8)
Blocking Request to set the Transducer Volume for current target sensor.
ADCDump_t * GetADCDumpData(uint16_t Sender_u16)
Interface function to get current ADC-Dump from SenderId.
#define UART_PAYLOAD_START_OFFSET
bool SetParameterSignalProcessingEnableMultipathFilter(bool Enable_b)
Blocking Request to enable near the multipath filter for current target sensor.
void RegisterSessionStartCallback(void(*Callback)(uint16_t Sender_u16))
Interface function to register a callback function that is called whenever an SessionStart Payload is...
#define NUMBER_OF_ADC_DUMP_DATAPOINTS_PER_LINE
Maximum Number of Datapoints copied from a ADC-Dump Data-Frame.
void SetADCSessionStateExpected(uint16_t TargetSensorId_u16)
static int8_t GetCurrentSendersSessionIndex(uint16_t SenderId_u16)
@ CALIBRATION_STAGE_RESONANT_FREQ
#define LOGGING_ISSUE_BYTE_2
static pthread_mutex_t mutex_currentstatusinformant
static pthread_mutex_t mutex_knownsensor
@ LOG_CAT_SIGNAL_PROCESSING
void ParseStringLogMessageToText(char *Output_p8, const uint8_t *ReceivedPayload_pu8)
Parses string log messages into human readable text.
static void PrintADCBlob(uint16_t SenderId_u16)
Debug Function to print.
@ CALIBRATION_ISSUE_CALIBRATION_PROGRESS
bool SetParameterTransducerNumOfPulses(uint8_t NumOfPulses_u8)
Blocking Request to set the Number of Transducer Pulses for current target sensor.
static void AddInterfaceToInterfaceList(CommsInterfaceType_t SensorInterface_t, char *InterfaceName_cp)
@ SIG_PRO_ISSUE_NEAR_FIELD_DETECTION_DISABLED
uint8_t GetParameterADCFixedFrameRate_u8()
Blocking Request to read the current set ADC-Framerate from current sensor.
static void(* ADCDumpStartRequestCallback)(uint16_t Sender_u16, uint32_t ADCDumpSize_u32)
@ TRANSDUCER_PARAM_BYTE_NUMBER_PULSES
@ BL_STATUS_HW_VERSION_ERROR
static bool ParseMessage_b(uint16_t SenderId_u16, uint8_t *msg, uint8_t len)
Iterates the payload over all known message types, which in turn trigger their actions....
#define MULTICAST_ID
CAN-ID used if commands shall be send to all Sensors for example, to determine active sensors in the ...
uint8_t * GetResponsePayloadFromACKStatus(ACK_Status_t *ackstatus)
Is called internally to extract the payload of a response.
Point1D_t Point1D_tp[MAX_NUMBER_OF_POINTS_PER_SESSION]
static uint16_t CurrentTarget_u16
static bool ValidateUARTChecksum(UART_Msg_t *ReceivedUARTMsg_pt)
void ACKSessionStart(uint16_t TargetSensor_u16)
Accept session start for the target sensor.
@ CONTROL_BYTE_BEGIN_POINT_OUTPUT_SESSION
bool SetParameterSignalProcessingNoiseLevelThresholdFactor(float Factor_f)
Blocking Request to set the Noise Level Threshold Factor for current target sensor.
@ SIG_PRO_ISSUE_NO_ECHOES_FOUND
@ SYS_PARAM_BYTE_CALIBRATION_STATE
uint8_t GetNumberOfKnownSensors()
Returns number of known sensors. With GetKnownSensors() users an pointer to an array containing the I...
static bool StartNewSessionRecord_b(uint16_t SenderId_u16, const uint8_t *ReceivedPayload_pu8)
Starts a new point session recording for the given sender ID. The new session is initialized with the...
UARTMessageState_t CurrentMessageState
This file contains the linux-can-socket interface prototypes.
@ POINT_TYPE_BYTE_NEAR_FIELD
static void SetResponsePayloadForACKStatus(ACK_Status_t *ackstatus, uint8_t *payload, uint16_t len)
static void UARTReadCallback(uint8_t *ReceivedUARTMsg_pu8, uint16_t UARTMsgLength_u16, uint8_t InterfaceId_u8)
This function can be registered in uart-interfaces as callback to be called if a uart message is rece...
bool RequestMeasurement()
Send's a request to start a new measurement.
void RegisterADCDumpSessionEndCallback(void(*Callback)(uint16_t Sender_u16))
Interface function to register a callback function that is called whenever an SessionEnd Payload for ...
uint8_t NumberOfActiveSessions_u8
void ACKADCDumpStart(uint16_t TargetSensor_u16)
Accept ADCDump start for the target sensor.
static uint8_t NumberOfKnownSensors_u8
bool SetParameterSystemLogLevel(LogLevel_t LogLevel_t)
Blocking Request to set the Loglevel for current target sensor.
static Sensor_t KnownSensors[MAX_NUMBER_OF_SENSORS_ON_BUS]
@ SIG_PRO_ISSUE_NO_VALID_POINTS_FOUND
static void SendViaCAN(uint8_t *payload, uint16_t length)
static Interface_t KnownInterfaces_tp[MAX_NUMBER_OF_SENSORS_ON_BUS]
@ ACTION_BYTE_STORE_SETTINGS
@ SC_STATUS_TRANSDUCER_MALFUNCTION
static sem_t wait_adc_session_end_sem
uint16_t WaitForReady()
Blocking Function call to wait for Ready Payload.
uint8_t NumberOfPoints_u8
@ PARAM_GROUP_BYTE_SIGNAL_PROCESSING
void ParseLogMessageToText(char *Output_p8, uint16_t SenderId_u16, const uint8_t *ReceivedPayload_pu8)
Parses log messages into human readable text.
static pthread_mutex_t mutex_currentsessions
uint8_t CurrentPayloadIndex_u8
void ParseSelfCheckLogMessageToText(char *Output_p8, const uint8_t *ReceivedPayload_pu8)
Parses self check specific log messages into human readable text.
void * WaitForSessionStartTimeout(void *vargp)
@ TRANSDUCER_PARAM_BYTE_VOLUME
#define TIMEOUT_M_SECONDS
@ SW_ISSUE_STORING_FACTORY_DEFAULTS_IN_FLASH
void WaitForACK(uint8_t *payload, uint16_t length_u16)
This function is called from blocking Set* Functions and blocks until the wait_ack_sem is unlocked by...
static pthread_mutex_t mutex_numberofsensorsackisexpectedfrom
static pthread_mutex_t mutex_getdatafromsensor
static bool CloseSessionRecord_b(uint16_t SenderId_u16)
static const char * kResetReasonStrings[]
enum SensorMode_t SensorMode
@ SW_ISSUE_REBOOT_REQUIRED
static void(* RdyCallback)(uint16_t Sender_u16)
#define REQUEST_RESPONSE_INDEX
If a Getter-Function is called while current sender is multicast id, this index of CurrentACKStatus....
static pthread_mutex_t mutex_knownsensors
static bool IsADCDataFrame_b(uint16_t SenderId_u16, uint8_t *ReceivedPayload_pu8, uint8_t len)
Validates whether the received payload represents an ADC-Data Message. If so and there is an open adc...
static SessionState_t GetSessionStateFromSensorSession(Sensor_Session_t *session)
static bool IsSessionEndFrame_b(uint16_t SenderId_u16, const uint8_t *ReceivedPayload_pu8)
Validates whether the received message contains an EOS command. If so, CloseSessionRecord_b or CloseA...
@ CALIBRATION_ISSUE_BAD_FRAME
@ PARAM_GROUP_BYTE_TRANSDUCER
#define FLOAT_CONVERSION_FACTOR
Sensor delivers data in 0.001 degree. This factor is usesed do calculate from and to degree.
@ CALIBRATION_ISSUE_INIT_ERROR
#define SET_U8_LEN
Number of Bytes that needs to be transmitted if 1 U8 value is set via a set-parameter function.
@ SC_STATUS_MIC_MALFUNCTION
@ BL_STATUS_APP_VERSION_ERROR
bool GetADCSessionComplete_b(uint16_t TargetSensorId_u16)
static bool ConnectedToUSB_b
static Sensor_Session_t * GetCurrentSessionsActiveSessions(uint8_t index)
static bool ActionRequestSuccessful_b(const uint8_t *request, const uint8_t *response)
Compares request and response payload and validates if the response indicates a success of the reques...
uint16_t GetParameterSystemNodeID_u16()
Blocking Request to read the current NodeID setting from current sensor.
@ BL_STATUS_EXPECTED_PACKET
static pthread_t timeoutID
int WriteUARTPayload(uint8_t *Payload_pu8, uint8_t Length_u8, uint8_t InterfaceId_u8)
Called to send messages to can socket.
static bool GetWaitForACKFromACKStatus(ACK_Status_t *ackstatus)
#define LOGGING_ISSUE_BYTE_1
uint8_t NumberOfActiveSessions_u8
@ SW_ISSUE_SAVE_FROM_FLASH_FAILED
static void PrintKnownSensors()
static bool IsACKResponse_b(const uint8_t *ReceivedPayload_pu8)
Validates whether the received message contains an ACK message. No more feature atm.
@ SYS_PARAM_BYTE_LOG_LEVEL
static uint8_t GetCurrentSessionsNumberOfActiveSessions_u8()
static void SetNumberOfSensorsACKIsExpectedFrom(uint8_t newvalue)
@ ACK_STATUS_BYTE_SUCCESS
Sensor_Session_t * GetSessionData(uint16_t Sender_u16)
Interface function to query current session-data (ongoing and closed session)
uint16_t GetU16FromTwoArgumentPayload_u16(const uint8_t *Payload_pu8)
Is called from Getter functions to extract values from payload. In this case a uint16-value.
@ SIG_PRO_ISSUE_TRACKING_ERROR
int32_t GetI32FromPayload_i32(const uint8_t *Payload_pu8)
Is called from Getter functions to extract values from payload. In this case a i32-value.
bool GetSessionRunning_b(uint16_t TargetSensorId_u16)
uint16_t InterfaceSensorId_u16
uint8_t GetParameterSignalProcessingHumidity_u8()
Blocking Request to read the current Transducer Humidity setting from current sensor.
uint32_t ReceivedDumpSize_u32
#define CAN_MAX_FRAME_LEN
static void(* LogMsgCallback)(uint16_t Sender_u16, uint8_t *ReceivedPayload_pu8)
void InitInterface(char *InterfaceName, uint32_t DataRate_u32, CommsInterfaceType_t Interface_t)
Instruction to initialize the specified interface with the specified bit rate. Will also initialize t...
#define LOGGING_CATEGORY_BYTE
#define LOGGING_ISSUE_BYTE_3
SessionState_t SessionState
@ SYS_PARAM_BYTE_SENSOR_MODE
@ UART_MESSAGE_STATE_TRANSMIT_COMPLETE
bool GetParameterADCUseFixedFrameRate_b()
Blocking Request to read the "Use fixed framerate" value from current sensor.
static void SendViaUART(uint8_t *payload, uint16_t length, uint8_t InterfaceId_u8)
@ SENSOR_MODE_CONTINUOUS_TRANSMIT_LISTEN
@ ADC_PARAM_BYTE_FRAME_RATE
static bool EvaluateACKStatus_b(uint16_t SenderId_u16, uint8_t *ReceivedPayload_pu8)
Validates whether the received message was sent by one of the sensors we expect an answer from and,...
static void SetACKForACKStatus(ACK_Status_t *ackstatus, bool ack)
@ ACTION_BYTE_LOAD_SETTINGS
static bool IsNoiseLevelFrame_b(uint16_t SenderId_u16, const uint8_t *ReceivedPayload_pu8)
Validates whether the received point-data-payload is a noise-level-information. If so,...
static void SetCurrentStatusInformant_u16(uint16_t newvalue)
Session_Data_t CurrentSessions
static uint8_t wait_ack_payload_pu8[CAN_MAX_FRAME_LEN]
#define START_ADC_DUMP_SESSION_ACK_LEN
static sem_t wait_ack_sem
@ SIG_PRO_ISSUE_POINT_BUFFER_FULL
bool GetParameterSignalProcessingEnableMultipathFilter_b()
Blocking Request to read whether the multipath filter is enabled in the current sensor.
Sensor_Session_t ActiveSessions[MAX_NUMBER_OF_SENSORS_ON_BUS]
@ CALIBRATION_ISSUE_CALIBRATION_FINISHED
static Sensor_t * GetKnownSensor(uint8_t index)
@ SYS_PARAM_BYTE_MCU_TEMPERATURE
bool SetParameterSystemSensorMode(SensorMode_t Mode_t)
Blocking Request to set the Sensor Mode for current target sensor.
static pthread_mutex_t mutex_currentackstatus
uint8_t CalculateUARTChecksum(const uint8_t *Payload_pu8, uint8_t PayloadLength_u8)
This file contains the linux-uart interface prototypes.
#define LOGGING_SEVERITY_BYTE
static bool CloseADCSessionRecord_b(uint16_t SenderId_u16)
@ SIGPRO_PARAM_BYTE_ENABLE_NEAR_FIELD_DETECTION
bool RequestADCDump()
Request selected sensor to create an ADC-Dump.
uint8_t Payload_pu8[CAN_MAX_FRAME_LEN]
@ CALIBRATION_ISSUE_NOT_CALIBRATED
bool GetADCSessionRunning_b(uint16_t TargetSensorId_u16)
void SetSessionStateExpected(uint16_t TargetSensorId_u16)
static void AddSenderToKnownSensors(uint16_t Sender_u16, uint8_t SensorInterfaceIndex_u8)
Tries to add the station with the Sender_u32 list of known stations.
TFSIMD_FORCE_INLINE tfScalar length(const Quaternion &q)
@ SIGPRO_PARAM_BYTE_NOISE_LEVEL_THRESHOLD_FACTOR
#define MAX_NUMBER_OF_POINTS_PER_SESSION
Upper Limit of suppored POINT Data per Point Data Session. 3D OR 2D. A maximum of 2x as much point da...
static sem_t wait_session_start_sem
@ SIG_PRO_ISSUE_INIT_ERROR
static uint8_t * GetWaitACKPayload()
uint16_t WaitForSessionStart()
Blocking Function call to wait for SessionStart Payload.
@ SYS_PARAM_BYTE_RESET_REASON
int SetupUARTPort(char *InterfaceName_cp, uint32_t InterfaceBitrate_u32, uint8_t InterfaceId_u8)
Called from the library, this function will take care of all linux-related uart-setup,...
#define UART_START_FLAG_IDX
void ParseCalibrationLogMessageToText(char *Output_p8, const uint8_t *ReceivedPayload_pu8)
Parses calibration related log messages into human readable text.
int32_t GetI32FromTwoArgumentPayload_i32(const uint8_t *Payload_pu8)
Is called from Getter functions to extract values from two argument payload. In this case a i32-value...
static uint16_t GetSenderIdFromSensorSession(Sensor_Session_t *session)
uint32_t ExpectedDumpSize_u32
static pthread_mutex_t mutex_currenttarget
@ SIGPRO_PARAM_BYTE_RELATIVE_HUMIDITY
@ ACTION_BYTE_MEASUREMENT
static bool GetACKFromACKStatus(ACK_Status_t *ackstatus)
@ UART_MESSAGE_STATE_IN_TRANSMIT_READ_PAYLOAD
@ SC_STATUS_PGA_CANNOT_CHECK
struct UART_Msg_t UART_Msg_t
static void SetSenderIdForACKStatus(ACK_Status_t *ackstatus, uint16_t senderId)
uint8_t GetParameterSignalProcessingNoiseRatioThreshold_u8()
Blocking Request to read the current Noise Ratio Threshold from current sensor.
This file contains the highlevel interface prototypes to the low-level Protocol.
@ SIGPRO_PARAM_BYTE_NOISE_RATIO_THRESHOLD
void RegisterLogMsgCallback(void(*Callback)(uint16_t Sender_u16, uint8_t *ReceivedPayload_pu8))
Interface function to register a callback function that is called whenever a Logmessage Payload is re...
float GetParameterSystemMCUTemperature_f()
Blocking Request to read the current MCU Temperature from current sensor.
static bool AllSessionsClosed_b()
static uint16_t GetUARTNodeId(uint8_t InterfaceId_u8)
@ BL_STATUS_NOT_RDY_TO_LAUNCH
static void ReplaceIdInListOfKnownSensors(uint16_t OldId_u16, uint16_t NewId_u16)
Replaces one known sensor-id with another. Called if Change-Node-Id Request is executed.
bool SetParameterSignalProcessingHumidity(uint8_t Humidity_u8)
Blocking Request to set the Humidity for current target sensor.
@ CONTROL_BYTE_TRIGGER_ACTION
float GetParameterSignalProcessingNoiseLevelThresholdFactor_f()
Blocking Request to read the current Noise Level Threshold Factor from current sensor.
bool RequestStoreSettings()
Request selected sensor to store current settings.
@ PARAM_GROUP_BYTE_SYSTEM
static void RemoveSenderFromList(uint16_t Sender_u16)
Will remove Sender_u16 from list of known sensors.
static bool GetConnectedToCANBus()
static void WaitForACKNoSend(uint8_t *payload)
void RegisterADCDumpStartRequestCallback(void(*Callback)(uint16_t Sender_u16, uint32_t ADCDumpSize_32))
Interface function to register a callback function that is called whenever an ADC-Dump Start Payload ...
Point3D_t Point3D_tp[MAX_NUMBER_OF_POINTS_PER_SESSION]
static pthread_mutex_t mutex_waitackpayload
static bool IsSessionStartFrame_b(uint16_t SenderId_u16, const uint8_t *ReceivedPayload_pu8)
Validates whether the received message contains an Session-Start command. If so, StartNewSessionRecor...
@ SIG_PRO_ISSUE_TIMER_ERROR
ADCDump_t Dumps[MAX_NUMBER_OF_SENSORS_ON_BUS]
static uint8_t NumberOfSensorsACKIsExpectedFrom_u8
char InterfaceName[DEVICE_NAME_LEN]
static pthread_mutex_t mutex_connectedtocanbus
void RegisterUARTReadCallback(void(*Callback)(uint8_t *UARTMsg_pu8, uint16_t UARTMsgSize_u16, uint8_t InterfaceId_u8))
This function is called by the library to set a callback function for incoming can-traffic.
bool SetParameterSystemNodeID(uint16_t NodeID_u16)
Blocking Request to set a new NodeID for current target sensor.
@ SYS_PARAM_BYTE_SENSOR_STATE
@ STATE_BL_PROCESSING_APP
uint8_t ResponsePayload_pu8[CAN_MAX_FRAME_LEN]
static ACK_Status_t CurrentACKStatus[MAX_NUMBER_OF_SENSORS_ON_BUS]
static uint8_t NumberOfSensorsASessionStartIsExpectedFrom_u8
static void Init_Semaphores()
Inits all Semaphores needed for Operation. If more Semaphores are added, init them here,...
static bool IsLogMessage(uint16_t SenderId_u16, uint8_t *ReceivedPayload_pu8)
Validates whether the received payload represents a LogMessage. If so and a callback has been registe...
static bool AllSessionsActive_b()
static void ConfigureACKStatus(uint8_t *payload)
This function is called from WaitForACK and configures CurrentACKStatus-Struct-Array....
@ BL_STATUS_MULTI_INIT_ERROR
bool SetParameterSignalProcessingEnableAutoGain(bool Enable_b)
Blocking Request to enable auto gain for current target sensor.
static bool AllADCSessionsClosed_b()
void ParseResetReasonLogMessageToText(char *Output_p8, const uint8_t *ReceivedPayload_pu8)
@ SIGPRO_PARAM_BYTE_TEMPERATURE
static uint16_t GetSenderIdFromACKStatus(ACK_Status_t *ackstatus)
bool SetParameterSignalProcessingTemperature(float Temperature_f)
Blocking Request to set the Temperature for current target sensor.
#define UART_OVERHEAD_LENGTH
#define SET_U32_LEN
Number of Bytes that needs to be transmitted if 1 U32 value is set via a set-parameter function.
static uint16_t CurrentStatusInformant_u16
@ UART_MESSAGE_STATE_IN_TRANSMIT_SIZE_UNKNOWN
uint8_t GetU8FromPayload_u8(const uint8_t *Payload_pu8)
Is called from Getter functions to extract values from payload. In this case a uint8-value.
static void PrintKnownInterfaces()
bool RequestWasSuccessful_b()
static sem_t wait_ready_sem
@ POINT_TYPE_BYTE_NOISE_LEVEL
#define SET_U16_LEN
Number of Bytes that needs to be transmitted if 1 U16 value is set via a set-parameter function.
uint8_t NumberOfKnownInterfaces_u8
#define SUBCONTROL_BYTE_IDX
static int8_t GetCurrentSendersADCSessionIndex(uint16_t SenderId_u16)
void RegisterPointSessionEndCallback(void(*Callback)(uint16_t Sender_u16))
Interface function to register a callback function that is called whenever an SessionEnd Payload is r...
toposens_echo_driver
Author(s): Tobias Roth
, Dennis Maier , Baris Yazici
autogenerated on Wed Mar 2 2022 01:12:32