SpeechEvaluator.smali

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


# static fields
.field private static a:Lcom/iflytek/cloud/SpeechEvaluator;


# instance fields
.field private b:Lcom/iflytek/cloud/speech/impl/SpeechEvaluatorImpl;


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

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

    sput-object v0, Lcom/iflytek/cloud/SpeechEvaluator;->a:Lcom/iflytek/cloud/SpeechEvaluator;

    return-void
.end method

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

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

    .line 38
    const/4 v0, 0x0

    iput-object v0, p0, Lcom/iflytek/cloud/SpeechEvaluator;->b:Lcom/iflytek/cloud/speech/impl/SpeechEvaluatorImpl;

    .line 82
    new-instance v0, Lcom/iflytek/cloud/speech/impl/SpeechEvaluatorImpl;

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

    iput-object v0, p0, Lcom/iflytek/cloud/SpeechEvaluator;->b:Lcom/iflytek/cloud/speech/impl/SpeechEvaluatorImpl;

    .line 84
    if-eqz p2, :cond_f

    .line 87
    :cond_f
    return-void
.end method

.method public static createEvaluator(Landroid/content/Context;Lcom/iflytek/cloud/InitListener;)Lcom/iflytek/cloud/SpeechEvaluator;
    .registers 5

    .prologue
    .line 54
    sget-object v1, Lcom/iflytek/cloud/SpeechEvaluator;->sSync:Ljava/lang/Object;

    monitor-enter v1

    .line 55
    :try_start_3
    sget-object v0, Lcom/iflytek/cloud/SpeechEvaluator;->a:Lcom/iflytek/cloud/SpeechEvaluator;

    if-nez v0, :cond_15

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

    move-result-object v0

    if-eqz v0, :cond_15

    .line 56
    new-instance v0, Lcom/iflytek/cloud/SpeechEvaluator;

    const/4 v2, 0x0

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

    sput-object v0, Lcom/iflytek/cloud/SpeechEvaluator;->a:Lcom/iflytek/cloud/SpeechEvaluator;

    .line 58
    :cond_15
    monitor-exit v1
    :try_end_16
    .catchall {:try_start_3 .. :try_end_16} :catchall_19

    .line 60
    sget-object v0, Lcom/iflytek/cloud/SpeechEvaluator;->a:Lcom/iflytek/cloud/SpeechEvaluator;

    return-object v0

    .line 58
    :catchall_19
    move-exception v0

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

    throw v0
.end method

.method public static getEvaluator()Lcom/iflytek/cloud/SpeechEvaluator;
    .registers 1

    .prologue
    .line 76
    sget-object v0, Lcom/iflytek/cloud/SpeechEvaluator;->a:Lcom/iflytek/cloud/SpeechEvaluator;

    return-object v0
.end method


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

    .prologue
    .line 274
    iget-object v0, p0, Lcom/iflytek/cloud/SpeechEvaluator;->b:Lcom/iflytek/cloud/speech/impl/SpeechEvaluatorImpl;

    if-eqz v0, :cond_12

    iget-object v0, p0, Lcom/iflytek/cloud/SpeechEvaluator;->b:Lcom/iflytek/cloud/speech/impl/SpeechEvaluatorImpl;

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

    move-result v0

    if-eqz v0, :cond_12

    .line 275
    iget-object v0, p0, Lcom/iflytek/cloud/SpeechEvaluator;->b:Lcom/iflytek/cloud/speech/impl/SpeechEvaluatorImpl;

    const/4 v1, 0x0

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

    .line 277
    :cond_12
    return-void
.end method

