[FL-1946] RPC App launch (#758)

* RPC: Add App start, lock status
 - Add RPC commands Application start, lock status acquiring.
 - Write tests for RPC App system.
 - Replace Unit Tests application with CLI command. This is for CI needs and for tests that run application.
* Fix NDEBUG build
* Update PB submodule
* Fix RPC print (ENABLE DEBUG PRINT!)
* snprintf -> string_t
* Fix Hard Fault (early mutex free)
* printf -> string_t, format, enable tests
* Update submodule: protobuf
* Applications: rollback unit test naming scheme.

Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
This commit is contained in:
Albert Kharisov
2021-10-13 19:39:37 +04:00
committed by GitHub
parent a643bd14be
commit 1db29eaea8
16 changed files with 494 additions and 96 deletions

View File

@@ -0,0 +1,18 @@
/* Automatically generated nanopb constant definitions */
/* Generated by nanopb-0.4.5 */
#include "application.pb.h"
#if PB_PROTO_HEADER_VERSION != 40
#error Regenerate this file with the current version of nanopb generator.
#endif
PB_BIND(PB_App_Start, PB_App_Start, AUTO)
PB_BIND(PB_App_LockStatusRequest, PB_App_LockStatusRequest, AUTO)
PB_BIND(PB_App_LockStatusResponse, PB_App_LockStatusResponse, AUTO)

View File

@@ -0,0 +1,79 @@
/* Automatically generated nanopb header */
/* Generated by nanopb-0.4.5 */
#ifndef PB_PB_APP_APPLICATION_PB_H_INCLUDED
#define PB_PB_APP_APPLICATION_PB_H_INCLUDED
#include <pb.h>
#if PB_PROTO_HEADER_VERSION != 40
#error Regenerate this file with the current version of nanopb generator.
#endif
/* Struct definitions */
typedef struct _PB_App_LockStatusRequest {
char dummy_field;
} PB_App_LockStatusRequest;
typedef struct _PB_App_Start {
char *name;
char *args;
} PB_App_Start;
typedef struct _PB_App_LockStatusResponse {
bool locked;
} PB_App_LockStatusResponse;
#ifdef __cplusplus
extern "C" {
#endif
/* Initializer values for message structs */
#define PB_App_Start_init_default {NULL, NULL}
#define PB_App_LockStatusRequest_init_default {0}
#define PB_App_LockStatusResponse_init_default {0}
#define PB_App_Start_init_zero {NULL, NULL}
#define PB_App_LockStatusRequest_init_zero {0}
#define PB_App_LockStatusResponse_init_zero {0}
/* Field tags (for use in manual encoding/decoding) */
#define PB_App_Start_name_tag 1
#define PB_App_Start_args_tag 2
#define PB_App_LockStatusResponse_locked_tag 1
/* Struct field encoding specification for nanopb */
#define PB_App_Start_FIELDLIST(X, a) \
X(a, POINTER, SINGULAR, STRING, name, 1) \
X(a, POINTER, SINGULAR, STRING, args, 2)
#define PB_App_Start_CALLBACK NULL
#define PB_App_Start_DEFAULT NULL
#define PB_App_LockStatusRequest_FIELDLIST(X, a) \
#define PB_App_LockStatusRequest_CALLBACK NULL
#define PB_App_LockStatusRequest_DEFAULT NULL
#define PB_App_LockStatusResponse_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, BOOL, locked, 1)
#define PB_App_LockStatusResponse_CALLBACK NULL
#define PB_App_LockStatusResponse_DEFAULT NULL
extern const pb_msgdesc_t PB_App_Start_msg;
extern const pb_msgdesc_t PB_App_LockStatusRequest_msg;
extern const pb_msgdesc_t PB_App_LockStatusResponse_msg;
/* Defines for backwards compatibility with code written before nanopb-0.4.0 */
#define PB_App_Start_fields &PB_App_Start_msg
#define PB_App_LockStatusRequest_fields &PB_App_LockStatusRequest_msg
#define PB_App_LockStatusResponse_fields &PB_App_LockStatusResponse_msg
/* Maximum encoded size of messages (where known) */
/* PB_App_Start_size depends on runtime parameters */
#define PB_App_LockStatusRequest_size 0
#define PB_App_LockStatusResponse_size 2
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@@ -6,6 +6,7 @@
#include <pb.h>
#include "storage.pb.h"
#include "status.pb.h"
#include "application.pb.h"
#if PB_PROTO_HEADER_VERSION != 40
#error Regenerate this file with the current version of nanopb generator.
@@ -28,7 +29,9 @@ typedef enum _PB_CommandStatus {
PB_CommandStatus_ERROR_STORAGE_INVALID_NAME = 10, /* *< Invalid name/path */
PB_CommandStatus_ERROR_STORAGE_INTERNAL = 11, /* *< Internal error */
PB_CommandStatus_ERROR_STORAGE_NOT_IMPLEMENTED = 12, /* *< Functon not implemented */
PB_CommandStatus_ERROR_STORAGE_ALREADY_OPEN = 13 /* *< File/Dir already opened */
PB_CommandStatus_ERROR_STORAGE_ALREADY_OPEN = 13, /* *< File/Dir already opened */
PB_CommandStatus_ERROR_APP_CANT_START = 16, /* *< Can't start app - either wrong name, or internal error */
PB_CommandStatus_ERROR_APP_SYSTEM_LOCKED = 17 /* *< Another app is running */
} PB_CommandStatus;
/* Struct definitions */
@@ -58,14 +61,17 @@ typedef struct _PB_Main {
PB_Storage_MkdirRequest storage_mkdir_request;
PB_Storage_Md5sumRequest storage_md5sum_request;
PB_Storage_Md5sumResponse storage_md5sum_response;
PB_App_Start app_start;
PB_App_LockStatusRequest app_lock_status_request;
PB_App_LockStatusResponse app_lock_status_response;
} content;
} PB_Main;
/* Helper constants for enums */
#define _PB_CommandStatus_MIN PB_CommandStatus_OK
#define _PB_CommandStatus_MAX PB_CommandStatus_ERROR_INVALID_PARAMETERS
#define _PB_CommandStatus_ARRAYSIZE ((PB_CommandStatus)(PB_CommandStatus_ERROR_INVALID_PARAMETERS+1))
#define _PB_CommandStatus_MAX PB_CommandStatus_ERROR_APP_SYSTEM_LOCKED
#define _PB_CommandStatus_ARRAYSIZE ((PB_CommandStatus)(PB_CommandStatus_ERROR_APP_SYSTEM_LOCKED+1))
#ifdef __cplusplus
@@ -94,6 +100,9 @@ extern "C" {
#define PB_Main_storage_mkdir_request_tag 13
#define PB_Main_storage_md5sum_request_tag 14
#define PB_Main_storage_md5sum_response_tag 15
#define PB_Main_app_start_tag 16
#define PB_Main_app_lock_status_request_tag 17
#define PB_Main_app_lock_status_response_tag 18
/* Struct field encoding specification for nanopb */
#define PB_Empty_FIELDLIST(X, a) \
@@ -116,7 +125,10 @@ X(a, STATIC, ONEOF, MSG_W_CB, (content,storage_write_request,content.storag
X(a, STATIC, ONEOF, MSG_W_CB, (content,storage_delete_request,content.storage_delete_request), 12) \
X(a, STATIC, ONEOF, MSG_W_CB, (content,storage_mkdir_request,content.storage_mkdir_request), 13) \
X(a, STATIC, ONEOF, MSG_W_CB, (content,storage_md5sum_request,content.storage_md5sum_request), 14) \
X(a, STATIC, ONEOF, MSG_W_CB, (content,storage_md5sum_response,content.storage_md5sum_response), 15)
X(a, STATIC, ONEOF, MSG_W_CB, (content,storage_md5sum_response,content.storage_md5sum_response), 15) \
X(a, STATIC, ONEOF, MSG_W_CB, (content,app_start,content.app_start), 16) \
X(a, STATIC, ONEOF, MSG_W_CB, (content,app_lock_status_request,content.app_lock_status_request), 17) \
X(a, STATIC, ONEOF, MSG_W_CB, (content,app_lock_status_response,content.app_lock_status_response), 18)
#define PB_Main_CALLBACK NULL
#define PB_Main_DEFAULT NULL
#define PB_Main_content_empty_MSGTYPE PB_Empty
@@ -131,6 +143,9 @@ X(a, STATIC, ONEOF, MSG_W_CB, (content,storage_md5sum_response,content.stor
#define PB_Main_content_storage_mkdir_request_MSGTYPE PB_Storage_MkdirRequest
#define PB_Main_content_storage_md5sum_request_MSGTYPE PB_Storage_Md5sumRequest
#define PB_Main_content_storage_md5sum_response_MSGTYPE PB_Storage_Md5sumResponse
#define PB_Main_content_app_start_MSGTYPE PB_App_Start
#define PB_Main_content_app_lock_status_request_MSGTYPE PB_App_LockStatusRequest
#define PB_Main_content_app_lock_status_response_MSGTYPE PB_App_LockStatusResponse
extern const pb_msgdesc_t PB_Empty_msg;
extern const pb_msgdesc_t PB_Main_msg;
@@ -141,9 +156,9 @@ extern const pb_msgdesc_t PB_Main_msg;
/* Maximum encoded size of messages (where known) */
#define PB_Empty_size 0
#if defined(PB_Storage_ListRequest_size) && defined(PB_Storage_ListResponse_size) && defined(PB_Storage_ReadRequest_size) && defined(PB_Storage_ReadResponse_size) && defined(PB_Storage_WriteRequest_size) && defined(PB_Storage_DeleteRequest_size) && defined(PB_Storage_MkdirRequest_size) && defined(PB_Storage_Md5sumRequest_size)
#if defined(PB_Storage_ListRequest_size) && defined(PB_Storage_ListResponse_size) && defined(PB_Storage_ReadRequest_size) && defined(PB_Storage_ReadResponse_size) && defined(PB_Storage_WriteRequest_size) && defined(PB_Storage_DeleteRequest_size) && defined(PB_Storage_MkdirRequest_size) && defined(PB_Storage_Md5sumRequest_size) && defined(PB_App_Start_size)
#define PB_Main_size (10 + sizeof(union PB_Main_content_size_union))
union PB_Main_content_size_union {char f7[(6 + PB_Storage_ListRequest_size)]; char f8[(6 + PB_Storage_ListResponse_size)]; char f9[(6 + PB_Storage_ReadRequest_size)]; char f10[(6 + PB_Storage_ReadResponse_size)]; char f11[(6 + PB_Storage_WriteRequest_size)]; char f12[(6 + PB_Storage_DeleteRequest_size)]; char f13[(6 + PB_Storage_MkdirRequest_size)]; char f14[(6 + PB_Storage_Md5sumRequest_size)]; char f0[36];};
union PB_Main_content_size_union {char f7[(6 + PB_Storage_ListRequest_size)]; char f8[(6 + PB_Storage_ListResponse_size)]; char f9[(6 + PB_Storage_ReadRequest_size)]; char f10[(6 + PB_Storage_ReadResponse_size)]; char f11[(6 + PB_Storage_WriteRequest_size)]; char f12[(6 + PB_Storage_DeleteRequest_size)]; char f13[(6 + PB_Storage_MkdirRequest_size)]; char f14[(6 + PB_Storage_Md5sumRequest_size)]; char f16[(7 + PB_App_Start_size)]; char f0[36];};
#endif
#ifdef __cplusplus