~aleteoryx/muditaos

ref: 7d4452f90c40b1b5d3f673f321484c6f418bbea2 muditaos/module-cellular/Modem/TS0710/TS0710_DLC_ESTABL.h -rw-r--r-- 2.3 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
// Copyright (c) 2017-2020, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#ifndef _TS0710_DLC_ESTABL_H
#define _TS0710_DLC_ESTABL_H

#include "TS0710.h"

class TS0710_DLC_ESTABL
{
  public:
    // DLC_ESTABL_SystemParameters passed to Port Negotiation frame in control channel

  private:
    DLC_ESTABL_SystemParameters_t pv_SystemParameters;
    DLCI_t pv_DLCI;
    bool active = false;
    bsp::Cellular *pv_cellular;

  public:
    TS0710_DLC_ESTABL(DLCI_t DLCI, bsp::Cellular *cellular);
    TS0710_DLC_ESTABL(DLCI_t DLCI, DLC_ESTABL_SystemParameters_t system_parameters, bsp::Cellular *cellular)
    {
        pv_DLCI             = DLCI;
        pv_SystemParameters = system_parameters;
        pv_cellular         = cellular;
        active              = request(DLCI, system_parameters);
    };
    ~TS0710_DLC_ESTABL()
    {}

    bool getResponse()
    {
        return active;
    }
    DLC_ESTABL_SystemParameters_t getParams()
    {
        return pv_SystemParameters;
    }

  private:
    /**
     * @param DLCI
     * @param system_parameters
     * @brief The transmitting device uses the request primitive initiate the establishment of a new DLC with a desired
     * set of system parameters on the multiplexer channel.
     */
    bool request(DLCI_t DLCI, DLC_ESTABL_SystemParameters_t system_parameters);

    /**
     * @param DLCI
     * @param system_parameters
     * @brief The indication primitive is passed to the upper layer by the TS 0710 layer of the receiving device on
     * reception of the DLC establishment request.
     */
    void indication(DLCI_t DLCI, DLC_ESTABL_SystemParameters_t system_parameters);

    /**
     * @param DLCI
     * @param system_parameters
     * @return accept
     * @brief The receiving device uses the response primitive to either accept or reject the proposed DLCI with its
     * system parameters.
     */
    bool response(DLCI_t DLCI, DLC_ESTABL_SystemParameters_t system_parameters);

    /**
     * @param DLCI
     * @param system_parameters
     * @return accept
     * @brief The confirm primitive is passed to the upper layer of the transmitting device on reception of the response
     * from the receiving device.
     */
    bool confirm(DLCI_t DLCI, DLC_ESTABL_SystemParameters_t system_parameters);
};

#endif //_TS0710_DLC_ESTABL_H