SpeechTranscripterImpl.smali

.class public Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;
.super Lcom/iflytek/thirdparty/w;
.source "SourceFile"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl$InternalListener;
    }
.end annotation


# instance fields
.field private mRequestFocus:Z


# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .registers 3

    .prologue
    .line 33
    invoke-direct {p0, p1}, Lcom/iflytek/thirdparty/w;-><init>(Landroid/content/Context;)V

    .line 31
    const/4 v0, 0x0

    iput-boolean v0, p0, Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;->mRequestFocus:Z

    .line 34
    return-void
.end method

.method static synthetic access$200(Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;)Landroid/content/Context;
    .registers 2

    .prologue
    .line 28
    iget-object v0, p0, Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;->mContext:Landroid/content/Context;

    return-object v0
.end method

.method static synthetic access$300(Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;)Z
    .registers 2

    .prologue
    .line 28
    iget-boolean v0, p0, Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;->mRequestFocus:Z

    return v0
.end method


# virtual methods
.method public cancel(Z)V
    .registers 5

    .prologue
    .line 122
    iget-object v0, p0, Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;->mContext:Landroid/content/Context;

    iget-boolean v1, p0, Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;->mRequestFocus:Z

    invoke-static {v1}, Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;

    move-result-object v1

    const/4 v2, 0x0

    invoke-static {v0, v1, v2}, Lcom/iflytek/cloud/msc/util/FuncAdapter;->UnLock(Landroid/content/Context;Ljava/lang/Boolean;Landroid/media/AudioManager$OnAudioFocusChangeListener;)Z

    .line 123
    invoke-super {p0, p1}, Lcom/iflytek/thirdparty/w;->cancel(Z)V

    .line 124
    return-void
.end method

.method public getAudioPath()Ljava/lang/String;
    .registers 2

    .prologue
    .line 277
    iget-object v0, p0, Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;->mscer:Lcom/iflytek/thirdparty/s;

    if-eqz v0, :cond_d

    .line 278
    iget-object v0, p0, Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;->mscer:Lcom/iflytek/thirdparty/s;

    check-cast v0, Lcom/iflytek/cloud/msc/ist/MscTranscripter;

    invoke-virtual {v0}, Lcom/iflytek/cloud/msc/ist/MscTranscripter;->getAudioPath()Ljava/lang/String;

    move-result-object v0

    .line 280
    :goto_c
    return-object v0

    :cond_d
    const/4 v0, 0x0

    goto :goto_c
.end method

.method public getSessionID()Ljava/lang/String;
    .registers 2

    .prologue
    .line 253
    iget-object v0, p0, Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;->mscer:Lcom/iflytek/thirdparty/s;

    if-eqz v0, :cond_b

    .line 254
    iget-object v0, p0, Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;->mscer:Lcom/iflytek/thirdparty/s;

    invoke-virtual {v0}, Lcom/iflytek/thirdparty/s;->getSessionID()Ljava/lang/String;

    move-result-object v0

    .line 256
    :goto_a
    return-object v0

    :cond_b
    const/4 v0, 0x0

    goto :goto_a
.end method

.method public getSyncID()I
    .registers 2

    .prologue
    .line 269
    iget-object v0, p0, Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;->mscer:Lcom/iflytek/thirdparty/s;

    if-eqz v0, :cond_d

    .line 270
    iget-object v0, p0, Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;->mscer:Lcom/iflytek/thirdparty/s;

    check-cast v0, Lcom/iflytek/cloud/msc/ist/MscTranscripter;

    invoke-virtual {v0}, Lcom/iflytek/cloud/msc/ist/MscTranscripter;->getSyncID()I

    move-result v0

    .line 272
    :goto_c
    return v0

    :cond_d
    const/4 v0, 0x0

    goto :goto_c
.end method

.method public getUploadBytes()I
    .registers 2

    .prologue
    .line 261
    iget-object v0, p0, Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;->mscer:Lcom/iflytek/thirdparty/s;

    if-eqz v0, :cond_d

    .line 262
    iget-object v0, p0, Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;->mscer:Lcom/iflytek/thirdparty/s;

    check-cast v0, Lcom/iflytek/cloud/msc/ist/MscTranscripter;

    invoke-virtual {v0}, Lcom/iflytek/cloud/msc/ist/MscTranscripter;->getUploadBytes()I

    move-result v0

    .line 264
    :goto_c
    return v0

    :cond_d
    const/4 v0, 0x0

    goto :goto_c
