Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0f6500b6 authored by Johan Gustavsson's avatar Johan Gustavsson Committed by Shuhei Miyazaki
Browse files

Support Singapore specific supervisory tone

Singapore use CEPT standard supervisory tones except
for busy and ringtone. The Singapore mapping will be
used if gsm.operator.iso-country == "sg".

Bug: 63120560
Test: Build and test ring back tone for Singapore
Change-Id: I86076b0799a741ad8c54968799e400622d223ccd
parent 879996a5
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
@@ -787,6 +787,18 @@ const ToneGenerator::ToneDescriptor ToneGenerator::sToneDescriptors[] = {
                        { .duration = 0 , .waveFreq = { 0 }, 0, 0}},
          .repeatCnt = ToneGenerator::TONEGEN_INF,
          .repeatSegment = 0 },                              // TONE_AUSTRALIA_CONGESTION
        { .segments = { { .duration = 750, .waveFreq = { 425, 0 }, 0, 0 },
                        { .duration = 750, .waveFreq = { 0 }, 0, 0 },
                        { .duration = 0 , .waveFreq = { 0 }, 0, 0}},
          .repeatCnt = ToneGenerator::TONEGEN_INF,
          .repeatSegment = 0 },                              // TONE_SG_BUSY
        { .segments = { { .duration = 400, .waveFreq = { 401, 425, 449, 0 }, 0, 0 },
                        { .duration = 200, .waveFreq = { 0 }, 0, 0 },
                        { .duration = 400, .waveFreq = { 401, 425, 449, 0 }, 0, 0 },
                        { .duration = 2000, .waveFreq = { 0 }, 0, 0 },
                        { .duration = 0 , .waveFreq = { 0 }, 0, 0}},
          .repeatCnt = ToneGenerator::TONEGEN_INF,
          .repeatSegment = 0 },                              // TONE_SG_RINGTONE
};

// Used by ToneGenerator::getToneForRegion() to convert user specified supervisory tone type
@@ -831,6 +843,16 @@ const unsigned char /*tone_type*/ ToneGenerator::sToneMappingTable[NUM_REGIONS-1
            TONE_SUP_ERROR,             // TONE_SUP_ERROR
            TONE_AUSTRALIA_CALL_WAITING,// TONE_SUP_CALL_WAITING
            TONE_AUSTRALIA_RINGTONE     // TONE_SUP_RINGTONE
        },
        {   // SINGAPORE
            TONE_SUP_DIAL,               // TONE_SUP_DIAL
            TONE_SG_BUSY,                // TONE_SUP_BUSY
            TONE_SUP_CONGESTION,         // TONE_SUP_CONGESTION
            TONE_SUP_RADIO_ACK,          // TONE_SUP_RADIO_ACK
            TONE_SUP_RADIO_NOTAVAIL,     // TONE_SUP_RADIO_NOTAVAIL
            TONE_SUP_ERROR,              // TONE_SUP_ERROR
            TONE_SUP_CALL_WAITING,       // TONE_SUP_CALL_WAITING
            TONE_SG_RINGTONE             // TONE_SUP_RINGTONE
        }
};

@@ -889,6 +911,8 @@ ToneGenerator::ToneGenerator(audio_stream_type_t streamType, float volume, bool
        mRegion = GB;
    } else if (strstr(value, "au") != NULL) {
        mRegion = AUSTRALIA;
    } else if (strstr(value, "sg") != NULL) {
        mRegion = SINGAPORE;
    } else {
        mRegion = CEPT;
    }
+5 −1
Original line number Diff line number Diff line
@@ -177,7 +177,7 @@ private:


    // Region specific tones.
    // These supervisory tones are different depending on the region (USA/CANADA, JAPAN, rest of the world).
    // These supervisory tones are different depending on the region (USA/CANADA, JAPAN, Singapore, rest of the world).
    // When a tone in the range [FIRST_SUP_TONE, LAST_SUP_TONE] is requested, the region is determined
    // from system property gsm.operator.iso-country and the proper tone descriptor is selected with the
    // help of sToneMappingTable[]
@@ -203,6 +203,9 @@ private:
        TONE_AUSTRALIA_BUSY,        // Busy tone: 425 Hz repeated in a 0.375s on, 0.375s off pattern.
        TONE_AUSTRALIA_CALL_WAITING,// Call waiting tone: 425Hz tone repeated in a 0.2s on, 0.2s off, 0.2s on, 4.4s off pattern.
        TONE_AUSTRALIA_CONGESTION,  // Congestion tone: 425Hz tone repeated in a 0.375s on, 0.375s off pattern
        // SINGAPORE Supervisory tones
        TONE_SG_BUSY,               // Busy tone: 425 Hz, 750ms ON, 750ms OFF...
        TONE_SG_RINGTONE,           // Ring Tone: 425 Hz tone modulated with 24 Hz, 400ms ON, 200ms OFF, 400ms ON, 2s OFF...
        NUM_ALTERNATE_TONES
    };

@@ -211,6 +214,7 @@ private:
        JAPAN,
        GB,
        AUSTRALIA,
        SINGAPORE,
        CEPT,
        NUM_REGIONS
    };