
```shell
aplay -t raw -c 1 -f S16_LE -r 16000 /system/audio/pleaseFaceTheCamera.wav
amixer sset 'Master' 50%    # 设置音量
mount -o remount rw /system/ # 读写挂载
keydata get mac # 操作mac
keydata set mac 6C:5C:3D:B2:27:78
keydata set hardware HW00000011C3000R -f
MAC存储位置：/data/.mac

ps -ef | egrep start-app.sh | grep -v grep | awk '{print $2}' | xargs kill -9 2 > /dev/null

ps -ef | egrep dk_uart_id_reader | grep -v grep | awk '{print $2}' | xargs kill -9 2 > /dev/null

killall start-app.sh && killall GateFace
killall dk_uart_id_reader
tail -f /sdcard/logs/b020.log


mount -o remount rw /system/ && mv /system/bin/start-app.sh /system/bin/start-app.sh.bak
mount -o remount rw /system/ && mv /system/bin/start-app.sh.bak /system/bin/start-app.sh
echo 1 > /dev/watchdog

dk_uart_id_reader

keydata set hardware HW00000011C3000U -f
keydata get hardware


/etc/init.d/S97_lunch_init
```

`script/start-app.sh`有个`write_mac()`函数生成`/data/.mac`文件。

## 新老平台兼容
pb `BusinessReplyLogin` 的 `utcTimeStamp` 是新平台添加的，依靠这个值判断平台是新还是旧。


## 隐藏页面参数设置

```

http://192.168.8.120/otherPage.php?cmd=get_other_page_params

http://192.168.8.120/otherPage.php?cmd=set_other_page_params&distanceType=1&distance=1&dynamicFeatSimTh=70&dynamicFeatImgQualityTh=90&fast_temp_sw=true&save_reg_img_sw=true&audio_out_enabled=true
```

```json
{
    "cmd": "set_other_page_params",
    "distanceType": 1,
    "save_reg_img_sw": true,
    "fast_temp_sw": true,
    "dynamicFeatSimTh": 70,
    "dynamicFeatImgQualityTh": 90,
    "audio_out_enabled": true
}


{
  "ret": 0,
  "code": 200,
  "message": "OK",
  "data": {
    "distanceType": 1,
    "distance": 100,
    "dynamicFeatSimTh": 70,
    "dynamicFeatImgQualityTh": 90,
    "fast_temp_sw": true,
    "save_reg_img_sw": true,
    "audio_out_enabled": true
  }
}
```



## FacePass平台交互

### 连接不成功，UI上图标不对

```c++
void statusbarUi::updatePlatformConnectionStatus(const int status)
{
    QPixmap pm;
    switch(status)
    {
        case UiInterfaceForBackstage::PLATFORM_CONNECTION_STATUS_DISCONNECTED:
            pm.load(":/res/image/disconnect.png");
        break;
        case UiInterfaceForBackstage::PLATFORM_CONNECTION_STATUS_CONNECTED:
            pm.load(":/res/image/display.png");
        break;
        case UiInterfaceForBackstage::PLATFORM_CONNECTION_STATUS_LOGGED:
            pm.load(":/res/image/display.png");
        break;
        default:
        break;
    }
    m_label_platform->setPixmap(pm.scaled(20, 20, Qt::KeepAspectRatio));
}
```



## 测试/开发帐号

设备业务服务器地址统一都为9002。

- FacePass开发地址：http://172.16.7.16/

  - 账号：luocai

  - 密码：.Luo19961030
  
  - 管理员账号：admin
  
  - 管理员密码：Reconova_123456


- 可视对讲（阳江博物馆项目）：https://172.16.100.22/
  - 账号：admin
  - 密码：Reconova_123456
- FacePass测试地址：http://172.16.7.36/

## 人脸识别函数调用

相关模块初始化：

```c++
GoThread::taskProc();	// 初始化摄像头
FaceGate::preLoad();	// 等待摄像头初始化完成
FaceGate::taskProc();	// 初始化算法

AntiSpoof4Rv1109::init();
AttrDetector4Rv1109::init()
DetectorImpl4Rv1109::init()
LandmarkDetectorRk::init()
```



```mermaid
classDiagram
	RwRecoResult
	GRecoID --|> GObject
	GRecoID --* RecoIDInfo
	
	detector
	attr_detector
	landmark_detector
	anti_spoof
	GTrackerMng *-- AntiSpoof
	GTrackerMng *-- LandmarkDetector
	GDetectorHeadAttr *-- AttrDetector
	AntiSpoof4Rv1109 ..|> AntiSpoof
	LandmarkDetectorRk ..|> LandmarkDetector
	AttrDetector4Rv1109 ..|> AttrDetector
	GObject <|-- GTrackerLock
	GDetectorTracker *-- Detector
	RecoAlgorithm *-- Detector
	RecoAlgorithm *-- LandmarkDetector
	
	ParamManage --* GoThread
	UdpServer --* GoThread 
	GCamera --* GoThread 
	GDetectorTracker --* GoThread 
	GTrackerMng --* GoThread 
	GTrackerLock --* GoThread 
	GDetectorHeadAttr --* GoThread 
	GReco1vsN --* GoThread 
	GReco1vs1 --* GoThread 
	GRecoID --* GoThread 
	GPeInput --* GoThread 
```