.end method

.method public isTranscripting()Z
    .registers 2

    .prologue
    .line 249
    invoke-virtual {p0}, Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;->isRunning()Z

    move-result v0

    return v0
.end method

.method public pushSessionInfo(Ljava/lang/String;)V
    .registers 4

    .prologue
    .line 42
    iget-object v1, p0, Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;->mSynObj:Ljava/lang/Object;

    monitor-enter v1

    .line 43
    :try_start_3
    iget-object v0, p0, Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;->mscer:Lcom/iflytek/thirdparty/s;

    if-eqz v0, :cond_12

    .line 44
    iget-object v0, p0, Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;->mscer:Lcom/iflytek/thirdparty/s;

    check-cast v0, Lcom/iflytek/cloud/msc/ist/MscTranscripter;

    invoke-virtual {v0}, Lcom/iflytek/cloud/msc/ist/MscTranscripter;->getPerfLog()Lcom/iflytek/thirdparty/u;

    move-result-object v0

    invoke-virtual {v0, p1}, Lcom/iflytek/thirdparty/u;->a(Ljava/lang/String;)V

    .line 45
    :cond_12
    monitor-exit v1

    .line 46
    return-void

    .line 45
    :catchall_14
    move-exception v0

    monitor-exit v1
    :try_end_16
    .catchall {:try_start_3 .. :try_end_16} :catchall_14

    throw v0
.end method

.method public startTranscripting(Lcom/iflytek/cloud/TranscripterListener;)I
    .registers 8

    .prologue
    .line 54
    const/4 v1, 0x0

    .line 56
    iget-object v2, p0, Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;->mSynObj:Ljava/lang/Object;

    monitor-enter v2

    .line 58
    :try_start_4
    iget-object v0, p0, Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;->mSessionParams:Lcom/iflytek/thirdparty/ad;

    const-string v3, "request_audio_focus"

    const/4 v4, 0x1

    invoke-virtual {v0, v3, v4}, Lcom/iflytek/thirdparty/ad;->a(Ljava/lang/String;Z)Z

    move-result v0

    iput-boolean v0, p0, Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;->mRequestFocus:Z

    .line 60
    new-instance v0, Lcom/iflytek/cloud/msc/ist/MscTranscripter;

    iget-object v3, p0, Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;->mContext:Landroid/content/Context;

    iget-object v4, p0, Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;->mSessionParams:Lcom/iflytek/thirdparty/ad;

    const-string v5, "ist"

    invoke-virtual {p0, v5}, Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;->getHandlerThread(Ljava/lang/String;)Landroid/os/HandlerThread;

    move-result-object v5

    invoke-direct {v0, v3, v4, v5}, Lcom/iflytek/cloud/msc/ist/MscTranscripter;-><init>(Landroid/content/Context;Lcom/iflytek/thirdparty/ad;Landroid/os/HandlerThread;)V

    iput-object v0, p0, Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;->mscer:Lcom/iflytek/thirdparty/s;

    .line 62
    iget-object v0, p0, Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;->mContext:Landroid/content/Context;

    iget-boolean v3, p0, Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;->mRequestFocus:Z

    invoke-static {v3}, Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;

    move-result-object v3

    const/4 v4, 0x0

    invoke-static {v0, v3, v4}, Lcom/iflytek/cloud/msc/util/FuncAdapter;->Lock(Landroid/content/Context;Ljava/lang/Boolean;Landroid/media/AudioManager$OnAudioFocusChangeListener;)Z

    .line 63
    iget-object v0, p0, Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;->mscer:Lcom/iflytek/thirdparty/s;

    check-cast v0, Lcom/iflytek/cloud/msc/ist/MscTranscripter;

    new-instance v3, Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl$InternalListener;

    invoke-direct {v3, p0, p1}, Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl$InternalListener;-><init>(Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;Lcom/iflytek/cloud/TranscripterListener;)V

    invoke-virtual {v0, v3}, Lcom/iflytek/cloud/msc/ist/MscTranscripter;->startTranscripting(Lcom/iflytek/cloud/TranscripterListener;)V
    :try_end_38
    .catch Lcom/iflytek/cloud/SpeechError; {:try_start_4 .. :try_end_38} :catch_3b
    .catch Ljava/lang/Throwable; {:try_start_4 .. :try_end_38} :catch_45
    .catchall {:try_start_4 .. :try_end_38} :catchall_4d

    move v0, v1

    .line 71
    :goto_39
    :try_start_39
    monitor-exit v2

    .line 73
    return v0

    .line 64
    :catch_3b
    move-exception v0

    .line 65
    invoke-virtual {v0}, Lcom/iflytek/cloud/SpeechError;->getErrorCode()I

    move-result v1

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

    move v0, v1

    .line 70
    goto :goto_39

    .line 67
    :catch_45
    move-exception v0

    .line 68
    const/16 v1, 0x5207

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

    move v0, v1

    goto :goto_39

    .line 71
    :catchall_4d
    move-exception v0

    monitor-exit v2
    :try_end_4f
    .catchall {:try_start_39 .. :try_end_4f} :catchall_4d

    throw v0
