~aleteoryx/muditaos

ref: 7d4452f90c40b1b5d3f673f321484c6f418bbea2 muditaos/module-cellular/Modem/TS0710/TS0710_PORTNEG.h -rw-r--r-- 2.4 KiB
7d4452f9 — Bartosz Cichocki [EGD-6052] Add idle BT device disconnect 4 years ago
                                                                                
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) 2017-2020, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

/**
 * Project Untitled
 * @brief The request primitive is used to request that the remote port changes its parameters. The indication is sent
 * to the other port emulation entity. The remote port emulation entity replies with a response. A confirm is sent to
 * the originating port entity.
 */

#ifndef _TS0710_PORTNEG_H
#define _TS0710_PORTNEG_H

#include "TS0710_types.h"

// control channel - Remote Port Negotiation Command (RPN)
// control channel - Remote Line Status Command(RLS)

class TS0710_PORTNEG
{
  public:
    enum DataBits_e
    {
        DB5,
        DB6,
        DB7,
        DB8
    };
    enum PortSpeed_e
    {
        PS2400,
        PS4800,
        PS7200,
        PS9600,
        PS19200,
        PS38400,
        PS57600,
        PS115200,
        PS230400
    };
    enum Parity_e
    {
        NoParity,
        Parity
    };
    enum ParityType_e
    {
        odd,
        even,
        mark,
        space
    };
    enum StopBits_e
    {
        SB1,
        SB15
    };
    enum LineStatusParameter_e
    {
        NoErrors,
        OverrunErr,
        ParityErr,
        FramingErr
    }; //!< Port speed [no errors, overrun error, parity error, framing error]

    struct PortParameters_t
    {
        PortSpeed_e PortSpeed;
        DataBits_e DataBits;
        StopBits_e StopBits;
        Parity_e Parity;
        ParityType_e ParityType;
    };

    TS0710_PORTNEG()
    {}
    ~TS0710_PORTNEG()
    {}

  private:
    /**
     * @param DLC
     * @param Port_parameters
     */
    void request(DLCI_t DLC, PortParameters_t Port_parameters);

    /**
     * @param DLC
     * @param Port_parameters
     */
    void indication(DLCI_t DLC, PortParameters_t Port_parameters);

    /**
     * @param DLC
     * @param Port_parameters
     * @param accept
     */
    void response(DLCI_t DLC, PortParameters_t Port_parameters, bool accept);

    /**
     * @param DLC
     * @param Port_parameters
     * @param accept
     */
    void confirm(DLCI_t DLC, PortParameters_t Port_parameters, bool accept);

    /**
     * @param DLC
     * @param LineStatusParameter
     */
    void request(DLCI_t DLC, LineStatusParameter_e LineStatusParameter);

    /**
     * @param DLC
     * @param LineStatusParameter
     */
    void indication(DLCI_t DLC, LineStatusParameter_e LineStatusParameter);
};

#endif //_TS0710_PORTNEG_H