package com.oo.eye.manager;

import android.content.Context;
import android.content.Intent;


/**
 * Created by henry  16/8/4.
 */
public class DaemonSender {
    /**
     * 语音播报
     * @param context
     * @param text
     */
    public  static void sendDBTTS(Context context, String text) {
        Intent intent = new Intent(OOMsg.DBTTS_INTENT_ACTION);
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
        intent.putExtra(OOMsg.DBTTS_KEY, text);
        context.sendBroadcast(intent);
    }


    /**
     * 开启视力测试
     * @param context
     */
	public static void startEyeTest(Context context) {
		Intent intent = init(OOMsg.START_EYE_TEST);
		context.sendBroadcast(intent);
	}

    /**
     * 关闭视力测试
     * @param context
     */
    public static void closeEyeTest(Context context) {
        Intent intent = init(OOMsg.CLOSE_EYE_TEST);
        context.sendBroadcast(intent);
    }

    /**
     * 打开视力测试马达调节
     * @param context
     */
    public static void startEyeTestMotor(Context context) {
        Intent intent = init(OOMsg.START_EYE_TEST_MOTOR);
        context.sendBroadcast(intent);
    }
    /**
     * 关闭视力测试马达调节
     * @param context
     */
    public static void closeEyeTestMotor(Context context) {
        Intent intent = init(OOMsg.CLOSE_EYE_TEST_MOTOR);
        context.sendBroadcast(intent);
    }

    private static Intent init(int action) {
        Intent intent = new Intent(OOMsg.DAEMON_INTENT_ACTION);
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
        intent.putExtra(OOMsg.ARG_SEEX_ACTION, action);
        return intent;
    }
}