逻辑实现都在`src/workflow/output/decision_actuator/decision_actuator.h`

```mermaid
flowchart TB
	A["ADMsg::showDisplayMsg()"]
	B["View::showRecoSuccess()"]
	C["GDecisionActuator::showRecoResult()"]
	D["GDecisionCenter::maskProc()"]
	D-->C-->B-->A
```

## 人证核验逻辑

```mermaid
flowchart TB
	A-->B-->C-->D-->E-->F-->G
	F-->H-->I-->J
	
	A["UDPIDCardReader::detect()"]
	B["IdReader::isNewCardAvailable()"]
	C["IdReader::polling()"]
	D["Peripheral::idPolling()"]
	E["ReaderThread::taskProc()"]
	F["ReaderThread::readerInputAvailNoti()"]
	G["GPeInput::readerInputAvailCallback()"]
	H["GPeInput::idReaderCallback()"]
	I["GDecisionCenter::idCardReaded()"]
	J["GDecisionCenter::_idCardProc()"]
```

recoUi::slotShowSceneResult()
recoUiRecognize::slotsDrawScanner()
mainUi::notifyFaceInfo()

`recoUi::slotTimer()`负责将结果页面切回待机页面


### 人证核验限制

```
http://192.168.8.127/deviceAction.php?mask_check_sw=false&no_mask_no_entry=true&mask_no_entry=false&temp_check_sw=true&temp_anomaly_no_entry=true&min=35&max=37.3&sw=false&temp_unit=0&temp_type=1&temp_audio_sw=false&temp_show_sw=true&sim_th=0&reco_distance_type=3&face_sw=true&reco_from=1&fast_access_sw=false&ic_card_sw=false&face_and_id_sw=true&yuejuma=false&succ_interval=3&fail_interval=1&helmet_sw=false&dynamic_feature=false&face_frame_sw=false&dev_local_pwd_type=1&dev_local_pwd=&health_code_sw=false&health_code_allow_stranger_sw=false&health_code_allow_access_color=1&health_code_allow_access_c19t=4&health_code_allow_access_trip=0&health_code_allow_access_abt=0&travel_card_sw=false&disable_face_sw=false&health_code_needed_tip_type=0&health_trip_fail_times=3&health_trip_need_id_sw=false&health_ui_display_time=3&access_condition=[0,1]&light_and_background=[1,1,0,0,2]&health_check_phone_num_sw=false&health_ok_display_time=3&health_white_list_free_sw=false&health_code_c19t_hours_limit=0&health_trip_show_tip_sw=false&disable_dev_setting_sw=false&temp_sensitivity=0.75&cmd=set_device&face_id_card_verify_rule={"age_limit":{"enabled":true,"precision":2,"range":[{"from":40,"to":60},{"from":30,"to":-1},{"from":-1,"to":70}]},"zone_limit":{"enabled":true,"range":["14512","78945","31103"]}}
```



## 第三方票务平台注册

```
GDecisionCenter::ReconfirmReq
RWProtocol::sendRequestOpenDoorReconfirm()
UdpParse::voucher_verify_result_proc()
RWProtocol::voucherVerifyProc()

## 读取到身份证之后
GDecisionCenter::idCardReaded()
GRecoID::onIDCard() 保存图标
ReaderInfo 保存了nv21的图像编码
GDecisionCenter：：m_idInfo 保存了nv21的图像编码
```











## 闸机

### 故障上报

| 功能列表             | 类别   |                |
| -------------------- | ------ | -------------- |
| 闸机主机电机故障     | 故障类 | 0x21+100=133   |
| 闸机副机电机故障     | 故障类 | 0x22+100=134   |
| 闸机主机离合器故障   | 故障类 | 2003+100= 2103 |
| 闸机副机离合器故障   | 故障类 | 2004+100=2104  |
| 闸机持续开闸信号故障 | 故障类 | 0x5A+100=190   |
| 闸机红外故障         | 故障类 | 0x5B+100=191   |
| 闸机遇阻停机故障     | 故障类 | 0x0A+100=110   |
| 闸机自检失败故障     | 故障类 | 0x23+100=135   |
| 闸机固件升级失败     | 故障类 | 1001+100=1104  |
| 闸机消防告警         | 告警类 | 0x04+100=104   |
| 闸机门长久未关告警   | 告警类 | 0x5C+100=192   |
| 人员强闯告警         | 告警类 | 0x60+100=196   |
| 人员非法推杆告警     | 告警类 | 2001+100=2101  |
| 人员逆行告警         | 告警类 | 0x61+100=197   |
| 人员尾随告警         | 告警类 | 0x62+100=198   |
| 人员逗留告警         | 告警类 | 0x5F+100=195   |

### 通行记录