.method public destroy()Z
    .registers 4

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

    .line 365
    iget-object v1, p0, Lcom/iflytek/cloud/SpeechEvaluator;->b:Lcom/iflytek/cloud/speech/impl/SpeechEvaluatorImpl;

    .line 366
    if-eqz v1, :cond_9

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

    move-result v0

    .line 370
    :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 371
    sget-object v1, Lcom/iflytek/cloud/SpeechEvaluator;->sSync:Ljava/lang/Object;

    monitor-enter v1

    .line 372
    const/4 v2, 0x0

    :try_start_15
    sput-object v2, Lcom/iflytek/cloud/SpeechEvaluator;->a:Lcom/iflytek/cloud/SpeechEvaluator;

    .line 373
    monitor-exit v1

    .line 376
    :cond_18
    return v0

    .line 373
    :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 339
    invoke-super {p0, p1}, Lcom/iflytek/thirdparty/v;->getParameter(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public isEvaluating()Z
    .registers 2

    .prologue
    .line 222
    iget-object v0, p0, Lcom/iflytek/cloud/SpeechEvaluator;->b:Lcom/iflytek/cloud/speech/impl/SpeechEvaluatorImpl;

    if-eqz v0, :cond_e

    iget-object v0, p0, Lcom/iflytek/cloud/SpeechEvaluator;->b:Lcom/iflytek/cloud/speech/impl/SpeechEvaluatorImpl;

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

    move-result v0

    if-eqz v0, :cond_e

    .line 223
    const/4 v0, 0x1

    .line 225
    :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 318
    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 startEvaluating(Ljava/lang/String;Ljava/lang/String;Lcom/iflytek/cloud/EvaluatorListener;)I
    .registers 6

    .prologue
    .line 135
    iget-object v0, p0, Lcom/iflytek/cloud/SpeechEvaluator;->b:Lcom/iflytek/cloud/speech/impl/SpeechEvaluatorImpl;

    if-nez v0, :cond_7

    .line 136
    const/16 v0, 0x5209

    .line 139
    :goto_6
    return v0

    .line 138
    :cond_7
    iget-object v0, p0, Lcom/iflytek/cloud/SpeechEvaluator;->b:Lcom/iflytek/cloud/speech/impl/SpeechEvaluatorImpl;

    iget-object v1, p0, Lcom/iflytek/cloud/SpeechEvaluator;->mSessionParams:Lcom/iflytek/thirdparty/ad;

    invoke-virtual {v0, v1}, Lcom/iflytek/cloud/speech/impl/SpeechEvaluatorImpl;->setParameter(Lcom/iflytek/thirdparty/ad;)Z

    .line 139
    iget-object v0, p0, Lcom/iflytek/cloud/SpeechEvaluator;->b:Lcom/iflytek/cloud/speech/impl/SpeechEvaluatorImpl;

    invoke-virtual {v0, p1, p2, p3}, Lcom/iflytek/cloud/speech/impl/SpeechEvaluatorImpl;->startEvaluating(Ljava/lang/String;Ljava/lang/String;Lcom/iflytek/cloud/EvaluatorListener;)I

    move-result v0

    goto :goto_6
.end method

.method public startEvaluating([BLjava/lang/String;Lcom/iflytek/cloud/EvaluatorListener;)I
    .registers 6

    .prologue
    .line 151
    iget-object v0, p0, Lcom/iflytek/cloud/SpeechEvaluator;->b:Lcom/iflytek/cloud/speech/impl/SpeechEvaluatorImpl;

    if-nez v0, :cond_7

    .line 152
    const/16 v0, 0x5209

    .line 155
    :goto_6
    return v0

    .line 154
    :cond_7
    iget-object v0, p0, Lcom/iflytek/cloud/SpeechEvaluator;->b:Lcom/iflytek/cloud/speech/impl/SpeechEvaluatorImpl;

    iget-object v1, p0, Lcom/iflytek/cloud/SpeechEvaluator;->mSessionParams:Lcom/iflytek/thirdparty/ad;

    invoke-virtual {v0, v1}, Lcom/iflytek/cloud/speech/impl/SpeechEvaluatorImpl;->setParameter(Lcom/iflytek/thirdparty/ad;)Z

    .line 155
    iget-object v0, p0, Lcom/iflytek/cloud/SpeechEvaluator;->b:Lcom/iflytek/cloud/speech/impl/SpeechEvaluatorImpl;

    invoke-virtual {v0, p1, p2, p3}, Lcom/iflytek/cloud/speech/impl/SpeechEvaluatorImpl;->startEvaluating([BLjava/lang/String;Lcom/iflytek/cloud/EvaluatorListener;)I

    move-result v0

    goto :goto_6
.end method

.method public stopEvaluating()V
    .registers 2

    .prologue
    .line 254
    iget-object v0, p0, Lcom/iflytek/cloud/SpeechEvaluator;->b:Lcom/iflytek/cloud/speech/impl/SpeechEvaluatorImpl;

    if-eqz v0, :cond_12

    iget-object v0, p0, Lcom/iflytek/cloud/SpeechEvaluator;->b:Lcom/iflytek/cloud/speech/impl/SpeechEvaluatorImpl;

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

    move-result v0

    if-eqz v0, :cond_12

    .line 255
    iget-object v0, p0, Lcom/iflytek/cloud/SpeechEvaluator;->b:Lcom/iflytek/cloud/speech/impl/SpeechEvaluatorImpl;

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

    .line 259
    :goto_11
    return-void

    .line 257
    :cond_12
    const-string v0, "SpeechEvaluator stopEvaluating failed, is not running"

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

    goto :goto_11
.end method

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

    .prologue
    .line 196
    iget-object v0, p0, Lcom/iflytek/cloud/SpeechEvaluator;->b:Lcom/iflytek/cloud/speech/impl/SpeechEvaluatorImpl;

    if-eqz v0, :cond_13

    iget-object v0, p0, Lcom/iflytek/cloud/SpeechEvaluator;->b:Lcom/iflytek/cloud/speech/impl/SpeechEvaluatorImpl;

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

    move-result v0

    if-eqz v0, :cond_13

    .line 197
    iget-object v0, p0, Lcom/iflytek/cloud/SpeechEvaluator;->b:Lcom/iflytek/cloud/speech/impl/SpeechEvaluatorImpl;

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

    move-result v0

    .line 200
    :goto_12
    return v0

    .line 199
    :cond_13
    const-string v0, "SpeechEvaluator writeAudio failed, is not running"

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

    .line 200
    const/4 v0, 0x0

    goto :goto_12
.end method