SpeechTranscripter.smali

.class public final Lcom/iflytek/cloud/SpeechTranscripter;
.super Lcom/iflytek/thirdparty/v;
.source "SourceFile"


# static fields
.field private static sInstance:Lcom/iflytek/cloud/SpeechTranscripter;


# instance fields
.field private mTranscripter:Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;


# direct methods
.method static constructor <clinit>()V
    .registers 1

    .prologue
    .line 61
    const/4 v0, 0x0

    sput-object v0, Lcom/iflytek/cloud/SpeechTranscripter;->sInstance:Lcom/iflytek/cloud/SpeechTranscripter;

    return-void
.end method

.method protected constructor <init>(Landroid/content/Context;Lcom/iflytek/cloud/InitListener;)V
    .registers 4

    .prologue
    .line 114
    invoke-direct {p0}, Lcom/iflytek/thirdparty/v;-><init>()V

    .line 64
    const/4 v0, 0x0

    iput-object v0, p0, Lcom/iflytek/cloud/SpeechTranscripter;->mTranscripter:Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;

    .line 116
    invoke-static {}, Lcom/iflytek/msc/MSC;->isLoaded()Z

    move-result v0

    if-eqz v0, :cond_13

    .line 117
    new-instance v0, Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;

    invoke-direct {v0, p1}, Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;-><init>(Landroid/content/Context;)V

    iput-object v0, p0, Lcom/iflytek/cloud/SpeechTranscripter;->mTranscripter:Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;

    .line 119
    :cond_13
    return-void
.end method

.method private clearOnceParameter()V
    .registers 3

    .prologue
    const/4 v1, 0x0

    .line 190
    const-string v0, "sid"

    invoke-virtual {p0, v0, v1}, Lcom/iflytek/cloud/SpeechTranscripter;->setParameter(Ljava/lang/String;Ljava/lang/String;)Z

    .line 191
    const-string v0, "spos"

    invoke-virtual {p0, v0, v1}, Lcom/iflytek/cloud/SpeechTranscripter;->setParameter(Ljava/lang/String;Ljava/lang/String;)Z

    .line 192
    const-string v0, "syncid"

    invoke-virtual {p0, v0, v1}, Lcom/iflytek/cloud/SpeechTranscripter;->setParameter(Ljava/lang/String;Ljava/lang/String;)Z

    .line 194
    return-void
.end method

.method public static declared-synchronized createTranscripter(Landroid/content/Context;Lcom/iflytek/cloud/InitListener;)Lcom/iflytek/cloud/SpeechTranscripter;
    .registers 5

    .prologue
    .line 80
    const-class v1, Lcom/iflytek/cloud/SpeechTranscripter;

    monitor-enter v1

    :try_start_3
    sget-object v2, Lcom/iflytek/cloud/SpeechTranscripter;->sSync:Ljava/lang/Object;

    monitor-enter v2
    :try_end_6
    .catchall {:try_start_3 .. :try_end_6} :catchall_25

    .line 81
    :try_start_6
    sget-object v0, Lcom/iflytek/cloud/SpeechTranscripter;->sInstance:Lcom/iflytek/cloud/SpeechTranscripter;

    if-nez v0, :cond_17

    invoke-static {}, Lcom/iflytek/cloud/SpeechUtility;->getUtility()Lcom/iflytek/cloud/SpeechUtility;

    move-result-object v0

    if-eqz v0, :cond_17

    .line 82
    new-instance v0, Lcom/iflytek/cloud/SpeechTranscripter;

    invoke-direct {v0, p0, p1}, Lcom/iflytek/cloud/SpeechTranscripter;-><init>(Landroid/content/Context;Lcom/iflytek/cloud/InitListener;)V

    sput-object v0, Lcom/iflytek/cloud/SpeechTranscripter;->sInstance:Lcom/iflytek/cloud/SpeechTranscripter;

    .line 84
    :cond_17
    monitor-exit v2
    :try_end_18
    .catchall {:try_start_6 .. :try_end_18} :catchall_22

    .line 86
    if-eqz p1, :cond_1e

    .line 87
    const/4 v0, 0x0

    :try_start_1b
    invoke-interface {p1, v0}, Lcom/iflytek/cloud/InitListener;->onInit(I)V

    .line 90
    :cond_1e
    sget-object v0, Lcom/iflytek/cloud/SpeechTranscripter;->sInstance:Lcom/iflytek/cloud/SpeechTranscripter;
    :try_end_20
    .catchall {:try_start_1b .. :try_end_20} :catchall_25

    monitor-exit v1

    return-object v0

    .line 84
    :catchall_22
    move-exception v0

    :try_start_23
    monitor-exit v2
    :try_end_24
    .catchall {:try_start_23 .. :try_end_24} :catchall_22

    :try_start_24
    throw v0
    :try_end_25
    .catchall {:try_start_24 .. :try_end_25} :catchall_25

    .line 80
    :catchall_25
    move-exception v0

    monitor-exit v1

    throw v0