.end method

.method public stopTranscripting()V
    .registers 4

    .prologue
    .line 110
    iget-object v1, p0, Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;->mSynObj:Ljava/lang/Object;

    monitor-enter v1

    .line 111
    :try_start_3
    iget-object v0, p0, Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;->mscer:Lcom/iflytek/thirdparty/s;

    if-eqz v0, :cond_f

    .line 112
    iget-object v0, p0, Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;->mscer:Lcom/iflytek/thirdparty/s;

    check-cast v0, Lcom/iflytek/cloud/msc/ist/MscTranscripter;

    const/4 v2, 0x1

    invoke-virtual {v0, v2}, Lcom/iflytek/cloud/msc/ist/MscTranscripter;->stopTranscripting(Z)Z

    .line 114
    :cond_f
    monitor-exit v1

    .line 115
    return-void

    .line 114
    :catchall_11
    move-exception v0

    monitor-exit v1
    :try_end_13
    .catchall {:try_start_3 .. :try_end_13} :catchall_11

    throw v0
.end method

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

    .prologue
    const/4 v1, 0x0

    .line 82
    iget-object v2, p0, Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;->mSynObj:Ljava/lang/Object;

    monitor-enter v2

    .line 83
    :try_start_4
    iget-object v0, p0, Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;->mscer:Lcom/iflytek/thirdparty/s;

    if-nez v0, :cond_10

    .line 84
    const-string v0, "writeAudio error, no active session."

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

    .line 85
    monitor-exit v2

    move v0, v1

    .line 102
    :goto_f
    return v0

    .line 88
    :cond_10
    if-eqz p1, :cond_15

    array-length v0, p1

    if-gtz v0, :cond_1d

    .line 89
    :cond_15
    const-string v0, "writeAudio error,buffer is null."

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

    .line 90
    monitor-exit v2

    move v0, v1

    goto :goto_f

    .line 93
    :cond_1d
    array-length v0, p1

    add-int v3, p3, p2

    if-ge v0, v3, :cond_2a

    .line 94
    const-string v0, "writeAudio error,buffer length < length."

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

    .line 95
    monitor-exit v2

    move v0, v1

    goto :goto_f

    .line 98
    :cond_2a
    iget-object v0, p0, Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;->mscer:Lcom/iflytek/thirdparty/s;

    check-cast v0, Lcom/iflytek/cloud/msc/ist/MscTranscripter;

    invoke-virtual {v0}, Lcom/iflytek/cloud/msc/ist/MscTranscripter;->getAudioSource()I

    move-result v0

    const/4 v3, -0x1

    if-eq v0, v3, :cond_38

    .line 99
    monitor-exit v2

    move v0, v1

    goto :goto_f

    .line 101
    :cond_38
    iget-object v0, p0, Lcom/iflytek/cloud/speech/impl/SpeechTranscripterImpl;->mscer:Lcom/iflytek/thirdparty/s;

    check-cast v0, Lcom/iflytek/cloud/msc/ist/MscTranscripter;

    invoke-virtual {v0, p1, p2, p3}, Lcom/iflytek/cloud/msc/ist/MscTranscripter;->onRecordBuffer([BII)V

    .line 102
    const/4 v0, 0x1

    monitor-exit v2

    goto :goto_f

    .line 103
    :catchall_42
    move-exception v0

    monitor-exit v2
    :try_end_44
    .catchall {:try_start_4 .. :try_end_44} :catchall_42

    throw v0
.end method