summaryrefslogtreecommitdiff
path: root/lcmodule/source/cnh1605204_ldr_transport_layer/source/z_transport.c
blob: 578e176560d000b5a8f98825c8a99c4ede6706ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
/*******************************************************************************
 * Copyright (C) ST-Ericsson SA 2011
 * License terms: 3-clause BSD license
 ******************************************************************************/
/**
 *  @addtogroup ldr_communication_serv
 *  @{
 *    @addtogroup z_family
 *    @{
 *      @addtogroup ldr_transport_layer
 *      @{
 */

/*******************************************************************************
 * Includes
 ******************************************************************************/
#include <stdlib.h>
#include <string.h>

#include "t_basicdefinitions.h"
#include "r_debug.h"
#include "r_z_transport.h"
#include "r_z_network.h"
#include "r_communication_service.h"
#include "r_z_protocol.h"

/*******************************************************************************
 * Declaration of file local functions
 ******************************************************************************/
static ErrorCode_e Z_Process(Communication_t *Communication_p);

/*******************************************************************************
 * File scope types, constants and variables
 ******************************************************************************/

/*******************************************************************************
 * Definition of external functions
 ******************************************************************************/

/*
 * Initializes the transport layer for Z protocol family.
 *
 * @param [in]  Communication_p Communication module context.
 *
 * @retval  E_SUCCESS After successful execution.
 * @retval E_FAILED_TO_INIT_TL unsuccessful initialization.
 * @retval E_ALLOCATE_FAILED failed to allocate memory space.
 */
ErrorCode_e Z_Transport_Initialize(const Communication_t *const Communication_p)
{
    return E_SUCCESS;
}

/*
 * Shut Down the transport layer for Z protocol family.
 *
 * @param [in]  Communication_p Communication module context.
 *
 * @retval E_SUCCESS  After successful execution.
 */
ErrorCode_e Z_Transport_Shutdown(const Communication_t *const Communication_p)
{
    return E_SUCCESS;
}

/*
 * Handles all registered TL processes for Z protocol family.
 *
 * @param [in]  Communication_p Communication module context.
 *
 * @retval  E_SUCCESS After successful execution.
 */
ErrorCode_e Z_Transport_Poll(Communication_t *Communication_p)
{
    return Z_Process(Communication_p);
}


/*
 * Function for sending packet in Z protocol family.
 *
 * @param [in]  Communication_p Communication module context.
 * @param [in]  InputData_p     Pointer to the input data.
 *
 * @retval E_SUCCESS                        After successful execution.
 * @retval E_FAILED_TO_ALLOCATE_COMM_BUFFER Failed to allocate communication
 * buffer.
 */
ErrorCode_e Z_Transport_Send(Communication_t *Communication_p, void *InputDataIn_p)
{
    Z_SendingContent_t SendingContent;

    SendingContent.Size = *((uint8 *)InputDataIn_p);
    SendingContent.Data_p = (uint8 *)InputDataIn_p + 1;

    return Z_Network_TransmiterHandler(Communication_p, &SendingContent);
}

/*******************************************************************************
 * Definition of internal functions
 ******************************************************************************/
/*
 * Handles all registered TL processes for Z protocol family.
 *
 * @param [in]  Communication_p Communication module context.
 *
 * @retval  E_SUCCESS After successful execution.
 */
static ErrorCode_e Z_Process(Communication_t *Communication_p)
{
    ErrorCode_e ReturnValue = E_SUCCESS;

    Z_Network_ReceiverHandler(Communication_p);

    return ReturnValue;
}

/** @} */
/** @} */
/** @} */