Custom Widget
This is the header file for "psdk_widget.c", defining the structure and (exported) function prototypes.
Catalog
Enum
E_PsdkWidgetType
E_PsdkWidgetButtonState
E_PsdkWidgetSwitchStateStructure
T_PsdkWidgetFileBinaryArray
T_PsdkWidgetBinaryArrayConfig
T_PsdkWidgetHandlerListItemFunction
PsdkWidget_Init
PsdkWidget_RegDefaultUiConfigByDirPath
PsdkWidget_RegUiConfigByDirPath
PsdkWidget_RegDefaultUiConfigByBinaryArray
PsdkWidget_RegUiConfigByBinaryArray
PsdkWidget_RegHandlerList
PsdkWidgetFloatingWindow_ShowMessage
PsdkWidgetFloatingWindow_GetChannelState
Define
The maximum length of a message that can be displayed by the mobile app floating window.
#define PSDK_WIDGET_FLOATING_WINDOW_MSG_MAX_LEN 255
Enum
typedef enum E_PsdkWidgetType
Widget types
typedef enum {
PSDK_WIDGET_TYPE_BUTTON = 1, button widget type
PSDK_WIDGET_TYPE_SWITCH = 2, switch widget type
PSDK_WIDGET_TYPE_SCALE = 3, scale widget type
PSDK_WIDGET_TYPE_LIST = 4, list widget type
PSDK_WIDGET_TYPE_INT_INPUT_BOX = 5, integer input box widget type
} E_PsdkWidgetType;
typedef enum E_PsdkWidgetButtonState
Button widget state
typedef enum {
PSDK_WIDGET_BUTTON_STATE_PRESS_DOWN = 1, Button is pressed down
PSDK_WIDGET_BUTTON_STATE_RELEASE_UP = 0, Button is released up
} E_PsdkWidgetButtonState;
typedef enum E_PsdkWidgetSwitchState
witch widget state
typedef enum {
PSDK_WIDGET_SWITCH_STATE_OFF = 0, Switch is turned off
PSDK_WIDGET_SWITCH_STATE_ON = 1 Switch is turned on
} E_PsdkWidgetSwitchState;
Structure
typedef struct T_PsdkWidgetFileBinaryArray
Widget file binary array
typedef struct {
char *fileName; The file name of the widget file
uint32_t fileSize; The file size of the widget file, uint : byte
const uint8_t *fileBinaryArray; The binary C array of the widget file
} T_PsdkWidgetFileBinaryArray;
typedef struct T_PsdkWidgetBinaryArrayConfig
Widget binary array config
typedef struct {
uint16_t binaryArrayCount; Binary array count
T_PsdkWidgetFileBinaryArray *fileBinaryArrayList; Pointer to binary array list
} T_PsdkWidgetBinaryArrayConfig;
typedef struct T_PsdkWidgetHandlerListItem
Widget handler item
typedef struct {
uint32_t widgetIndex; The index of widget, the index can be numbered
starting from 0 and cannot be repeated
E_PsdkWidgetType widgetType; The type of widget, refer to ::E_PsdkWidgetType
@brief Prototype of callback function used to set widget value, the function will be call when the user triggers the widget.
@param widgetType: the type of widget, refer to ::E_PsdkWidgetType.
@param index: the index of widget.
@param value: the value of widget, need be set.
1. if the widget type is PSDK_WIDGET_TYPE_BUTTON, the value is refer to ::E_PsdkWidgetButtonState;
2. if the widget type is PSDK_WIDGET_TYPE_SWITCH, the value is refer to ::E_PsdkWidgetSwitchState;
3. if the widget type is PSDK_WIDGET_TYPE_SCALE, the value is range from 0 to 100, which represents the percentage of the scale slider;
4. if the Widget type is PSDK_WIDGET_TYPE_LIST, the value is range from 0 to N-1 (N is the value of list item count), which represents which item is chosen;
@param userData: The user data need used in callback
@return Execution result.
T_PsdkReturnCode (*SetWidgetValue)(E_PsdkWidgetType widgetType, uint32_t index, int32_t value, void *userData);
@brief Prototype of callback function used to get widget value.
@param widgetType: the type of widget, refer to ::E_PsdkWidgetType.
@param value: the value of widget.
1. If the widget type is PSDK_WIDGET_TYPE_BUTTON, the value is refer to ::E_PsdkWidgetButtonState;
2. If the widget type is PSDK_WIDGET_TYPE_SWITCH, the value is refer to ::E_PsdkWidgetSwitchState;
3. If the widget type is PSDK_WIDGET_TYPE_SCALE, the value is range from 0 to 100, which represents the percentage of the scale slider;
4. If the Widget type is PSDK_WIDGET_TYPE_LIST, the value is range from 0 to N-1 (N is the value of list item count), which represents which item is chosen;
@param userData: The user data need used in callback
@return Execution result.
T_PsdkReturnCode (*GetWidgetValue)(E_PsdkWidgetType widgetType, uint32_t index, int32_t *value, void *userData);
void *userData; The user data need used in SetWidgetValue and GetWidgetValue callback function.
} T_PsdkWidgetHandlerListItem;
Function
function PsdkWidget_Init
Function:Initialise widget module | product:all |
Initialise widget module, and user should call this function before using widget features.
T_PsdkReturnCode PsdkWidget_Init(void);
Return
The details for the return code please refer to:PsdkErrorCode
function PsdkWidget_RegDefaultUiConfigByDirPath
Function:Register default directory path. | product:all |
Register default widget UI configuration file directory path.
NOTE
- Under Linux system, there are two functions to set the custom widget configuration directory path, function PsdkWidget_RegDefaultConfigByDirPath and PsdkWidget_RegUiConfigByDirPath.
- When you don't need multi-language and multi-screen size support, you can just use PsdkWidget_RegDefaultUiConfigByDirPath function set widget UI config directory path.
- If you need support multi-language and multi-screen size support, you can use function PsdkWidget_RegUiConfigByDirPath to specify widget configuration.
- When the language and screen size is not cover in your setting by PsdkWidget_RegUiConfigByDirPath, the widget UI configuration uses setting by PsdkWiget_RegDefaultUiConfigByDirPath function.
T_PsdkReturnCode PsdkWidget_RegDefaultUiConfigByDirPath(const char *widgetConfigDirPath);
widgetConfigDirPath:the widget UI configuration directory path.
Return
The details for the return code please refer to:PsdkErrorCode
function PsdkWidget_RegUiConfigByDirPath
Function:Register configuration | product:all |
Register widget UI configuration file directory path.
NOTE Different widget UI configurations for several language and screen size require the same widget type, index and count.
T_PsdkReturnCode PsdkWidget_RegUiConfigByDirPath(E_PsdkAircraftInfoMobileAppLanguage appLanguage,
E_PsdkAircraftInfoMobileAppScreenType appScreenType,
const char *widgetConfigDirPath);
appLanguage:mobile app language type.
appScreenType:mobile app screen type.
widgetConfigDirPath:the widget UI configuration directory path.
Return
The details for the return code please refer to:PsdkErrorCode
function PsdkWidget_RegDefaultUiConfigByBinaryArray
Function:Register default widget UI config | product:all |
Register default widget UI config by binary array configuration.
NOTE In RTOS, most likely there is no file system. The widget config file content can use C array express. Use this function and PsdkWidget_RegDefaultUiConfigBinaryArray set widget UI configuration. When the language and screen size is not cover in your setting by PsdkWidget_RegUiConfigByBinaryArray, the widget UI configuration uses setting by this function.
T_PsdkReturnCode PsdkWidget_RegDefaultUiConfigByBinaryArray(const T_PsdkWidgetBinaryArrayConfig *binaryArrayConfig);
binaryArrayConfig: the binary array config for widget UI configuration.
Return
The details for the return code please refer to:PsdkErrorCode
function PsdkWidget_RegUiConfigByBinaryArray
Function:Register widget UI config(binary array) | product:all |
Register widget UI config by binary array configuration.
NOTE Different widget UI configurations for several language and screen size require the same widget type, index and count.
T_PsdkReturnCode PsdkWidget_RegUiConfigByBinaryArray(E_PsdkAircraftInfoMobileAPPLanguage APPLanguage,
E_PsdkAircraftInfoMobileAPPScreenType screenType,
const T_PsdkWidgetBinaryArrayConfig *binaryArrayConfig);
appLanguage:mobile app language type.
screenType:mobile app screen type.
binaryArrayConfig:the binary array config for widget UI configuration.
Return
The details for the return code please refer to:PsdkErrorCode
function PsdkWidget_RegHandlerList
Function:Register handler list | product:all |
Register handler list for widgets.
T_PsdkReturnCode PsdkWidget_RegHandlerList(const T_PsdkWidgetHandlerListItem *widgetHandlerList, uint32_t itemCount);
widgetHandlerList:widget handler list for widgets.
itemCount:the item count of widget handler list.
Return
The details for the return code please refer toPsdkErrorCode
function PsdkWidgetFloatingWindow_ShowMessage
Function:Send message to floating window. | product:all |
Send message to mobile app floating window.
NOTE
- The message length can't more than PSDK_WIDGET_FLOATING_WINDOW_MSG_MAX_LEN.
- The max data bandwidth of floating windows message is 2KB/s.
T_PsdkReturnCode PsdkWidgetFloatingWindow_ShowMessage(const char *str);
str:pointer to message string.
Return
The details for the return code please refer to:PsdkErrorCode
function PsdkWidgetFloatingWindow_GetChannelState
Function:pointer to floating window channel state. | product:all |
Get data transmission state of floating window channel. User can use the state as base for controlling floating windows message send.
T_PsdkReturnCode PsdkWidgetFloatingWindow_GetChannelState(T_PsdkDataChannelState *state);
state:pointer to floating window channel state.
Return
The details for the return code please refer to:PsdkErrorCode