.end method

.method public static getTranscripter()Lcom/iflytek/cloud/SpeechTranscripter;
    .registers 1

    .prologue
    .line 106
    sget-object v0, Lcom/iflytek/cloud/SpeechTranscripter;->sInstance:Lcom/iflytek/cloud/SpeechTranscripter;

    return-object v0
.end method


# virtual methods
.method public cancel()V
    .registers 3

    .prologue
    .line 310
    const-string v0, "cancel enter"

    invoke-static {v0}, Lcom/iflytek/cloud/msc/util/log/DebugLog;->LogD(Ljava/lang/String;)V

    .line 311
    iget-object v0, p0, Lcom/iflytek/cloud/SpeechTranscripter;->mTranscripter:Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;

    if-eqz v0, :cond_18

    iget-object v0, p0, Lcom/iflytek/cloud/SpeechTranscripter;->mTranscripter:Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;

    invoke-virtual {v0}, Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;->isTranscripting()Z

    move-result v0

    if-eqz v0, :cond_18

    .line 312
    iget-object v0, p0, Lcom/iflytek/cloud/SpeechTranscripter;->mTranscripter:Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;

    const/4 v1, 0x0

    invoke-virtual {v0, v1}, Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;->cancel(Z)V

    .line 316
    :goto_17
    return-void

    .line 314
    :cond_18
    const-string v0, "SpeechTranscripter cancel failed, is not running"

    invoke-static {v0}, Lcom/iflytek/cloud/msc/util/log/DebugLog;->LogE(Ljava/lang/String;)V

    goto :goto_17
.end method

.method public destroy()Z
    .registers 4

    .prologue
    .line 417
    const/4 v0, 0x1

    .line 419
    iget-object v1, p0, Lcom/iflytek/cloud/SpeechTranscripter;->mTranscripter:Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;

    .line 420
    if-eqz v1, :cond_9

    .line 421
    invoke-virtual {v1}, Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;->destroy()Z

    move-result v0

    .line 424
    :cond_9
    if-eqz v0, :cond_18

    invoke-super {p0}, Lcom/iflytek/thirdparty/v;->destroy()Z

    move-result v0

    if-eqz v0, :cond_18

    .line 425
    sget-object v1, Lcom/iflytek/cloud/SpeechTranscripter;->sSync:Ljava/lang/Object;

    monitor-enter v1

    .line 426
    const/4 v2, 0x0

    :try_start_15
    sput-object v2, Lcom/iflytek/cloud/SpeechTranscripter;->sInstance:Lcom/iflytek/cloud/SpeechTranscripter;

    .line 427
    monitor-exit v1

    .line 430
    :cond_18
    return v0

    .line 427
    :catchall_19
    move-exception v0

    monitor-exit v1
    :try_end_1b
    .catchall {:try_start_15 .. :try_end_1b} :catchall_19

    throw v0
.end method

