ParaLib 2.0.15-master SHA: 2e03d68caa
PARA_Stream.c File Reference

Parameter-Interface for connection with a PC. More...

#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "PARA_Lib.h"

Functions

int32_t StreamReadParameterData_Value (Parameter_InfoHeader *info, uint8_t *destination, int32_t MaxCount, uint32_t offset, ParameterAccessSource Access, uint8_t AccessLevel)
 Read Parameter-data into buffer (Variant 1) The Data of the selected parameter is read and stored into a given buffer address. More...
 
__WEAK void OnParameterWrite (Parameter_InfoHeader *info, uint8_t *source)
 Hook which is called before parameter-value is changed. More...
 
int32_t StreamWriteParameterData_Value (Parameter_InfoHeader *info, uint8_t *source, uint32_t offset, ParameterAccessSource Access, uint8_t AccessLevel)
 Write Parameter-data from buffer (Variant 1) The Data of the given buffer is written to parameter. More...
 
int32_t StreamReadParameterData_Value2 (Parameter *p, uint16_t subID, unsigned char *destination, int MaxCount, uint32_t offset, ParameterAccessSource Access, unsigned char AccessLevel)
 Read Parameter-data into buffer (Variant 2) The Data of the selected parameter is read and stored into a given buffer address. More...
 
int32_t StreamWriteParameterData_Value2 (Parameter *p, uint16_t subID, unsigned char *source, uint32_t offset, ParameterAccessSource Access, unsigned char AccessLevel, uint16_t count)
 Write Parameter-data from buffer (Variant 2) The Data of the given buffer is written to parameter. More...
 
int32_t StreamWriteStringParameter (Parameter *p, uint16_t StartSubID, uint16_t count, unsigned char *destination, uint32_t *MaxCount, ParameterAccessSource Access, unsigned char AccessLevel)
 Read String Parameter-data into buffer (Variant 1) The Data of the selected string-parameter is read and stored into a given buffer address. More...
 
int32_t StreamWriteStringParameter2 (Parameter *p, uint16_t StartSubID, uint16_t count, unsigned char *destination, uint32_t *MaxSize, ParameterAccessSource Access, unsigned char AccessLevel, unsigned int *StrPos)
 Read String Parameter-data into buffer (Variant 2) The Data of the selected string-parameter is read and stored into a given buffer address. More...
 

Variables

uint16_t g_ui16FlashModified
 Flag to show if the remanent storage is modified. More...
 

Detailed Description

Parameter-Interface for connection with a PC.

Stream Access to Parameter Values.


© Copyright 2017-2022 Copyright: Retostronik GmbH Stütingstraße 30 58285 Gevelsberg

Function Documentation

◆ OnParameterWrite()

__WEAK void OnParameterWrite ( Parameter_InfoHeader info,
uint8_t *  source 
)

Hook which is called before parameter-value is changed.

This Function is a weak empty function, which can be used to run a hook before the patameter value is changed. It can be used to log every parameter change into a logfile. It is called before the data change is performed, in this function the old parameter-value can be accessed. The new value is given in the parameter source -> new and old value can be written ot the logfile if neccessary.

Parameters
infoParameter_InfoHeader which contains Parameter-id and Sub-id of the processed parameter.
sourceData to write into the parameter.

◆ StreamReadParameterData_Value()

int32_t StreamReadParameterData_Value ( Parameter_InfoHeader info,
uint8_t *  destination,
int32_t  MaxCount,
uint32_t  offset,
ParameterAccessSource  Access,
uint8_t  AccessLevel 
)

Read Parameter-data into buffer (Variant 1) The Data of the selected parameter is read and stored into a given buffer address.

The buffer must be in device memory. The size of the buffer must be at least MaxCount bytes. The data-size can be limited and an offset (start) can be set. with these parameters it is possible to split the data into several smaller buffer portions to transmit data with an interface with smaller pacjet size than parameter-data size. If access is not permitted, data size 0 is returned. In this variant the Parameter-id and sub-id is given, the parameter is searched in memory with these vaules.

Parameters
infoParameter_InfoHeader which contains Parameter-id and Sub-id of the processed parameter.
destinationBuffer to store the data.
MaxCountBuffer size of the output buffer / maximum stpored data size into output buffer.
offsetStart position of the data.
AccessSource of access (see Access restrictions).
AccessLevelActual AccessLevel (see Access restrictions).
Returns
Data size which is stored into destination buffer

◆ StreamReadParameterData_Value2()

int32_t StreamReadParameterData_Value2 ( Parameter p,
uint16_t  subID,
unsigned char *  destination,
int  MaxCount,
uint32_t  offset,
ParameterAccessSource  Access,
unsigned char  AccessLevel 
)

Read Parameter-data into buffer (Variant 2) The Data of the selected parameter is read and stored into a given buffer address.

The buffer must be in device memory. The size of the buffer must be at least MaxCount bytes. The data-size can be limited and an offset (start) can be set. with these parameters it is possible to split the data into several smaller buffer portions to transmit data with an interface with smaller pacjet size than parameter-data size. If access is not permitted, data size 0 is returned. In this variant a pointer to the Parameter is given, the parameter has not to be searched in memory withparameter-id and therefore it is faster than variant 1.

Parameters
pPointer to the Parameter.
subIDSub-ID to be read.
destinationBuffer to store the data.
MaxCountBuffer size of the output buffer / maximum stored data size into output buffer.
offsetStart position of the data.
AccessSource of access (see Access restrictions).
AccessLevelActual AccessLevel (see Access restrictions).
Returns
Data size which is stored into destination buffer

