npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@wqxf/sims-core

v1.0.4

Published

模拟人核心业务(源码包,供 workspace 与 Vite alias 解析)

Downloads

312

Readme

Sims 基础业务库使用说明

  • 本插件提供两个类以供外部用户调用
  • 使用示列,这真的真的真的很重要,一定要看,在末尾处。

SimsMainEntrance

说明:该类为入口提供常用的函数。

引入

import SimsMainEntrance from '@/sims/SimsMainEntrance'

使用

以下方法均为函数,有关他们的具体参数和返回值,在使用时会有具体提示,此处不做进一步展示。

# 登录 非常重要,如果只有一台模拟人相关设备,在登录时请先预设好设备ID,这能为你在后面省很多事!!!
SimsMainEntrance.loginServer

# 初始化模拟人相关的所有状态
SimsMainEntrance.initSimsData

# 订阅设备,订阅成功时默认放行当前设备,未订阅的设备服务器不会推送该设备相关的信息。
SimsMainEntrance.subscribeDevice

# 放行/禁用设备,只有被放行的设备才会收到模拟人下发的最新消息,简而言之禁用设备下发的消息将被return。
SimsMainEntrance.releaseEquipment

# 查询具体设备是否被放行
SimsMainEntrance.queryCurrentDevices

# 移除对某个设备或所有的状态监听,移除后将无法观测到该设备是否离线和上线。
SimsMainEntrance.removeListeningDevices

# 查询具体设备在线状态
SimsMainEntrance.getDevicesOnlineStatus

# 查询具体设备当前电量
SimsMainEntrance.handleGetDevicesElectricity

# 手动更新设备特征状态,用于更新变量
SimsMainEntrance.updateDevicesState

# 查询具体设备是否在线,和getDevicesOnlineStatus有所区别,getDevicesOnlineStatus可能存在延迟,该函数为实时查询
SimsMainEntrance.handleQueryDevicesIsOnline

# 根据设备ID返回需要查询的设备特征,用于查询少量的特征
SimsMainEntrance.getDevicesFeatures

# 根据设备ID返回当前设备的所有特征
SimsMainEntrance.getDevicesAllFeatures

# 下发指令,对模拟人下发操作指令
SimsMainEntrance.handleCommandIssued

# 订阅/关闭 考核通知,病例模式下开始、暂停、结束考试时会触发对应回调
SimsMainEntrance.enableAccessNotice

# 订阅/关闭 生理驱动干预,病例模式下监听用户是否干预成功,干预成功时触发回调
SimsMainEntrance.enablePhysiologicalInterventions

# 设置出血点,未设置时出血部位状态变更通知默认返回全部除出血部位状态,出血ID请参考,飞书表数据 - 出血点
SimsMainEntrance.setupBleedingSiteIds

# 设置意识评估项,如会话、眼部等。
SimsMainEntrance.setUpConfiguration

# 设置病例模式下考试时的病例信息姓名、年龄,未设置AI对话时将无法回答姓名、年龄。
SimsMainEntrance.setUpUserInfo

# 启用/禁用语音识别,未启用时将无法识别语音,无法完成AI对话功能。
SimsMainEntrance.recognitionEnable

SimsMsgNotifications

说明:用于注册接收消息通知

引入

import SimsMsgNotifications from '@/sims/SimsMsgNotifications'

使用

以下方法均为函数,有关他们的参数,在使用时会有具体提示,此处不做进一步展示。

# 注册事件
SimsMsgNotifications.addEvent('事件名', '回调函数');

# 移除指定Event事件
SimsMsgNotifications.removeEvent("事件名", "回调函数");

# 移除所有addEvent事件
SimsMsgNotifications.removeAllEvent

# 监听指定设备特征是否发生改变
SimsMsgNotifications.watchDevicesAttribute

# 移除被监听的设备特征事件,每次调用watchDevicesAttribute时会返回一个ID
SimsMsgNotifications.removeWatchDevicesId

# 垃圾回收机制,用于清理无效事件,非常重要,在APP.vue中使用。
SimsMsgNotifications。listenerPopstate
addEvent支持事件:
  • mainServerChange 服务器状态发生改变时触发回调
  • devicesStateChange 设备状态发生改变时触发回调
  • devicesMsgChange 设备下发消息时触发回调
  • devicesElectricityChange 设备电量发生改变时触发回调
  • assessmentStatusChange 考试状态变更时触发回调
  • physiologicalInterventionsChange 生理驱动干预成功时触发回调
  • bleedingSiteAlterChange 出血点状态变更时触发回调
mainServerChange

返回格式:number

devicesStateChange

返回格式:{ uuid, state }

| 属性 | 类型 | 说明 | | ----- | ------ | ------ | | uuid | string | 设备ID | | state | number | 状态 |

devicesMsgChange

返回格式:{ uuid, body}

| 属性 | 类型 | 说明 | | ---- | ---------- | -------- | | uuid | string | 设备ID | | body | WQHardware | 原始消息 |

devicesElectricityChange

返回格式:{ uuid, bat}

| 属性 | 类型 | 说明 | | ---- | ------ | ------ | | uuid | string | 设备ID | | bat | number | 电量 |

assessmentStatusChange

返回格式:原始数据

physiologicalInterventionsChange

返回格式:{parentId, text, body}

| 属性 | 类型 | 说明 | | -------- | ------ | ---------------------------------- | | parentId | number | 干预项ID | | text | string | 文本内容(穿刺成功、注射成功等提示) | | bodyany | any | 原始消息 |

bleedingSiteAlterChange

返回格式:[{partId, state}]

| 属性 | 类型 | 说明 | | ------ | ------- | -------- | | partId | number | 点位ID | | state | boolean | 是否高亮 | | | | |

示例(非常重要)

  • 以下函数建议在APP.vue或者layout布局入口页处调用。
  • 如果当前平板只对应一个模拟人,建议在登录时传入uuid,这能为你在后面节省很多事!
  • listenerPopstate和initSimsData函数一定要调用,并且注意调用的先后顺序。
import SimsMainEntrance from './sims/SimsMainEntrance.ts'
import SimsMsgNotifications from './sims/SimsMsgNotifications.ts';


SimsMsgNotifications.listenerPopstate();

SimsMainEntrance.loginServer({
  loginName: 'project_dw_001_ipad',
  password: '123456',
  uuid: 'project_dw_013',
  socketUrl: 'http://192.168.13.33:5000'
}).then((res) => {
  console.log(res, '登录回调');
  SimsMainEntrance.subscribeDevice('project_dw_013');
}).catch(er => {
  console.log(er ,'登录失败');
});

SimsMainEntrance.initSimsData();