66 lines
1.8 KiB
Java
66 lines
1.8 KiB
Java
package com.voixtreme.vocalengine.service;
|
|
|
|
//=============================================================================
|
|
|
|
import static com.voixtreme.vocalengine.service.VxtCommandManager.BROADCAST_SEND_INTENT_COMMAND;
|
|
import static com.voixtreme.vocalengine.receivers.VoiXtremeReceiver.COMMAND_STATE;
|
|
|
|
/**
|
|
* Created by c_zorrilla on 25/11/2016.
|
|
* This class holds the ASR engine state
|
|
*/
|
|
|
|
public class VxtAsrStateManager
|
|
{
|
|
|
|
// The command is always COMMAND_STATE
|
|
public static final int command= COMMAND_STATE;
|
|
|
|
// The package to send the response
|
|
public String intentPackage= BROADCAST_SEND_INTENT_COMMAND;
|
|
|
|
// 0=NOL No Listen-red, 1=NOS (NO Speech), 2=BOS (Begin Of Speech), EOR=End Of Recognition-green.
|
|
public int mState=0;
|
|
|
|
// The energy of input sound 0-100
|
|
public int mEnergy=0;
|
|
|
|
// Id if this sequence (counter)
|
|
public int mId=0;
|
|
|
|
public boolean mRegisteredForState= false;
|
|
|
|
public boolean mRegisteredEnergy= false;
|
|
|
|
//=========================================================================
|
|
// to emulator or calibrate state
|
|
public void setState( int state)
|
|
{
|
|
mState= state;
|
|
++mId;
|
|
}
|
|
|
|
//=========================================================================
|
|
// Set the registration state from intent intent.register
|
|
public void setRegisterState(int register)
|
|
{
|
|
if( (register== 1) || (register== 3) )
|
|
mRegisteredForState= true;
|
|
else
|
|
mRegisteredForState= false;
|
|
|
|
if( (register== 2) || (register== 3) )
|
|
mRegisteredEnergy= true;
|
|
else
|
|
mRegisteredEnergy= false;
|
|
|
|
}
|
|
|
|
//=========================================================================
|
|
// For package
|
|
public void setIntentPackage( String intentPackage_)
|
|
{
|
|
this.intentPackage= intentPackage_;
|
|
}
|
|
|
|
}
|