```protobuf
//index=593 设备上报人员通过闸机事件
message PersonAccessedReport{
	Common base=1;
	string alarmId=2; //消息id
	int64 recordId=3;	//记录id
	string timestamp=4;//时间戳，格式："yyyy-MM-dd HH:mm:ss" 举例 "2023-11-30 11:32:45"
	int32 direction=5;//方向，1：进，2：出
}

//index=594 平台应答人员通过闸机事件
message ReplyPersonAccessedReport {
	Common base=1;
	string alarmId=2; //消息id
	int64 recordId=3;	//记录id
}
```



参考人脸通行记录

```
createAccessRecord
setAccessRecordsUploadStaByRecordIdRang
deleteAccessRecordByRecordId
getAccessRecordsNumByUploadSta


GPeInput::rs485DataProc  处理闸机进出

createGateAccessRecord

# upload thread
bool checkIfSendAccessInfoData(long long curSysSec);
int pushAccessInfoListToSrv(long long curSysSec);
int uploadAccessInfo(long long curSysSec);
```



## netconfig网络管理

```mermaid
classDiagram
	NetConfigThread --> NetConfig
	NetConfig --> Linker
	EthLinker ..|> Linker
	WlanLinker ..|> Linker
	SIMLinker ..|> Linker
	
	
```



wifi_connect 连接wifi耗时过长



## UI组织


```mermaid
---
title: FaceGate UI
---
classDiagram
	View *-- Backstage
	View *-- mainUi
	mainUi ..|> UiInterfaceForBackstage
	mainUi *-- SetupUi
	mainUi *-- settingUi
	mainUi *-- recoUi
	recoUi *-- recoUiRecognize
	recoUi *-- recoUiRecognizeTypeColor
	recoUi *-- recoUiRecognizeTypeAd
	recoUi *-- recoUiScreensaver
	recoUi *-- recoUiPassword
	recoUi *-- recoUiHealthCode
	recoUi *-- recoUiSceneResult

	class View {
		viewInitBackstage();
		viewCreateUi();
	}
```
### SetupUi

仅当`/data/config/need_setup_wizard`文件存在时显示，流程完成时再删除此文件。

### settingUi

```mermaid
classDiagram
	SettingUiPage --|> MyWidgetWithMainStyleColor
	settingUiDevMngNetWifi --|> SettingUiPage
	settingUiDevMngNetWifiAccPoint --|> SettingUiPage
	SettingUiPage *-- QListWidget
	myListWidget --|> QWidget
```

### recoUi

```mermaid
classDiagram
	SceneMsgWidget --|> QWidget
	MsgWidget --|> QWidget
	recoUiSceneResult *-- SceneMsgWidget
	recoUi *-- recoUiSceneResult
	recoUiRecognize  --|> PageAcceptMouseAndTouch
	PageAcceptMouseAndTouch --|> WidgetWithBackstageInterface
	recoUiRecognize *-- PersonWidget
	recoUiRecognizeTypeBase *-- MsgWidget
	recoUiRecognizeTypeBase --|> PageAcceptMouseAndTouch
	recoUiRecognizeTypeColor --|> recoUiRecognizeTypeBase
	recoUiRecognizeTypeAd --|> recoUiRecognizeTypeBase
	
```



```
recoUiRecognize::event()  点击拨号按钮
recoUiRecognizeTypeBase::event() 点击拨号按钮
recoUiCallDial(拨号页面) 是 recoUi 的成员
recoUiRecognize和 recoUiRecognizeTypeBase(recoUiRecognizeTypeColor、recoUiRecognizeTypeAd) 也是 recoUi 的成员
```







## 硬件、固件版本说明

硬件版本说明： http://wiki.reconova.cn/pages/viewpage.action?pageId=36798802

### B045 CI构建包存放地址

```
\\172.16.2.222\瑞为版本\Test\shop\B045
```

### 测试机信息记录

扫码枪：

```
/dev/hidraw0
```

万睿面板机

```json
// MAC  6C:5C:3D:B2:27:81
{
	"mt": 98,
    "ct": "HWA0310722C1110W",
    "mac": "6C5C3DB22781",
    "id": "412d00003263",
    "key": "412d9f3500c79fb3",
    "sct": "b42f6f643aedaf00"
}
```

B045 V05带屏幕

```json
{"mt": 98,"ct": "HWA0310722C1110U","mac": "6C5C3DB229A0"}

keydata set hardware HWA0310722C1110W -f
```

B033 V05裸板

```json
// MAC  6C:5C:3D:B2:27:82

{
	"mt": 98,
    "ct": "HW00000011C3000U",
    "mac": "6C5C3DB22782",
    "id": "6c5c3db22782",
    "key": "6d711a5543353b5a",
    "sct": "06b619feadfae838"
}
```

B026啪啪运动裸板

```json
// keydata set hardware HW00000011C3000R -f
// keydata set mac 6C:5C:3D:B2:27:83 -f
{
	"mt": 98,
    "ct": "HW00000011C3000U",
    "mac": "6C5C3DB22783"
}

// 带屏幕
{
	"mt": 98,
    "ct": "HWA0310511C1000R",
    "mac": "6C5C3DB22783"
}
```

