001 /*
002 * ===========================================================================================
003 * = COPYRIGHT
004 *          PAX Computer Technology (Shenzhen) Co., Ltd. PROPRIETARY INFORMATION
005 *   This software is supplied under the terms of a license agreement or nondisclosure
006 *   agreement with PAX Computer Technology (Shenzhen) Co., Ltd. and may not be copied or
007 *   disclosed except in accordance with the terms in that agreement.
008 *     Copyright (C) 2017-2023 PAX Computer Technology (Shenzhen) Co., Ltd. All rights reserved.
009 * Description: // Detail description about the function of this module,
010 *             // interfaces with the other modules, and dependencies.
011 * Revision History:
012 * Date                         Author                        Action
013 * 2017/04/01                   PAX                     Create/Add/Modify/Delete
014 * ===========================================================================================
015 */
016 
017package com.pax.dal;
018
019import java.util.List;
020
021/**
022 * @since V2.03.00
023 */
024public interface IWifiProbe {
025
026    /**
027     * <div class="zh"> 开始扫描附近 Wi-Fi设备 </div> <div class="en"> start discover Wi-Fi devices </div>
028     * 
029     * @param listener
030     *            {@link ProbeListener}
031     * @since V2.03.00
032     */
033    void start(ProbeListener listener);
034
035    /**
036     * <div class="zh"> 停止扫描 </div> <div class="en"> stop probe </div>
037     * 
038     * @since V2.03.00
039     */
040    void stop();
041
042    /**
043     * <div class="zh"> 获取当前的扫描状态 </div> <div class="en"> get the probe status</div>
044     * 
045     * @return <div class="zh"> 0:搜索完成 1:正在搜索 -1 未开始搜索 </div> <div class="en"> 0:probe finished 1:probing -1:not start
046     *         </div>
047     * @since V2.03.00
048     */
049    int getStatus();
050
051    /**
052     * <div class="zh"> 获取MAC地址数据 </div> <div class="en"> get MAC address list </div>
053     * 
054     * @return <div class="zh"> MAC地址数据列表 </div> <div class="en"> MAC address list </div>
055     * @since V2.03.00
056     */
057    List<String> getResults();
058
059    interface ProbeListener {
060        /**
061         * <div class="zh"> 返回获取到的Wi-Fi设备MAC地址和信号强度 </div> <div class="en"> return probe Wi-Fi MAC address and rssi </div>
062         * 
063         * @param probeinfo
064         *            <div class="zh"> MAC地址 </div> <div class="en"> MAC address </div>
065         * @param rssi
066         *            <div class="zh">信号强度 </div> <div class="en"> RSSI(Received Signal Strength Indication) </div>
067         * @since V2.03.00
068         */
069        void onProbeItem(String probeinfo, String rssi);
070
071        // void onSuccess();
072        /**
073         * <div class="zh"> 结束 </div> <div class="en"> probe finished </div>
074         * 
075         * @since V2.03.00
076         */
077        void onFinish();
078
079        /**
080         * <div class="zh"> 发生错误 </div> <div class="en"> error occured </div>
081         * 
082         * @param reason
083         *            <div class="zh">
084         *            <ul>
085         *            <li>0:内部错误</li>
086         *            <li>1:设备不支持p2p</li>
087         *            <li>2:系统忙</li>
088         *            <li>3:没有服务请求</li>
089         *            </ul>
090         *            </div> <div class="en">
091         *            <ul>
092         *            <li>0:internal error</li>
093         *            <li>1:p2p is unsupported on the device</li>
094         *            <li>2:the framework is busy and unable to service the request</li>
095         *            <li>3:no service requests are added.</li>
096         *            </ul>
097         *            </div>
098         * @since V2.03.00
099         */
100        void onFailure(int reason);
101    }
102}