VoiceWakeuper.smali

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


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


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


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

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

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

    return-void
.end method

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

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

    .line 76
    const/4 v0, 0x0

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

    .line 123
    new-instance v0, Lcom/iflytek/cloud/speech/impl/VoiceWakeuperImpl;

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

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

    .line 124
    return-void
.end method

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

    .prologue
    .line 92
    const-class v1, Lcom/iflytek/cloud/VoiceWakeuper;

    monitor-enter v1

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

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

    .line 93
    :try_start_6
    sget-object v0, Lcom/iflytek/cloud/VoiceWakeuper;->a:Lcom/iflytek/cloud/VoiceWakeuper;

    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 94
    new-instance v0, Lcom/iflytek/cloud/VoiceWakeuper;

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

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

    .line 96
    :cond_17
    monitor-exit v2
    :try_end_18
    .catchall {:try_start_6 .. :try_end_18} :catchall_1c

    .line 98
    :try_start_18
    sget-object v0, Lcom/iflytek/cloud/VoiceWakeuper;->a:Lcom/iflytek/cloud/VoiceWakeuper;
    :try_end_1a
    .catchall {:try_start_18 .. :try_end_1a} :catchall_1f

    monitor-exit v1

    return-object v0

    .line 96
    :catchall_1c
    move-exception v0

    :try_start_1d
    monitor-exit v2
    :try_end_1e
    .catchall {:try_start_1d .. :try_end_1e} :catchall_1c

    :try_start_1e
    throw v0
    :try_end_1f
    .catchall {:try_start_1e .. :try_end_1f} :catchall_1f

    .line 92
    :catchall_1f
    move-exception v0

    monitor-exit v1

    throw v0
.end method

.method public static getWakeuper()Lcom/iflytek/cloud/VoiceWakeuper;
    .registers 1

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

    return-object v0
.end method


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

    .prologue
    .line 374
    iget-object v0, p0, Lcom/iflytek/cloud/VoiceWakeuper;->b:Lcom/iflytek/cloud/speech/impl/VoiceWakeuperImpl;

    const/4 v1, 0x0

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

    .line 375
    return-void
.end method

.method public destroy()Z
    .registers 5

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

    .line 499
    iget-object v1, p0, Lcom/iflytek/cloud/VoiceWakeuper;->b:Lcom/iflytek/cloud/speech/impl/VoiceWakeuperImpl;

    .line 500
    if-eqz v1, :cond_9

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

    move-result v0

    .line 504
    :cond_9
    invoke-static {}, Lcom/iflytek/thirdparty/m;->a()Lcom/iflytek/thirdparty/m;

    move-result-object v1

    .line 505
    if-eqz v1, :cond_12

    .line 506
    invoke-virtual {v1}, Lcom/iflytek/thirdparty/m;->b()V

    .line 509
    :cond_12
    if-eqz v0, :cond_33

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

    move-result v0

    if-eqz v0, :cond_33

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

    monitor-enter v1

    .line 511
    const/4 v2, 0x0

    :try_start_1e
    sput-object v2, Lcom/iflytek/cloud/VoiceWakeuper;->a:Lcom/iflytek/cloud/VoiceWakeuper;

    .line 512
    monitor-exit v1
    :try_end_21
    .catchall {:try_start_1e .. :try_end_21} :catchall_34

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

    move-result-object v1

    .line 516
    if-eqz v1, :cond_33

    .line 517
    const-string v2, "Destory ivw engine."

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

    .line 518
    const-string v2, "engine_destroy"

    const-string v3, "engine_destroy=ivw"

    invoke-virtual {v1, v2, v3}, Lcom/iflytek/cloud/SpeechUtility;->setParameter(Ljava/lang/String;Ljava/lang/String;)Z

    .line 522
    :cond_33
    return v0

    .line 512
    :catchall_34
    move-exception v0

    :try_start_35
    monitor-exit v1
    :try_end_36
    .catchall {:try_start_35 .. :try_end_36} :catchall_34

    throw v0
.end method

.method public downloadResource(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lcom/iflytek/cloud/util/FileDownloadListener;)I
    .registers 11

    .prologue
    .line 181
    iget-object v0, p0, Lcom/iflytek/cloud/VoiceWakeuper;->b:Lcom/iflytek/cloud/speech/impl/VoiceWakeuperImpl;

    const/4 v4, 0x1

    move-object v1, p1

    move-object v2, p2

    move-object v3, p3

    move-object v5, p4

    invoke-virtual/range {v0 .. v5}, Lcom/iflytek/cloud/speech/impl/VoiceWakeuperImpl;->downloadResource(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZLcom/iflytek/cloud/util/FileDownloadListener;)I

    move-result v0

    return v0