.method public getParameter(Ljava/lang/String;)Ljava/lang/String;
    .registers 3

    .prologue
    .line 381
    iget-object v0, p0, Lcom/iflytek/cloud/SpeechTranscripter;->mTranscripter:Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;

    if-eqz v0, :cond_44

    .line 382
    const-string v0, "sid"

    invoke-virtual {v0, p1}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z

    move-result v0

    if-eqz v0, :cond_13

    .line 383
    iget-object v0, p0, Lcom/iflytek/cloud/SpeechTranscripter;->mTranscripter:Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;

    invoke-virtual {v0}, Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;->getSessionID()Ljava/lang/String;

    move-result-object v0

    .line 393
    :goto_12
    return-object v0

    .line 384
    :cond_13
    const-string v0, "spos"

    invoke-virtual {v0, p1}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z

    move-result v0

    if-eqz v0, :cond_26

    .line 385
    iget-object v0, p0, Lcom/iflytek/cloud/SpeechTranscripter;->mTranscripter:Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;

    invoke-virtual {v0}, Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;->getUploadBytes()I

    move-result v0

    invoke-static {v0}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;

    move-result-object v0

    goto :goto_12

    .line 386
    :cond_26
    const-string v0, "syncid"

    invoke-virtual {v0, p1}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z

    move-result v0

    if-eqz v0, :cond_35

    .line 387
    iget-object v0, p0, Lcom/iflytek/cloud/SpeechTranscripter;->mTranscripter:Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;

    invoke-virtual {v0}, Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;->getSessionID()Ljava/lang/String;

    move-result-object v0

    goto :goto_12

    .line 388
    :cond_35
    const-string v0, "ist_audio_path"

    invoke-virtual {v0, p1}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z

    move-result v0

    if-eqz v0, :cond_44

    .line 389
    iget-object v0, p0, Lcom/iflytek/cloud/SpeechTranscripter;->mTranscripter:Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;

    invoke-virtual {v0}, Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;->getAudioPath()Ljava/lang/String;

    move-result-object v0

    goto :goto_12

    .line 393
    :cond_44
    invoke-super {p0, p1}, Lcom/iflytek/thirdparty/v;->getParameter(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    goto :goto_12
.end method

.method public isTranscripting()Z
    .registers 2

    .prologue
    .line 293
    iget-object v0, p0, Lcom/iflytek/cloud/SpeechTranscripter;->mTranscripter:Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;

    if-eqz v0, :cond_e

    iget-object v0, p0, Lcom/iflytek/cloud/SpeechTranscripter;->mTranscripter:Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;

    invoke-virtual {v0}, Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;->isTranscripting()Z

    move-result v0

    if-eqz v0, :cond_e

    .line 294
    const/4 v0, 0x1

    .line 296
    :goto_d
    return v0

    :cond_e
    const/4 v0, 0x0

    goto :goto_d
.end method

.method public setParameter(Ljava/lang/String;Ljava/lang/String;)Z
    .registers 4

    .prologue
    .line 357
    invoke-super {p0, p1, p2}, Lcom/iflytek/thirdparty/v;->setParameter(Ljava/lang/String;Ljava/lang/String;)Z

    move-result v0

    return v0
.end method

.method public declared-synchronized startTranscripting(Lcom/iflytek/cloud/TranscripterListener;)I
    .registers 5

    .prologue
    .line 169
    monitor-enter p0

    :try_start_1
    const-string v0, "startTranscripting enter"

    invoke-static {v0}, Lcom/iflytek/cloud/msc/util/log/DebugLog;->LogD(Ljava/lang/String;)V

    .line 170
    iget-object v0, p0, Lcom/iflytek/cloud/SpeechTranscripter;->mTranscripter:Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;
    :try_end_8
    .catchall {:try_start_1 .. :try_end_8} :catchall_36

    if-nez v0, :cond_e

    .line 171
    const/16 v0, 0x5209

    .line 183
    :goto_c
    monitor-exit p0

    return v0

    .line 174
    :cond_e
    :try_start_e
    invoke-virtual {p0}, Lcom/iflytek/cloud/SpeechTranscripter;->isTranscripting()Z

    move-result v0

    if-eqz v0, :cond_17

    .line 175
    const/16 v0, 0x520d

    goto :goto_c

    .line 178
    :cond_17
    iget-object v0, p0, Lcom/iflytek/cloud/SpeechTranscripter;->mTranscripter:Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;

    const-string v1, "params"

    const/4 v2, 0x0

    invoke-virtual {v0, v1, v2}, Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;->setParameter(Ljava/lang/String;Ljava/lang/String;)Z

    .line 179
    iget-object v0, p0, Lcom/iflytek/cloud/SpeechTranscripter;->mTranscripter:Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;

    const-string v1, "params"

    iget-object v2, p0, Lcom/iflytek/cloud/SpeechTranscripter;->mSessionParams:Lcom/iflytek/thirdparty/ad;

    invoke-virtual {v2}, Lcom/iflytek/thirdparty/ad;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v0, v1, v2}, Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;->setParameter(Ljava/lang/String;Ljava/lang/String;)Z

    .line 181
    iget-object v0, p0, Lcom/iflytek/cloud/SpeechTranscripter;->mTranscripter:Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;

    invoke-virtual {v0, p1}, Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;->startTranscripting(Lcom/iflytek/cloud/TranscripterListener;)I

    move-result v0

    .line 182
    invoke-direct {p0}, Lcom/iflytek/cloud/SpeechTranscripter;->clearOnceParameter()V
    :try_end_35
    .catchall {:try_start_e .. :try_end_35} :catchall_36

    goto :goto_c

    .line 169
    :catchall_36
    move-exception v0

    monitor-exit p0

    throw v0