◆ StreamWriteParameterData_Value()

int32_t StreamWriteParameterData_Value ( Parameter_InfoHeader info,
uint8_t *  source,
uint32_t  offset,
ParameterAccessSource  Access,
uint8_t  AccessLevel 
)

Write Parameter-data from buffer (Variant 1) The Data of the given buffer is written to parameter.

The buffer must be in device memory. The buffer may not contain the complete parameter data, even portions are possible. Due to this, the start offset and the data size can be given with parameters. If access is not permitted, data size 0 is returned. In this variant the Parameter-id and sub-id is given, the parameter is searched in memory with these vaules.

Parameters
infoParameter_InfoHeader which contains Parameter-id and Sub-id of the processed parameter.
sourceBuffer containing the parameter data to be written
offsetStart position of the data.
AccessSource of access (see Access restrictions).
AccessLevelActual AccessLevel (see Access restrictions).
Returns
Data size which is stored into parameter data

◆ StreamWriteParameterData_Value2()

int32_t StreamWriteParameterData_Value2 ( Parameter p,
uint16_t  subID,
unsigned char *  source,
uint32_t  offset,
ParameterAccessSource  Access,
unsigned char  AccessLevel,
uint16_t  count 
)

Write Parameter-data from buffer (Variant 2) The Data of the given buffer is written to parameter.

The buffer must be in device memory. The buffer may not contain the complete parameter data, even portions are possible. Due to this, the start offset and the data size can be given with parameters. If access is not permitted, data size 0 is returned. In this variant a pointer to the Parameter is given, the parameter has not to be searched in memory withparameter-id and therefore it is faster than variant 1.

Parameters
pPointer to the Parameter.
subIDSub-ID to be write.
sourceBuffer containing the parameter data to be written.
offsetStart position of the data.
AccessSource of access (see Access restrictions).
AccessLevelActual AccessLevel (see Access restrictions).
countNumber of SubIDs to process
Returns
Data size which is stored into parameter data

◆ StreamWriteStringParameter()

int32_t StreamWriteStringParameter ( Parameter p,
uint16_t  StartSubID,
uint16_t  count,
unsigned char *  destination,
uint32_t *  MaxCount,
ParameterAccessSource  Access,
unsigned char  AccessLevel 
)

Read String Parameter-data into buffer (Variant 1) The Data of the selected string-parameter is read and stored into a given buffer address.

In this function not only one sub-id is read, but the complete data of all sub-ids. The data of one sub-id is not cut -> the length of the buffer mist be larger of every sub-id length. If the next sub-id datalength is larger, than remaining buffer size, the functions returns. It is mainly used by an ethernet-interface, bacause one ethernet-frame can be store normally much more data that one sub-id and therefore it is more efficient to process all sub-ids at once. The buffer must be in device memory. The size of the buffer must be at least MaxCount bytes. The data-size can be limited and an offset (start) can be set. with these parameters it is possible to split the data into several smaller buffer portions to transmit data with an interface with smaller packet size than parameter-data size. If access is not permitted, data size 0 is returned.

Parameters
pPointer to the Parameter.
StartSubIDSub-ID to start the data read.
countNumber of sub-ids to process.
destinationBuffer to store the data.
MaxCountPointer to the Buffer size of the output buffer / maximum stpored data size into output buffer. After processing this function the pointer haleds the data size of the destination-buffer which is used.
AccessSource of access (see Access restrictions).
AccessLevelActual AccessLevel (see Access restrictions).
Returns
Number of sub-ids which were copied.

◆ StreamWriteStringParameter2()

int32_t StreamWriteStringParameter2 ( Parameter p,
uint16_t  StartSubID,
uint16_t  count,
unsigned char *  destination,
uint32_t *  MaxSize,
ParameterAccessSource  Access,
unsigned char  AccessLevel,
unsigned int *  StrPos 
)

Read String Parameter-data into buffer (Variant 2) The Data of the selected string-parameter is read and stored into a given buffer address.

In this function not only one sub-id is read, but the complete data of all sub-ids. The data of one sub-id is cut, if the buffer-size is not large enough to held the complete data of the actual sub-id, the matching part is copied to the buffer. The string position is returned in the parameter StrPos. This Variant should be used, if strings are large, even larger than buffer size. It is mainly used by an ethernet-interface, bacause one ethernet-frame can be store normally much more data that one sub-id and therefore it is more efficient to process all sub-ids at once. The buffer must be in device memory. The size of the buffer must be at least MaxCount bytes. The data-size can be limited and an offset (start) can be set. with these parameters it is possible to split the data into several smaller buffer portions to transmit data with an interface with smaller packet size than parameter-data size. If access is not permitted, data size 0 is returned.

Parameters
pPointer to the Parameter.
StartSubIDSub-ID to start the data read.
countNumber of sub-ids to process.
destinationBuffer to store the data.
MaxSizePointer to the Buffer size of the output buffer / maximum stpored data size into output buffer. After processing this function the pointer haleds the data size of the destination-buffer which is used.
AccessSource of access (see Access restrictions).
AccessLevelActual AccessLevel (see Access restrictions).
StrPosPosition of the last Sub-ID which does not match completely into buffer.
Returns
Number of sub-ids which were copied.

Variable Documentation

◆ g_ui16FlashModified

uint16_t g_ui16FlashModified

Flag to show if the remanent storage is modified.

On each modification of the stored value, this flag is set. It is displayed in parameter-editor on PC. The flag is resetted on a "save to NV" operation.