.end method

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

    .prologue
    .line 455
    if-eqz p1, :cond_44

    const-string v0, "aimic_on_"

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

    move-result v0

    if-eqz v0, :cond_44

    .line 456
    const/4 v0, 0x0

    .line 458
    invoke-static {}, Lcom/iflytek/thirdparty/m;->a()Lcom/iflytek/thirdparty/m;

    move-result-object v1

    .line 459
    const-string v2, "aimic_on_channel"

    invoke-virtual {v2, p1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-eqz v2, :cond_20

    .line 460
    invoke-static {}, Lcom/iflytek/thirdparty/m;->g()I

    move-result v0

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

    move-result-object v0

    .line 473
    :goto_1f
    return-object v0

    .line 461
    :cond_20
    const-string v2, "aimic_on_version"

    invoke-virtual {v2, p1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-eqz v2, :cond_2d

    .line 462
    invoke-static {}, Lcom/iflytek/thirdparty/m;->f()Ljava/lang/String;

    move-result-object v0

    goto :goto_1f

    .line 463
    :cond_2d
    if-eqz v1, :cond_3e

    .line 464
    const-string v0, "aimic_on_"

    invoke-virtual {v0}, Ljava/lang/String;->length()I

    move-result v0

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

    move-result-object v0

    .line 465
    invoke-virtual {v1, v0}, Lcom/iflytek/thirdparty/m;->b(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    goto :goto_1f

    .line 467
    :cond_3e
    const-string v1, "aimic is null !"

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

    goto :goto_1f

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

    move-result-object v0

    goto :goto_1f
.end method

.method public isListening()Z
    .registers 2

    .prologue
    .line 325
    iget-object v0, p0, Lcom/iflytek/cloud/VoiceWakeuper;->b:Lcom/iflytek/cloud/speech/impl/VoiceWakeuperImpl;

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

    move-result v0

    return v0
.end method

.method public queryResource(Ljava/lang/String;Lcom/iflytek/cloud/RequestListener;)I
    .registers 5

    .prologue
    .line 150
    iget-object v0, p0, Lcom/iflytek/cloud/VoiceWakeuper;->b:Lcom/iflytek/cloud/speech/impl/VoiceWakeuperImpl;

    const/4 v1, 0x1

    invoke-virtual {v0, p1, v1, p2}, Lcom/iflytek/cloud/speech/impl/VoiceWakeuperImpl;->queryResource(Ljava/lang/String;ZLcom/iflytek/cloud/RequestListener;)I

    move-result v0

    return v0
.end method

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

    .prologue
    const/4 v0, 0x0

    .line 416
    if-eqz p1, :cond_2f

    const-string v1, "aimic_on_"

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

    move-result v1

    if-eqz v1, :cond_2f

    .line 419
    invoke-static {}, Lcom/iflytek/thirdparty/m;->a()Lcom/iflytek/thirdparty/m;

    move-result-object v1

    .line 420
    if-eqz v1, :cond_1c

    .line 421
    const-string v2, "aimic_on_reset"

    invoke-virtual {v2, p1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-eqz v2, :cond_1d

    .line 422
    invoke-virtual {v1}, Lcom/iflytek/thirdparty/m;->c()I

    .line 433
    :cond_1c
    :goto_1c
    return v0

    .line 424
    :cond_1d
    const-string v2, "aimic_on_"

    invoke-virtual {v2}, Ljava/lang/String;->length()I

    move-result v2

    invoke-virtual {p1, v2}, Ljava/lang/String;->substring(I)Ljava/lang/String;

    move-result-object v2

    .line 425
    invoke-virtual {v1, v2, p2}, Lcom/iflytek/thirdparty/m;->a(Ljava/lang/String;Ljava/lang/String;)I

    move-result v1

    if-nez v1, :cond_1c

    const/4 v0, 0x1

    goto :goto_1c

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

    move-result v0

    goto :goto_1c
.end method

.method public startListening(Lcom/iflytek/cloud/WakeuperListener;)I
    .registers 5

    .prologue
    .line 229
    iget-object v0, p0, Lcom/iflytek/cloud/VoiceWakeuper;->b:Lcom/iflytek/cloud/speech/impl/VoiceWakeuperImpl;

    const-string v1, "params"

    const/4 v2, 0x0

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

    .line 230
    iget-object v0, p0, Lcom/iflytek/cloud/VoiceWakeuper;->b:Lcom/iflytek/cloud/speech/impl/VoiceWakeuperImpl;

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

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

    .line 231
    iget-object v0, p0, Lcom/iflytek/cloud/VoiceWakeuper;->b:Lcom/iflytek/cloud/speech/impl/VoiceWakeuperImpl;

    invoke-virtual {v0, p1}, Lcom/iflytek/cloud/speech/impl/VoiceWakeuperImpl;->startListening(Lcom/iflytek/cloud/WakeuperListener;)I

    move-result v0

    return v0
.end method

.method public stopListening()V
    .registers 2

    .prologue
    .line 303
    iget-object v0, p0, Lcom/iflytek/cloud/VoiceWakeuper;->b:Lcom/iflytek/cloud/speech/impl/VoiceWakeuperImpl;

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

    .line 304
    return-void
.end method

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

    .prologue
    .line 271
    iget-object v0, p0, Lcom/iflytek/cloud/VoiceWakeuper;->b:Lcom/iflytek/cloud/speech/impl/VoiceWakeuperImpl;

    if-eqz v0, :cond_13

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

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

    move-result v0

    if-eqz v0, :cond_13

    .line 272
    iget-object v0, p0, Lcom/iflytek/cloud/VoiceWakeuper;->b:Lcom/iflytek/cloud/speech/impl/VoiceWakeuperImpl;

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

    move-result v0

    .line 275
    :goto_12
    return v0

    .line 274
    :cond_13
    const-string v0, "VoiceWakeup writeAudio failed, is not running"

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

    .line 275
    const/16 v0, 0x520c

    goto :goto_12
.end method