tr069 事件类型 (event type)

更新日期: 2023-04-27 阅读次数: 1400 字数: 486 分类: 物联网

Inform 类型的消息中,包含 Event 信息。

All communications and operations are performed in the scope of the provisioning session. The session is always started by the device (CPE) and begins with the transmission of an Inform message.

触发 provisioning session 的事件列表:

Event List

  • Bootstrap – when device contacts the server for the first time, the server URL changed, or the device settings were reset to default; (当在设备上配置 ACS URL 发生更改时,或者恢复出厂设置。从 ACS 获取初始化的账号和密码。) 🌙
  • Periodic – the device is scheduled to perform a periodic session, as per the PeriodicInformInterval settings; (到了新的会话周期。因为 CPE 与 ACS 通信是周期性的,即,按照 Periodic Inform Interval 参数设置的时间间隔发起会话。)
  • Connection request – the device responds to the server's request for a connection; (对 ACS 请求的回复)
  • Value change – value for a parameter that is being monitored has changed; (参数修改,并且设置了 notification)
  • Boot – after the device was reset or lost power and was reconnected; (设备重置,或重新上电。)
  • Scheduled – when the device was previously instructed by the server to initialize an additional session with ScheduleInform command;
  • Transfer complete – after the device finished downloading or uploading files requested by the server; (设备上报任务进度上传、下载文件)
  • Diagnostic complete – once the device finishes a diagnostic. (完成了 ACS 分配的诊断任务)

teamsacs 中 events 的定义

在代码文件 common/cwmp/Message.go:

const (
	// EventBootStrap first connection
	EventBootStrap string = "0 BOOTSTRAP"
	// EventBoot reset or power on
	EventBoot string = "1 BOOT"
	// EventPeriodic periodic inform
	EventPeriodic string = "2 PERIODIC"
	// EventScheduled scheduled infrorm
	EventScheduled string = "3 SCHEDULED"
	// EventValueChange value change event
	EventValueChange string = "4 VALUE CHANGE"
	// EventKicked acs notify cpe
	EventKicked string = "5 KICKED"
	// EventConnectionRequest cpe request connection
	EventConnectionRequest string = "6 CONNECTION REQUEST"
	// EventTransferComplete download complete
	EventTransferComplete string = "7 TRANSFER COMPLETE"
	// EventClientChange custom event client online/offline
	EventClientChange string = "8 CLIENT CHANGE"
)

TeamsACS 中对于 Inform 消息中 Event 类型的判断

位于 tr069/handlers.go 的

func (s *Tr069Server) processInformEvent(c echo.Context, lastInform *cwmp.Inform)

函数中:

打印 lastInform.Events 即可,注意这是个数组。不太好理解,为何会包含多种 Event 类型 ❓

TeamsACS 中有个很好的解释:BOOTSTARP可能和其他事件代码一起组成是事件代码组,例如,在出厂后CPE初始启动时,CPE 发送 BOOTSTARP 和 BOOT 事件代码。

参考

  • https://en.wikipedia.org/wiki/TR-069
  • 这个解释更接地气 https://github.com/CA17/TeamsACS/blob/main/tr069/events.md

tags: tr069

关于作者 🌱

我是来自山东烟台的一名开发者,有敢兴趣的话题,或者软件开发需求,欢迎加微信 zhongwei 聊聊, 查看更多联系方式