~aleteoryx/muditaos

ref: 0e1ca0983ba7c635b4aba1f86ac25e641b9dc9c4 muditaos/module-services/service-cellular/service-cellular/CellularServiceAPI.hpp -rw-r--r-- 4.4 KiB
0e1ca098 — Marcin Smoczyński Merge commit 'c7dd6b399' into stable 5 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
// Copyright (c) 2017-2020, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once

#include "CellularMessage.hpp"
#include "PacketDataCellularMessage.hpp"

#include <Modem/TS0710/TS0710.h>
#include <PhoneNumber.hpp>
#include <module-bsp/bsp/cellular/bsp_cellular.hpp>
#include <utf8/UTF8.hpp>

#include <cstdint>
#include <string>

class Service;
namespace sys
{
    class Service;
} // namespace sys

namespace CellularServiceAPI
{
    bool DialNumber(sys::Service *serv, const utils::PhoneNumber &number);
    bool AnswerIncomingCall(sys::Service *serv);
    void HangupCall(sys::Service *serv);
    /*
     * @brief Its calls sercive-cellular for selected SIM IMSI number.
     * @param serv pointer to caller service.
     * @param getFullIMSINumber returned string format. false returns only country code, true returns whole iMSI number.
     * #return IMSI number when succeeds, empty string when fails
     */
    std::string GetIMSI(sys::Service *serv, bool getFullIMSINumber = false);
    /*
     * @brief Its calls sercive-cellular for selected SIM own phone number.
     * @param serv pointer to caller service.
     * #return SIM own number when succeeds, empty string when fails
     */
    std::string GetOwnNumber(sys::Service *serv);
    /*
     * @brief It calls service-cellulat fo newtwork info
     * @param serv pointer to caller service.
     */
    void GetNetworkInfo(sys::Service *serv);

    /*
     * @brief Get current operator, result async in
     * CellularGetCurrentOperatorResponse message
     */
    void GetCurrentOperator(sys::Service *serv);
    /*
     * @brief It calls service-cellulat to perform operators scan
     * @param serv pointer to caller service.
     * @param fullInfo for retrieve full info true in other case only list of operators (long name), without duplicates
     *
     */
    void StartOperatorsScan(sys::Service *serv, bool fullInfo = false);

    void SetOperatorAutoSelect(sys::Service *serv);
    void SetOperator(sys::Service *serv,
                     at::response::cops::CopsMode mode,
                     at::response::cops::NameFormat format,
                     const std::string &name);

    /*
     * @brief It calls service-cellulat to switch antenna
     * @param serv pointer to caller service.
     * @param antenna selected antenna.
     */
    bool SelectAntenna(sys::Service *serv, bsp::cellular::antenna antenna);

    bool SetScanMode(sys::Service *serv, std::string mode);
    bool GetScanMode(sys::Service *serv);
    bool GetFirmwareVersion(sys::Service *serv, std::string &response);
    bool GetChannel(sys::Service *serv,
                    TS0710::Channel channel); /// asynchronous, returns message CellureMessageChannelReady;
    bool GetDataChannel(sys::Service *serv);
    bool GetCSQ(sys::Service *serv, std::string &response);
    bool GetCREG(sys::Service *serv, std::string &response);
    bool GetQNWINFO(sys::Service *serv, std::string &response);
    bool GetAntenna(sys::Service *serv, bsp::cellular::antenna &response);

    bool TransmitDtmfTones(sys::Service *serv, uint32_t digit);

    bool USSDRequest(sys::Service *serv, CellularUSSDMessage::RequestType type, std::string data = "");

    bool ChangeSimPin(sys::Service *serv,
                      Store::GSM::SIM sim,
                      const std::vector<unsigned int> &passcode,
                      const std::vector<unsigned int> &pin);
    bool SetSimCardLock(sys::Service *serv,
                        Store::GSM::SIM sim,
                        CellularSimCardLockDataMessage::SimCardLock lock,
                        const std::vector<unsigned int> &pin);
    bool SetSimCard(sys::Service *serv, Store::GSM::SIM sim);
    /**
     * @brief get all APNs from phone configuration
     */
    bool GetAPN(sys::Service *serv);
    /**
     * @brief get one APN from phone configuration, connected with ctxid
     */
    bool GetAPN(sys::Service *serv, std::uint8_t contextId);
    /**
     * @brief get first APN with type, from phone configuration
     */
    bool GetAPN(sys::Service *serv, packet_data::APN::APNType type);

    bool SetAPN(sys::Service *serv, packet_data::APN::Config apnConfig);
    bool SetDataTransfer(sys::Service *serv, packet_data::DataTransfer dt);
    bool GetDataTransfer(sys::Service *serv);
    bool SetVoLTE(sys::Service *serv, bool value);

    bool ChangeModulePowerState(sys::Service *serv, cellular::State::PowerState newState);
}; // namespace CellularServiceAPI