.end method

.method public stopTranscripting()V
    .registers 2

    .prologue
    .line 270
    const-string v0, "stopTranscripting enter"

    invoke-static {v0}, Lcom/iflytek/cloud/msc/util/log/DebugLog;->LogD(Ljava/lang/String;)V

    .line 271
    iget-object v0, p0, Lcom/iflytek/cloud/SpeechTranscripter;->mTranscripter:Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;

    if-eqz v0, :cond_17

    iget-object v0, p0, Lcom/iflytek/cloud/SpeechTranscripter;->mTranscripter:Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;

    invoke-virtual {v0}, Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;->isTranscripting()Z

    move-result v0

    if-eqz v0, :cond_17

    .line 272
    iget-object v0, p0, Lcom/iflytek/cloud/SpeechTranscripter;->mTranscripter:Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;

    invoke-virtual {v0}, Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;->stopTranscripting()V

    .line 276
    :goto_16
    return-void

    .line 274
    :cond_17
    const-string v0, "SpeechTranscripter stopListening failed, is not running"

    invoke-static {v0}, Lcom/iflytek/cloud/msc/util/log/DebugLog;->LogE(Ljava/lang/String;)V

    goto :goto_16
.end method

.method public writeAudio([BII)Z
    .registers 5

    .prologue
    .line 244
    iget-object v0, p0, Lcom/iflytek/cloud/SpeechTranscripter;->mTranscripter:Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;

    if-eqz v0, :cond_13

    iget-object v0, p0, Lcom/iflytek/cloud/SpeechTranscripter;->mTranscripter:Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;

    invoke-virtual {v0}, Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;->isTranscripting()Z

    move-result v0

    if-eqz v0, :cond_13

    .line 245
    iget-object v0, p0, Lcom/iflytek/cloud/SpeechTranscripter;->mTranscripter:Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;

    invoke-virtual {v0, p1, p2, p3}, Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;->writeAudio([BII)Z

    move-result v0

    .line 248
    :goto_12
    return v0

    .line 247
    :cond_13
    const-string v0, "SpeechTranscripter writeAudio failed, is not running"

    invoke-static {v0}, Lcom/iflytek/cloud/msc/util/log/DebugLog;->LogE(Ljava/lang/String;)V

    .line 248
    const/4 v0, 0x0

    goto :goto_12
.end method