~aleteoryx/muditaos

ref: 4c30d4442b78252ba940cede96ddc9bed2ca40cd muditaos/module-services/service-cellular/State.hpp -rw-r--r-- 2.0 KiB
4c30d444 — Marcin Smoczyński [EGD-3797] change default country to unknown 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
#pragma once

class ServiceCellular;

namespace cellular
{
    class State
    {
      public:
        enum class ST
        {
            Idle,                        /// does nothing
            StatusCheck,                 /// set on service start - check for modem status - skipped on T3 board
            PowerUpProcedure,            /// due to lack of Status pin on T3, we don't know whether is on or off
            PowerUpInProgress,           /// waiting for modem powered up by polling various bauds
            CellularConfProcedure,       /// configuration procedure
            AudioConfigurationProcedure, /// audio configuration for modem (could be in ModemConfiguration)
            SanityCheck,                 /// prior to ModemOn last sanity checks for one time configurations etc
            ModemOn,   /// modem ready - indicates that modem is fully configured, ( **SIM is not yet configured** )
            URCReady,  /// State indicates that URC handling is enabled
            SimInit,   /// initialize sim card
            SimSelect, /// triggers hw SIM selection (! state now will be **changed on URC** )
            ModemFatalFailure, /// modem full shutdown need
            Failed,
            Ready,            /// Service is fully initialized
            PowerDownStarted, /// modem is disconnecting from network. It might take a while if poor coverage
            PowerDownWaiting, /// modem has deregistered and is now approaching low power state
            PowerDown,        /// modem is known to be turned off
        };

      private:
        enum ST state = ST::Idle;

      public:
        [[nodiscard]] static const char *c_str(ST state);
        [[nodiscard]] const char *c_str();

        /// 1. sets state of ServiceCellular
        /// 2. sends Multicast notification of ServiceCellular state
        ///
        /// \note This is for service cellular only it could be private and friend
        void set(ServiceCellular *owner, ST state);

        ST get() const;
    };
} // namespace cellular