Skip to content

Commit

Permalink
add system apis
Browse files Browse the repository at this point in the history
  • Loading branch information
LynnL4 committed Nov 5, 2020
1 parent 466406e commit b1959a5
Show file tree
Hide file tree
Showing 43 changed files with 998 additions and 320 deletions.
24 changes: 12 additions & 12 deletions erpc_idl/erpc_shim/rpc_ble_api.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Generated by erpcgen 1.7.4 on Tue Nov 3 16:25:43 2020.
* Generated by erpcgen 1.7.4 on Wed Nov 4 11:07:47 2020.
*
* AUTOGENERATED - DO NOT EDIT
*/
Expand All @@ -14,7 +14,7 @@
/*! @brief rpc_ble_host identifiers */
enum _rpc_ble_host_ids
{
krpc_ble_host_service_id = 1,
krpc_ble_host_service_id = 2,
krpc_ble_host_rpc_ble_init_id = 1,
krpc_ble_host_rpc_ble_start_id = 2,
krpc_ble_host_rpc_ble_deinit_id = 3,
Expand All @@ -23,7 +23,7 @@ enum _rpc_ble_host_ids
/*! @brief rpc_gap identifiers */
enum _rpc_gap_ids
{
krpc_gap_service_id = 2,
krpc_gap_service_id = 3,
krpc_gap_rpc_gap_set_param_id = 1,
krpc_gap_rpc_gap_get_param_id = 2,
krpc_gap_rpc_gap_set_pairable_mode_id = 3,
Expand All @@ -32,7 +32,7 @@ enum _rpc_gap_ids
/*! @brief rpc_gap_bone identifiers */
enum _rpc_gap_bone_ids
{
krpc_gap_bone_service_id = 3,
krpc_gap_bone_service_id = 4,
krpc_gap_bone_rpc_le_bond_set_param_id = 1,
krpc_gap_bone_rpc_le_bond_get_param_id = 2,
krpc_gap_bone_rpc_le_bond_pair_id = 3,
Expand All @@ -52,7 +52,7 @@ enum _rpc_gap_bone_ids
/*! @brief rpc_gap_le identifiers */
enum _rpc_gap_le_ids
{
krpc_gap_le_service_id = 4,
krpc_gap_le_service_id = 5,
krpc_gap_le_rpc_le_gap_init_id = 1,
krpc_gap_le_rpc_le_gap_msg_info_way_id = 2,
krpc_gap_le_rpc_le_get_max_link_num_id = 3,
Expand All @@ -69,7 +69,7 @@ enum _rpc_gap_le_ids
/*! @brief rpc_gap_config identifiers */
enum _rpc_gap_config_ids
{
krpc_gap_config_service_id = 5,
krpc_gap_config_service_id = 6,
krpc_gap_config_rpc_gap_config_cccd_not_check_id = 1,
krpc_gap_config_rpc_gap_config_ccc_bits_count_id = 2,
krpc_gap_config_rpc_gap_config_max_attribute_table_count_id = 3,
Expand All @@ -84,7 +84,7 @@ enum _rpc_gap_config_ids
/*! @brief rpc_gap_adv identifiers */
enum _rpc_gap_adv_ids
{
krpc_gap_adv_service_id = 6,
krpc_gap_adv_service_id = 7,
krpc_gap_adv_rpc_le_adv_set_param_id = 1,
krpc_gap_adv_rpc_le_adv_get_param_id = 2,
krpc_gap_adv_rpc_le_adv_start_id = 3,
Expand All @@ -95,7 +95,7 @@ enum _rpc_gap_adv_ids
/*! @brief rpc_gap_scan identifiers */
enum _rpc_gap_scan_ids
{
krpc_gap_scan_service_id = 7,
krpc_gap_scan_service_id = 8,
krpc_gap_scan_rpc_le_scan_set_param_id = 1,
krpc_gap_scan_rpc_le_scan_get_param_id = 2,
krpc_gap_scan_rpc_le_scan_start_id = 3,
Expand All @@ -107,7 +107,7 @@ enum _rpc_gap_scan_ids
/*! @brief rpc_gap_conn identifiers */
enum _rpc_gap_conn_ids
{
krpc_gap_conn_service_id = 8,
krpc_gap_conn_service_id = 9,
krpc_gap_conn_rpc_le_get_conn_param_id = 1,
krpc_gap_conn_rpc_le_get_conn_info_id = 2,
krpc_gap_conn_rpc_le_get_conn_addr_id = 3,
Expand All @@ -126,7 +126,7 @@ enum _rpc_gap_conn_ids
/*! @brief rpc_gap_storage identifiers */
enum _rpc_gap_storage_ids
{
krpc_gap_storage_service_id = 9,
krpc_gap_storage_service_id = 10,
krpc_gap_storage_rpc_flash_save_local_name_id = 1,
krpc_gap_storage_rpc_flash_load_local_name_id = 2,
krpc_gap_storage_rpc_flash_save_local_appearance_id = 3,
Expand All @@ -148,7 +148,7 @@ enum _rpc_gap_storage_ids
/*! @brief rpc_gatt_client identifiers */
enum _rpc_gatt_client_ids
{
krpc_gatt_client_service_id = 10,
krpc_gatt_client_service_id = 11,
krpc_gatt_client_rpc_ble_client_init_id = 1,
krpc_gatt_client_rpc_ble_add_client_id = 2,
krpc_gatt_client_rpc_client_init_id = 3,
Expand All @@ -169,7 +169,7 @@ enum _rpc_gatt_client_ids
/*! @brief rpc_gatt_server identifiers */
enum _rpc_gatt_server_ids
{
krpc_gatt_server_service_id = 11,
krpc_gatt_server_service_id = 12,
krpc_gatt_server_rpc_ble_server_init_id = 1,
krpc_gatt_server_rpc_ble_create_service_id = 2,
krpc_gatt_server_rpc_ble_delete_service_id = 3,
Expand Down
3 changes: 2 additions & 1 deletion erpc_idl/erpc_shim/rpc_ble_api_client.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Generated by erpcgen 1.7.4 on Tue Nov 3 16:25:43 2020.
* Generated by erpcgen 1.7.4 on Wed Nov 4 11:07:47 2020.
*
* AUTOGENERATED - DO NOT EDIT
*/
Expand All @@ -12,6 +12,7 @@ extern "C"
{
#include "rpc_ble_api.h"
// import callbacks declaration from other groups
#include "rpc_system.h"
#include "rpc_ble_callback.h"
#include "rpc_wifi_api.h"
#include "rpc_wifi_callback.h"
Expand Down
2 changes: 1 addition & 1 deletion erpc_idl/erpc_shim/rpc_ble_api_server.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Generated by erpcgen 1.7.4 on Tue Nov 3 16:25:43 2020.
* Generated by erpcgen 1.7.4 on Wed Nov 4 11:07:47 2020.
*
* AUTOGENERATED - DO NOT EDIT
*/
Expand Down
2 changes: 1 addition & 1 deletion erpc_idl/erpc_shim/rpc_ble_api_server.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Generated by erpcgen 1.7.4 on Tue Nov 3 16:25:43 2020.
* Generated by erpcgen 1.7.4 on Wed Nov 4 11:07:47 2020.
*
* AUTOGENERATED - DO NOT EDIT
*/
Expand Down
4 changes: 2 additions & 2 deletions erpc_idl/erpc_shim/rpc_ble_callback.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Generated by erpcgen 1.7.4 on Tue Nov 3 16:25:43 2020.
* Generated by erpcgen 1.7.4 on Wed Nov 4 11:07:47 2020.
*
* AUTOGENERATED - DO NOT EDIT
*/
Expand All @@ -14,7 +14,7 @@
/*! @brief rpc_ble_callback identifiers */
enum _rpc_ble_callback_ids
{
krpc_ble_callback_service_id = 12,
krpc_ble_callback_service_id = 13,
krpc_ble_callback_rpc_ble_handle_gap_msg_id = 1,
krpc_ble_callback_rpc_ble_gap_callback_id = 2,
krpc_ble_callback_rpc_ble_gattc_callback_id = 3,
Expand Down
3 changes: 2 additions & 1 deletion erpc_idl/erpc_shim/rpc_ble_callback_client.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Generated by erpcgen 1.7.4 on Tue Nov 3 16:25:43 2020.
* Generated by erpcgen 1.7.4 on Wed Nov 4 11:07:47 2020.
*
* AUTOGENERATED - DO NOT EDIT
*/
Expand All @@ -12,6 +12,7 @@ extern "C"
{
#include "rpc_ble_callback.h"
// import callbacks declaration from other groups
#include "rpc_system.h"
#include "rpc_ble_api.h"
#include "rpc_wifi_api.h"
#include "rpc_wifi_callback.h"
Expand Down
2 changes: 1 addition & 1 deletion erpc_idl/erpc_shim/rpc_ble_callback_server.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Generated by erpcgen 1.7.4 on Tue Nov 3 16:25:43 2020.
* Generated by erpcgen 1.7.4 on Wed Nov 4 11:07:47 2020.
*
* AUTOGENERATED - DO NOT EDIT
*/
Expand Down
2 changes: 1 addition & 1 deletion erpc_idl/erpc_shim/rpc_ble_callback_server.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Generated by erpcgen 1.7.4 on Tue Nov 3 16:25:43 2020.
* Generated by erpcgen 1.7.4 on Wed Nov 4 11:07:47 2020.
*
* AUTOGENERATED - DO NOT EDIT
*/
Expand Down
37 changes: 37 additions & 0 deletions erpc_idl/erpc_shim/rpc_system.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Generated by erpcgen 1.7.4 on Wed Nov 4 11:07:47 2020.
*
* AUTOGENERATED - DO NOT EDIT
*/


#if !defined(_rpc_system_h_)
#define _rpc_system_h_

// Common types header file
#include "rpc_system_header.h"

/*! @brief rpc_system identifiers */
enum _rpc_system_ids
{
krpc_system_service_id = 1,
krpc_system_rpc_system_version_id = 1,
krpc_system_rpc_system_ack_id = 2,
};

#if defined(__cplusplus)
extern "C" {
#endif

//! @name rpc_system
//@{
char * rpc_system_version(void);

uint8_t rpc_system_ack(uint8_t c);
//@}

#if defined(__cplusplus)
}
#endif

#endif // _rpc_system_h_
126 changes: 126 additions & 0 deletions erpc_idl/erpc_shim/rpc_system_client.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
/*
* Generated by erpcgen 1.7.4 on Wed Nov 4 11:07:47 2020.
*
* AUTOGENERATED - DO NOT EDIT
*/


#include "erpc_client_manager.h"
#include "erpc_port.h"
#include "erpc_codec.h"
extern "C"
{
#include "rpc_system.h"
// import callbacks declaration from other groups
#include "rpc_ble_api.h"
#include "rpc_ble_callback.h"
#include "rpc_wifi_api.h"
#include "rpc_wifi_callback.h"
}

#if 10704 != ERPC_VERSION_NUMBER
#error "The generated shim code version is different to the rest of eRPC code."
#endif

using namespace erpc;
using namespace std;

extern ClientManager *g_client;


// rpc_system interface rpc_system_version function client shim.
char * rpc_system_version(void)
{
erpc_status_t err = kErpcStatus_Success;

char * result = NULL;

// Get a new request.
RequestContext request = g_client->createRequest(false);

// Encode the request.
Codec * codec = request.getCodec();

if (codec == NULL)
{
err = kErpcStatus_MemoryError;
}
else
{
codec->startWriteMessage(kInvocationMessage, krpc_system_service_id, krpc_system_rpc_system_version_id, request.getSequence());

// Send message to server
// Codec status is checked inside this function.
g_client->performRequest(request);

uint32_t return_len;
char * return_local;
codec->readString(&return_len, &return_local);
result = (char *) erpc_malloc((return_len + 1) * sizeof(char));
if (result == NULL)
{
codec->updateStatus(kErpcStatus_MemoryError);
}
else
{
memcpy(result, return_local, return_len);
(result)[return_len] = 0;
}

err = codec->getStatus();
}

// Dispose of the request.
g_client->releaseRequest(request);

// Invoke error handler callback function
g_client->callErrorHandler(err, krpc_system_rpc_system_version_id);

return result;
}

// rpc_system interface rpc_system_ack function client shim.
uint8_t rpc_system_ack(uint8_t c)
{
erpc_status_t err = kErpcStatus_Success;

uint8_t result;

// Get a new request.
RequestContext request = g_client->createRequest(false);

// Encode the request.
Codec * codec = request.getCodec();

if (codec == NULL)
{
err = kErpcStatus_MemoryError;
}
else
{
codec->startWriteMessage(kInvocationMessage, krpc_system_service_id, krpc_system_rpc_system_ack_id, request.getSequence());

codec->write(c);

// Send message to server
// Codec status is checked inside this function.
g_client->performRequest(request);

codec->read(&result);

err = codec->getStatus();
}

// Dispose of the request.
g_client->releaseRequest(request);

// Invoke error handler callback function
g_client->callErrorHandler(err, krpc_system_rpc_system_ack_id);

if (err)
{
return 0xFFU;
}

return result;
}
2 changes: 1 addition & 1 deletion erpc_idl/erpc_shim/rpc_system_header.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Generated by erpcgen 1.7.4 on Tue Nov 3 16:25:43 2020.
* Generated by erpcgen 1.7.4 on Wed Nov 4 11:07:47 2020.
*
* AUTOGENERATED - DO NOT EDIT
*/
Expand Down
Loading

0 comments on commit b1959a5

Please sign in to comment.