node-opcua-address-space 2.51.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (598) hide show
  1. package/.mocharc.yml +12 -0
  2. package/LICENSE +20 -0
  3. package/dist/source/address_space_ts.d.ts +122 -0
  4. package/dist/source/address_space_ts.js +18 -0
  5. package/dist/source/address_space_ts.js.map +1 -0
  6. package/dist/source/continuation_points/continuation_point_manager.d.ts +21 -0
  7. package/dist/source/continuation_points/continuation_point_manager.js +100 -0
  8. package/dist/source/continuation_points/continuation_point_manager.js.map +1 -0
  9. package/dist/source/helpers/adjust_browse_direction.d.ts +5 -0
  10. package/dist/source/helpers/adjust_browse_direction.js +12 -0
  11. package/dist/source/helpers/adjust_browse_direction.js.map +1 -0
  12. package/dist/source/helpers/argument_list.d.ts +30 -0
  13. package/dist/source/helpers/argument_list.js +237 -0
  14. package/dist/source/helpers/argument_list.js.map +1 -0
  15. package/dist/source/helpers/call_helpers.d.ts +6 -0
  16. package/dist/source/helpers/call_helpers.js +71 -0
  17. package/dist/source/helpers/call_helpers.js.map +1 -0
  18. package/dist/source/helpers/check_event_clause.d.ts +17 -0
  19. package/dist/source/helpers/check_event_clause.js +53 -0
  20. package/dist/source/helpers/check_event_clause.js.map +1 -0
  21. package/dist/source/helpers/coerce_enum_value.d.ts +6 -0
  22. package/dist/source/helpers/coerce_enum_value.js +34 -0
  23. package/dist/source/helpers/coerce_enum_value.js.map +1 -0
  24. package/dist/source/helpers/dump_tools.d.ts +14 -0
  25. package/dist/source/helpers/dump_tools.js +79 -0
  26. package/dist/source/helpers/dump_tools.js.map +1 -0
  27. package/dist/source/helpers/ensure_secure_access.d.ts +9 -0
  28. package/dist/source/helpers/ensure_secure_access.js +90 -0
  29. package/dist/source/helpers/ensure_secure_access.js.map +1 -0
  30. package/dist/source/helpers/make_optionals_map.d.ts +21 -0
  31. package/dist/source/helpers/make_optionals_map.js +30 -0
  32. package/dist/source/helpers/make_optionals_map.js.map +1 -0
  33. package/dist/source/helpers/resolve_opaque_on_address_space.d.ts +3 -0
  34. package/dist/source/helpers/resolve_opaque_on_address_space.js +37 -0
  35. package/dist/source/helpers/resolve_opaque_on_address_space.js.map +1 -0
  36. package/dist/source/index.d.ts +39 -0
  37. package/dist/source/index.js +62 -0
  38. package/dist/source/index.js.map +1 -0
  39. package/dist/source/interfaces/alarms_and_conditions/condition_info_i.d.ts +12 -0
  40. package/dist/source/interfaces/alarms_and_conditions/condition_info_i.js +3 -0
  41. package/dist/source/interfaces/alarms_and_conditions/condition_info_i.js.map +1 -0
  42. package/dist/source/interfaces/alarms_and_conditions/ua_condition_base_i.d.ts +1 -0
  43. package/dist/source/interfaces/alarms_and_conditions/ua_condition_base_i.js +3 -0
  44. package/dist/source/interfaces/alarms_and_conditions/ua_condition_base_i.js.map +1 -0
  45. package/dist/source/interfaces/data_access/ua_discrete_item.d.ts +4 -0
  46. package/dist/source/interfaces/data_access/ua_discrete_item.js +3 -0
  47. package/dist/source/interfaces/data_access/ua_discrete_item.js.map +1 -0
  48. package/dist/source/interfaces/data_access/ua_multistate_discrete.d.ts +25 -0
  49. package/dist/source/interfaces/data_access/ua_multistate_discrete.js +3 -0
  50. package/dist/source/interfaces/data_access/ua_multistate_discrete.js.map +1 -0
  51. package/dist/source/interfaces/data_access/ua_multistate_discrete_ex.d.ts +21 -0
  52. package/dist/source/interfaces/data_access/ua_multistate_discrete_ex.js +3 -0
  53. package/dist/source/interfaces/data_access/ua_multistate_discrete_ex.js.map +1 -0
  54. package/dist/source/interfaces/data_access/ua_multistate_value_discrete.d.ts +27 -0
  55. package/dist/source/interfaces/data_access/ua_multistate_value_discrete.js +3 -0
  56. package/dist/source/interfaces/data_access/ua_multistate_value_discrete.js.map +1 -0
  57. package/dist/source/interfaces/data_access/ua_multistate_value_discrete_ex.d.ts +24 -0
  58. package/dist/source/interfaces/data_access/ua_multistate_value_discrete_ex.js +3 -0
  59. package/dist/source/interfaces/data_access/ua_multistate_value_discrete_ex.js.map +1 -0
  60. package/dist/source/interfaces/data_access/ua_two_state_discrete.d.ts +17 -0
  61. package/dist/source/interfaces/data_access/ua_two_state_discrete.js +3 -0
  62. package/dist/source/interfaces/data_access/ua_two_state_discrete.js.map +1 -0
  63. package/dist/source/interfaces/data_access/ua_two_state_discrete_ex.d.ts +12 -0
  64. package/dist/source/interfaces/data_access/ua_two_state_discrete_ex.js +3 -0
  65. package/dist/source/interfaces/data_access/ua_two_state_discrete_ex.js.map +1 -0
  66. package/dist/source/interfaces/data_access/ua_y_array_item.d.ts +4 -0
  67. package/dist/source/interfaces/data_access/ua_y_array_item.js +3 -0
  68. package/dist/source/interfaces/data_access/ua_y_array_item.js.map +1 -0
  69. package/dist/source/interfaces/data_access/ua_y_array_item_ex.d.ts +8 -0
  70. package/dist/source/interfaces/data_access/ua_y_array_item_ex.js +3 -0
  71. package/dist/source/interfaces/data_access/ua_y_array_item_ex.js.map +1 -0
  72. package/dist/source/interfaces/state_machine/exclusive_limit_state_machine.d.ts +11 -0
  73. package/dist/source/interfaces/state_machine/exclusive_limit_state_machine.js +3 -0
  74. package/dist/source/interfaces/state_machine/exclusive_limit_state_machine.js.map +1 -0
  75. package/dist/source/interfaces/state_machine/finite_state_machine.d.ts +69 -0
  76. package/dist/source/interfaces/state_machine/finite_state_machine.js +3 -0
  77. package/dist/source/interfaces/state_machine/finite_state_machine.js.map +1 -0
  78. package/dist/source/interfaces/state_machine/program_finite_state_machine.d.ts +74 -0
  79. package/dist/source/interfaces/state_machine/program_finite_state_machine.js +3 -0
  80. package/dist/source/interfaces/state_machine/program_finite_state_machine.js.map +1 -0
  81. package/dist/source/interfaces/state_machine/state_machine.d.ts +342 -0
  82. package/dist/source/interfaces/state_machine/state_machine.js +3 -0
  83. package/dist/source/interfaces/state_machine/state_machine.js.map +1 -0
  84. package/dist/source/interfaces/state_machine/ua_exclusive_limit_state_machine_type_ex.d.ts +12 -0
  85. package/dist/source/interfaces/state_machine/ua_exclusive_limit_state_machine_type_ex.js +3 -0
  86. package/dist/source/interfaces/state_machine/ua_exclusive_limit_state_machine_type_ex.js.map +1 -0
  87. package/dist/source/interfaces/state_machine/ua_finite_state_machine_type.d.ts +49 -0
  88. package/dist/source/interfaces/state_machine/ua_finite_state_machine_type.js +3 -0
  89. package/dist/source/interfaces/state_machine/ua_finite_state_machine_type.js.map +1 -0
  90. package/dist/source/interfaces/state_machine/ua_finite_state_variable.d.ts +18 -0
  91. package/dist/source/interfaces/state_machine/ua_finite_state_variable.js +3 -0
  92. package/dist/source/interfaces/state_machine/ua_finite_state_variable.js.map +1 -0
  93. package/dist/source/interfaces/state_machine/ua_program_state_machine_type.d.ts +11 -0
  94. package/dist/source/interfaces/state_machine/ua_program_state_machine_type.js +3 -0
  95. package/dist/source/interfaces/state_machine/ua_program_state_machine_type.js.map +1 -0
  96. package/dist/source/interfaces/state_machine/ua_state_machine_type.d.ts +222 -0
  97. package/dist/source/interfaces/state_machine/ua_state_machine_type.js +3 -0
  98. package/dist/source/interfaces/state_machine/ua_state_machine_type.js.map +1 -0
  99. package/dist/source/interfaces/state_machine/ua_state_variable.d.ts +29 -0
  100. package/dist/source/interfaces/state_machine/ua_state_variable.js +3 -0
  101. package/dist/source/interfaces/state_machine/ua_state_variable.js.map +1 -0
  102. package/dist/source/interfaces/state_machine/ua_transition_ex.d.ts +6 -0
  103. package/dist/source/interfaces/state_machine/ua_transition_ex.js +3 -0
  104. package/dist/source/interfaces/state_machine/ua_transition_ex.js.map +1 -0
  105. package/dist/source/interfaces/state_machine/ua_two_state_variable.d.ts +26 -0
  106. package/dist/source/interfaces/state_machine/ua_two_state_variable.js +3 -0
  107. package/dist/source/interfaces/state_machine/ua_two_state_variable.js.map +1 -0
  108. package/dist/source/interfaces/subscription_diagnostics_variable.d.ts +41 -0
  109. package/dist/source/interfaces/subscription_diagnostics_variable.js +3 -0
  110. package/dist/source/interfaces/subscription_diagnostics_variable.js.map +1 -0
  111. package/dist/source/interfaces/ua_authorisation_service.d.ts +1 -0
  112. package/dist/source/interfaces/ua_authorisation_service.js +3 -0
  113. package/dist/source/interfaces/ua_authorisation_service.js.map +1 -0
  114. package/dist/source/interfaces/ua_subscription_diagnostics_variable_ex.d.ts +8 -0
  115. package/dist/source/interfaces/ua_subscription_diagnostics_variable_ex.js +3 -0
  116. package/dist/source/interfaces/ua_subscription_diagnostics_variable_ex.js.map +1 -0
  117. package/dist/source/loader/generateAddressSpaceRaw.d.ts +10 -0
  118. package/dist/source/loader/generateAddressSpaceRaw.js +59 -0
  119. package/dist/source/loader/generateAddressSpaceRaw.js.map +1 -0
  120. package/dist/source/loader/load_nodeset2.d.ts +13 -0
  121. package/dist/source/loader/load_nodeset2.js +1392 -0
  122. package/dist/source/loader/load_nodeset2.js.map +1 -0
  123. package/dist/source/loader/namespace_post_step.d.ts +6 -0
  124. package/dist/source/loader/namespace_post_step.js +48 -0
  125. package/dist/source/loader/namespace_post_step.js.map +1 -0
  126. package/dist/source/loader/register_node_promoter.d.ts +3 -0
  127. package/dist/source/loader/register_node_promoter.js +10 -0
  128. package/dist/source/loader/register_node_promoter.js.map +1 -0
  129. package/dist/source/namespace.d.ts +6 -0
  130. package/dist/source/namespace.js +3 -0
  131. package/dist/source/namespace.js.map +1 -0
  132. package/dist/source/namespace_alarm_and_condition.d.ts +24 -0
  133. package/dist/source/namespace_alarm_and_condition.js +3 -0
  134. package/dist/source/namespace_alarm_and_condition.js.map +1 -0
  135. package/dist/source/namespace_data_access.d.ts +42 -0
  136. package/dist/source/namespace_data_access.js +3 -0
  137. package/dist/source/namespace_data_access.js.map +1 -0
  138. package/dist/source/namespace_machine_state.d.ts +7 -0
  139. package/dist/source/namespace_machine_state.js +3 -0
  140. package/dist/source/namespace_machine_state.js.map +1 -0
  141. package/dist/source/pseudo_session.d.ts +55 -0
  142. package/dist/source/pseudo_session.js +205 -0
  143. package/dist/source/pseudo_session.js.map +1 -0
  144. package/dist/source/session_context.d.ts +111 -0
  145. package/dist/source/session_context.js +266 -0
  146. package/dist/source/session_context.js.map +1 -0
  147. package/dist/source/set_namespace_meta_data.d.ts +2 -0
  148. package/dist/source/set_namespace_meta_data.js +60 -0
  149. package/dist/source/set_namespace_meta_data.js.map +1 -0
  150. package/dist/source/ua_namespace_meta_data_type.d.ts +71 -0
  151. package/dist/source/ua_namespace_meta_data_type.js +3 -0
  152. package/dist/source/ua_namespace_meta_data_type.js.map +1 -0
  153. package/dist/source/ua_root_folder.d.ts +9 -0
  154. package/dist/source/ua_root_folder.js +3 -0
  155. package/dist/source/ua_root_folder.js.map +1 -0
  156. package/dist/source/ua_two_state_variable_ex.d.ts +23 -0
  157. package/dist/source/ua_two_state_variable_ex.js +3 -0
  158. package/dist/source/ua_two_state_variable_ex.js.map +1 -0
  159. package/dist/source/xml_writer.d.ts +9 -0
  160. package/dist/source/xml_writer.js +3 -0
  161. package/dist/source/xml_writer.js.map +1 -0
  162. package/dist/src/address_space.d.ts +393 -0
  163. package/dist/src/address_space.js +1375 -0
  164. package/dist/src/address_space.js.map +1 -0
  165. package/dist/src/address_space_change_event_tools.d.ts +6 -0
  166. package/dist/src/address_space_change_event_tools.js +150 -0
  167. package/dist/src/address_space_change_event_tools.js.map +1 -0
  168. package/dist/src/address_space_private.d.ts +44 -0
  169. package/dist/src/address_space_private.js +3 -0
  170. package/dist/src/address_space_private.js.map +1 -0
  171. package/dist/src/alarms_and_conditions/base_event_type.d.ts +26 -0
  172. package/dist/src/alarms_and_conditions/base_event_type.js +41 -0
  173. package/dist/src/alarms_and_conditions/base_event_type.js.map +1 -0
  174. package/dist/src/alarms_and_conditions/check_where_clause.d.ts +4 -0
  175. package/dist/src/alarms_and_conditions/check_where_clause.js +110 -0
  176. package/dist/src/alarms_and_conditions/check_where_clause.js.map +1 -0
  177. package/dist/src/alarms_and_conditions/condition.d.ts +5 -0
  178. package/dist/src/alarms_and_conditions/condition.js +81 -0
  179. package/dist/src/alarms_and_conditions/condition.js.map +1 -0
  180. package/dist/src/alarms_and_conditions/condition_info.d.ts +27 -0
  181. package/dist/src/alarms_and_conditions/condition_info.js +55 -0
  182. package/dist/src/alarms_and_conditions/condition_info.js.map +1 -0
  183. package/dist/src/alarms_and_conditions/condition_snapshot.d.ts +232 -0
  184. package/dist/src/alarms_and_conditions/condition_snapshot.js +667 -0
  185. package/dist/src/alarms_and_conditions/condition_snapshot.js.map +1 -0
  186. package/dist/src/alarms_and_conditions/deviation_alarm_helper.d.ts +21 -0
  187. package/dist/src/alarms_and_conditions/deviation_alarm_helper.js +47 -0
  188. package/dist/src/alarms_and_conditions/deviation_alarm_helper.js.map +1 -0
  189. package/dist/src/alarms_and_conditions/extract_event_fields.d.ts +10 -0
  190. package/dist/src/alarms_and_conditions/extract_event_fields.js +90 -0
  191. package/dist/src/alarms_and_conditions/extract_event_fields.js.map +1 -0
  192. package/dist/src/alarms_and_conditions/index.d.ts +18 -0
  193. package/dist/src/alarms_and_conditions/index.js +31 -0
  194. package/dist/src/alarms_and_conditions/index.js.map +1 -0
  195. package/dist/src/alarms_and_conditions/shelving_state_machine.d.ts +22 -0
  196. package/dist/src/alarms_and_conditions/shelving_state_machine.js +241 -0
  197. package/dist/src/alarms_and_conditions/shelving_state_machine.js.map +1 -0
  198. package/dist/src/alarms_and_conditions/trip_alarm.d.ts +16 -0
  199. package/dist/src/alarms_and_conditions/trip_alarm.js +21 -0
  200. package/dist/src/alarms_and_conditions/trip_alarm.js.map +1 -0
  201. package/dist/src/alarms_and_conditions/ua_acknowledgeable_condition_base.d.ts +54 -0
  202. package/dist/src/alarms_and_conditions/ua_acknowledgeable_condition_base.js +255 -0
  203. package/dist/src/alarms_and_conditions/ua_acknowledgeable_condition_base.js.map +1 -0
  204. package/dist/src/alarms_and_conditions/ua_acknowledgeable_condition_impl.d.ts +62 -0
  205. package/dist/src/alarms_and_conditions/ua_acknowledgeable_condition_impl.js +244 -0
  206. package/dist/src/alarms_and_conditions/ua_acknowledgeable_condition_impl.js.map +1 -0
  207. package/dist/src/alarms_and_conditions/ua_alarm_condition_base.d.ts +138 -0
  208. package/dist/src/alarms_and_conditions/ua_alarm_condition_base.js +460 -0
  209. package/dist/src/alarms_and_conditions/ua_alarm_condition_base.js.map +1 -0
  210. package/dist/src/alarms_and_conditions/ua_alarm_condition_impl.d.ts +118 -0
  211. package/dist/src/alarms_and_conditions/ua_alarm_condition_impl.js +417 -0
  212. package/dist/src/alarms_and_conditions/ua_alarm_condition_impl.js.map +1 -0
  213. package/dist/src/alarms_and_conditions/ua_base_event_impl.d.ts +29 -0
  214. package/dist/src/alarms_and_conditions/ua_base_event_impl.js +39 -0
  215. package/dist/src/alarms_and_conditions/ua_base_event_impl.js.map +1 -0
  216. package/dist/src/alarms_and_conditions/ua_certificate_expiration_alarm.d.ts +35 -0
  217. package/dist/src/alarms_and_conditions/ua_certificate_expiration_alarm.js +32 -0
  218. package/dist/src/alarms_and_conditions/ua_certificate_expiration_alarm.js.map +1 -0
  219. package/dist/src/alarms_and_conditions/ua_certificate_expiration_alarm_impl.d.ts +21 -0
  220. package/dist/src/alarms_and_conditions/ua_certificate_expiration_alarm_impl.js +26 -0
  221. package/dist/src/alarms_and_conditions/ua_certificate_expiration_alarm_impl.js.map +1 -0
  222. package/dist/src/alarms_and_conditions/ua_condition_base.d.ts +191 -0
  223. package/dist/src/alarms_and_conditions/ua_condition_base.js +1029 -0
  224. package/dist/src/alarms_and_conditions/ua_condition_base.js.map +1 -0
  225. package/dist/src/alarms_and_conditions/ua_condition_impl.d.ts +182 -0
  226. package/dist/src/alarms_and_conditions/ua_condition_impl.js +1021 -0
  227. package/dist/src/alarms_and_conditions/ua_condition_impl.js.map +1 -0
  228. package/dist/src/alarms_and_conditions/ua_discrete_alarm.d.ts +11 -0
  229. package/dist/src/alarms_and_conditions/ua_discrete_alarm.js +58 -0
  230. package/dist/src/alarms_and_conditions/ua_discrete_alarm.js.map +1 -0
  231. package/dist/src/alarms_and_conditions/ua_discrete_alarm_impl.d.ts +17 -0
  232. package/dist/src/alarms_and_conditions/ua_discrete_alarm_impl.js +58 -0
  233. package/dist/src/alarms_and_conditions/ua_discrete_alarm_impl.js.map +1 -0
  234. package/dist/src/alarms_and_conditions/ua_exclusive_deviation_alarm.d.ts +24 -0
  235. package/dist/src/alarms_and_conditions/ua_exclusive_deviation_alarm.js +59 -0
  236. package/dist/src/alarms_and_conditions/ua_exclusive_deviation_alarm.js.map +1 -0
  237. package/dist/src/alarms_and_conditions/ua_exclusive_deviation_alarm_impl.d.ts +27 -0
  238. package/dist/src/alarms_and_conditions/ua_exclusive_deviation_alarm_impl.js +57 -0
  239. package/dist/src/alarms_and_conditions/ua_exclusive_deviation_alarm_impl.js.map +1 -0
  240. package/dist/src/alarms_and_conditions/ua_exclusive_level_alarm.d.ts +14 -0
  241. package/dist/src/alarms_and_conditions/ua_exclusive_level_alarm.js +17 -0
  242. package/dist/src/alarms_and_conditions/ua_exclusive_level_alarm.js.map +1 -0
  243. package/dist/src/alarms_and_conditions/ua_exclusive_level_alarm_impl.d.ts +9 -0
  244. package/dist/src/alarms_and_conditions/ua_exclusive_level_alarm_impl.js +12 -0
  245. package/dist/src/alarms_and_conditions/ua_exclusive_level_alarm_impl.js.map +1 -0
  246. package/dist/src/alarms_and_conditions/ua_exclusive_limit_alarm.d.ts +22 -0
  247. package/dist/src/alarms_and_conditions/ua_exclusive_limit_alarm.js +87 -0
  248. package/dist/src/alarms_and_conditions/ua_exclusive_limit_alarm.js.map +1 -0
  249. package/dist/src/alarms_and_conditions/ua_exclusive_limit_alarm_impl.d.ts +38 -0
  250. package/dist/src/alarms_and_conditions/ua_exclusive_limit_alarm_impl.js +87 -0
  251. package/dist/src/alarms_and_conditions/ua_exclusive_limit_alarm_impl.js.map +1 -0
  252. package/dist/src/alarms_and_conditions/ua_exclusive_rate_of_change_alarm.d.ts +6 -0
  253. package/dist/src/alarms_and_conditions/ua_exclusive_rate_of_change_alarm.js +11 -0
  254. package/dist/src/alarms_and_conditions/ua_exclusive_rate_of_change_alarm.js.map +1 -0
  255. package/dist/src/alarms_and_conditions/ua_exclusive_rate_of_change_alarm_impl.d.ts +10 -0
  256. package/dist/src/alarms_and_conditions/ua_exclusive_rate_of_change_alarm_impl.js +8 -0
  257. package/dist/src/alarms_and_conditions/ua_exclusive_rate_of_change_alarm_impl.js.map +1 -0
  258. package/dist/src/alarms_and_conditions/ua_limit_alarm.d.ts +76 -0
  259. package/dist/src/alarms_and_conditions/ua_limit_alarm.js +237 -0
  260. package/dist/src/alarms_and_conditions/ua_limit_alarm.js.map +1 -0
  261. package/dist/src/alarms_and_conditions/ua_limit_alarm_impl.d.ts +98 -0
  262. package/dist/src/alarms_and_conditions/ua_limit_alarm_impl.js +233 -0
  263. package/dist/src/alarms_and_conditions/ua_limit_alarm_impl.js.map +1 -0
  264. package/dist/src/alarms_and_conditions/ua_non_exclusive_deviation_alarm.d.ts +27 -0
  265. package/dist/src/alarms_and_conditions/ua_non_exclusive_deviation_alarm.js +62 -0
  266. package/dist/src/alarms_and_conditions/ua_non_exclusive_deviation_alarm.js.map +1 -0
  267. package/dist/src/alarms_and_conditions/ua_non_exclusive_deviation_alarm_impl.d.ts +28 -0
  268. package/dist/src/alarms_and_conditions/ua_non_exclusive_deviation_alarm_impl.js +51 -0
  269. package/dist/src/alarms_and_conditions/ua_non_exclusive_deviation_alarm_impl.js.map +1 -0
  270. package/dist/src/alarms_and_conditions/ua_non_exclusive_limit_alarm.d.ts +49 -0
  271. package/dist/src/alarms_and_conditions/ua_non_exclusive_limit_alarm.js +176 -0
  272. package/dist/src/alarms_and_conditions/ua_non_exclusive_limit_alarm.js.map +1 -0
  273. package/dist/src/alarms_and_conditions/ua_non_exclusive_limit_alarm_impl.d.ts +25 -0
  274. package/dist/src/alarms_and_conditions/ua_non_exclusive_limit_alarm_impl.js +163 -0
  275. package/dist/src/alarms_and_conditions/ua_non_exclusive_limit_alarm_impl.js.map +1 -0
  276. package/dist/src/alarms_and_conditions/ua_off_normal_alarm.d.ts +47 -0
  277. package/dist/src/alarms_and_conditions/ua_off_normal_alarm.js +151 -0
  278. package/dist/src/alarms_and_conditions/ua_off_normal_alarm.js.map +1 -0
  279. package/dist/src/alarms_and_conditions/ua_off_normal_alarm_impl.d.ts +39 -0
  280. package/dist/src/alarms_and_conditions/ua_off_normal_alarm_impl.js +136 -0
  281. package/dist/src/alarms_and_conditions/ua_off_normal_alarm_impl.js.map +1 -0
  282. package/dist/src/alarms_and_conditions/ua_system_off_normal_alarm.d.ts +16 -0
  283. package/dist/src/alarms_and_conditions/ua_system_off_normal_alarm.js +18 -0
  284. package/dist/src/alarms_and_conditions/ua_system_off_normal_alarm.js.map +1 -0
  285. package/dist/src/alarms_and_conditions/ua_system_off_normal_alarm_impl.d.ts +16 -0
  286. package/dist/src/alarms_and_conditions/ua_system_off_normal_alarm_impl.js +18 -0
  287. package/dist/src/alarms_and_conditions/ua_system_off_normal_alarm_impl.js.map +1 -0
  288. package/dist/src/apply_condition_refresh.d.ts +6 -0
  289. package/dist/src/apply_condition_refresh.js +28 -0
  290. package/dist/src/apply_condition_refresh.js.map +1 -0
  291. package/dist/src/base_node.d.ts +279 -0
  292. package/dist/src/base_node.js +1364 -0
  293. package/dist/src/base_node.js.map +1 -0
  294. package/dist/src/base_node_impl.d.ts +281 -0
  295. package/dist/src/base_node_impl.js +1394 -0
  296. package/dist/src/base_node_impl.js.map +1 -0
  297. package/dist/src/base_node_private.d.ts +61 -0
  298. package/dist/src/base_node_private.js +521 -0
  299. package/dist/src/base_node_private.js.map +1 -0
  300. package/dist/src/data_access/add_dataItem_stuff.d.ts +11 -0
  301. package/dist/src/data_access/add_dataItem_stuff.js +62 -0
  302. package/dist/src/data_access/add_dataItem_stuff.js.map +1 -0
  303. package/dist/src/data_access/check_variant_compatibility_ua_analog_item.d.ts +1 -0
  304. package/dist/src/data_access/check_variant_compatibility_ua_analog_item.js +35 -0
  305. package/dist/src/data_access/check_variant_compatibility_ua_analog_item.js.map +1 -0
  306. package/dist/src/data_access/ua_analog_item.d.ts +13 -0
  307. package/dist/src/data_access/ua_analog_item.js +37 -0
  308. package/dist/src/data_access/ua_analog_item.js.map +1 -0
  309. package/dist/src/data_access/ua_data_item.d.ts +16 -0
  310. package/dist/src/data_access/ua_data_item.js +66 -0
  311. package/dist/src/data_access/ua_data_item.js.map +1 -0
  312. package/dist/src/data_access/ua_multistate_discrete.d.ts +23 -0
  313. package/dist/src/data_access/ua_multistate_discrete.js +131 -0
  314. package/dist/src/data_access/ua_multistate_discrete.js.map +1 -0
  315. package/dist/src/data_access/ua_multistate_discrete_impl.d.ts +32 -0
  316. package/dist/src/data_access/ua_multistate_discrete_impl.js +131 -0
  317. package/dist/src/data_access/ua_multistate_discrete_impl.js.map +1 -0
  318. package/dist/src/data_access/ua_multistate_value_discrete.d.ts +51 -0
  319. package/dist/src/data_access/ua_multistate_value_discrete.js +249 -0
  320. package/dist/src/data_access/ua_multistate_value_discrete.js.map +1 -0
  321. package/dist/src/data_access/ua_two_state_discrete.d.ts +25 -0
  322. package/dist/src/data_access/ua_two_state_discrete.js +154 -0
  323. package/dist/src/data_access/ua_two_state_discrete.js.map +1 -0
  324. package/dist/src/event_data.d.ts +29 -0
  325. package/dist/src/event_data.js +96 -0
  326. package/dist/src/event_data.js.map +1 -0
  327. package/dist/src/extension_object_array_node.d.ts +61 -0
  328. package/dist/src/extension_object_array_node.js +266 -0
  329. package/dist/src/extension_object_array_node.js.map +1 -0
  330. package/dist/src/historical_access/address_space_historical_data_node.d.ts +26 -0
  331. package/dist/src/historical_access/address_space_historical_data_node.js +662 -0
  332. package/dist/src/historical_access/address_space_historical_data_node.js.map +1 -0
  333. package/dist/src/index_current.d.ts +42 -0
  334. package/dist/src/index_current.js +71 -0
  335. package/dist/src/index_current.js.map +1 -0
  336. package/dist/src/namespace.d.ts +475 -0
  337. package/dist/src/namespace.js +1775 -0
  338. package/dist/src/namespace.js.map +1 -0
  339. package/dist/src/namespace_impl.d.ts +463 -0
  340. package/dist/src/namespace_impl.js +1763 -0
  341. package/dist/src/namespace_impl.js.map +1 -0
  342. package/dist/src/namespace_private.d.ts +21 -0
  343. package/dist/src/namespace_private.js +29 -0
  344. package/dist/src/namespace_private.js.map +1 -0
  345. package/dist/src/nodeid_manager.d.ts +36 -0
  346. package/dist/src/nodeid_manager.js +196 -0
  347. package/dist/src/nodeid_manager.js.map +1 -0
  348. package/dist/src/nodeset_tools/adjust_namespace_array.d.ts +2 -0
  349. package/dist/src/nodeset_tools/adjust_namespace_array.js +14 -0
  350. package/dist/src/nodeset_tools/adjust_namespace_array.js.map +1 -0
  351. package/dist/src/nodeset_tools/construct_namespace_dependency.d.ts +2 -0
  352. package/dist/src/nodeset_tools/construct_namespace_dependency.js +39 -0
  353. package/dist/src/nodeset_tools/construct_namespace_dependency.js.map +1 -0
  354. package/dist/src/nodeset_tools/nodeset_to_xml.d.ts +2 -0
  355. package/dist/src/nodeset_tools/nodeset_to_xml.js +1155 -0
  356. package/dist/src/nodeset_tools/nodeset_to_xml.js.map +1 -0
  357. package/dist/src/nodeset_tools/typedictionary_to_xml.d.ts +2 -0
  358. package/dist/src/nodeset_tools/typedictionary_to_xml.js +147 -0
  359. package/dist/src/nodeset_tools/typedictionary_to_xml.js.map +1 -0
  360. package/dist/src/reference.d.ts +43 -0
  361. package/dist/src/reference.js +138 -0
  362. package/dist/src/reference.js.map +1 -0
  363. package/dist/src/reference_impl.d.ts +43 -0
  364. package/dist/src/reference_impl.js +138 -0
  365. package/dist/src/reference_impl.js.map +1 -0
  366. package/dist/src/role_permissions.d.ts +2 -0
  367. package/dist/src/role_permissions.js +11 -0
  368. package/dist/src/role_permissions.js.map +1 -0
  369. package/dist/src/session_context.d.ts +4 -0
  370. package/dist/src/session_context.js +9 -0
  371. package/dist/src/session_context.js.map +1 -0
  372. package/dist/src/state_machine/finite_state_machine.d.ts +67 -0
  373. package/dist/src/state_machine/finite_state_machine.js +354 -0
  374. package/dist/src/state_machine/finite_state_machine.js.map +1 -0
  375. package/dist/src/state_machine/ua_shelving_state_machine_ex.d.ts +34 -0
  376. package/dist/src/state_machine/ua_shelving_state_machine_ex.js +244 -0
  377. package/dist/src/state_machine/ua_shelving_state_machine_ex.js.map +1 -0
  378. package/dist/src/state_machine/ua_two_state_variable.d.ts +61 -0
  379. package/dist/src/state_machine/ua_two_state_variable.js +332 -0
  380. package/dist/src/state_machine/ua_two_state_variable.js.map +1 -0
  381. package/dist/src/tool_isSupertypeOf.d.ts +17 -0
  382. package/dist/src/tool_isSupertypeOf.js +103 -0
  383. package/dist/src/tool_isSupertypeOf.js.map +1 -0
  384. package/dist/src/ua_condition_type.d.ts +8 -0
  385. package/dist/src/ua_condition_type.js +3 -0
  386. package/dist/src/ua_condition_type.js.map +1 -0
  387. package/dist/src/ua_data_type.d.ts +83 -0
  388. package/dist/src/ua_data_type.js +289 -0
  389. package/dist/src/ua_data_type.js.map +1 -0
  390. package/dist/src/ua_data_type_impl.d.ts +83 -0
  391. package/dist/src/ua_data_type_impl.js +291 -0
  392. package/dist/src/ua_data_type_impl.js.map +1 -0
  393. package/dist/src/ua_method.d.ts +42 -0
  394. package/dist/src/ua_method.js +204 -0
  395. package/dist/src/ua_method.js.map +1 -0
  396. package/dist/src/ua_method_impl.d.ts +40 -0
  397. package/dist/src/ua_method_impl.js +203 -0
  398. package/dist/src/ua_method_impl.js.map +1 -0
  399. package/dist/src/ua_object.d.ts +29 -0
  400. package/dist/src/ua_object.js +153 -0
  401. package/dist/src/ua_object.js.map +1 -0
  402. package/dist/src/ua_object_impl.d.ts +29 -0
  403. package/dist/src/ua_object_impl.js +156 -0
  404. package/dist/src/ua_object_impl.js.map +1 -0
  405. package/dist/src/ua_object_type.d.ts +49 -0
  406. package/dist/src/ua_object_type.js +124 -0
  407. package/dist/src/ua_object_type.js.map +1 -0
  408. package/dist/src/ua_object_type_impl.d.ts +48 -0
  409. package/dist/src/ua_object_type_impl.js +124 -0
  410. package/dist/src/ua_object_type_impl.js.map +1 -0
  411. package/dist/src/ua_reference_type.d.ts +42 -0
  412. package/dist/src/ua_reference_type.js +138 -0
  413. package/dist/src/ua_reference_type.js.map +1 -0
  414. package/dist/src/ua_reference_type_impl.d.ts +43 -0
  415. package/dist/src/ua_reference_type_impl.js +138 -0
  416. package/dist/src/ua_reference_type_impl.js.map +1 -0
  417. package/dist/src/ua_variable.d.ts +346 -0
  418. package/dist/src/ua_variable.js +1721 -0
  419. package/dist/src/ua_variable.js.map +1 -0
  420. package/dist/src/ua_variable_impl.d.ts +353 -0
  421. package/dist/src/ua_variable_impl.js +1719 -0
  422. package/dist/src/ua_variable_impl.js.map +1 -0
  423. package/dist/src/ua_variable_type.d.ts +54 -0
  424. package/dist/src/ua_variable_type.js +555 -0
  425. package/dist/src/ua_variable_type.js.map +1 -0
  426. package/dist/src/ua_variable_type_impl.d.ts +63 -0
  427. package/dist/src/ua_variable_type_impl.js +556 -0
  428. package/dist/src/ua_variable_type_impl.js.map +1 -0
  429. package/dist/src/ua_view.d.ts +16 -0
  430. package/dist/src/ua_view.js +42 -0
  431. package/dist/src/ua_view.js.map +1 -0
  432. package/dist/src/ua_view_impl.d.ts +15 -0
  433. package/dist/src/ua_view_impl.js +37 -0
  434. package/dist/src/ua_view_impl.js.map +1 -0
  435. package/distHelpers/add_event_generator_object.d.ts +3 -0
  436. package/distHelpers/add_event_generator_object.js +66 -0
  437. package/distHelpers/add_event_generator_object.js.map +1 -0
  438. package/distHelpers/alarms_and_conditions_demo.d.ts +10 -0
  439. package/distHelpers/alarms_and_conditions_demo.js +115 -0
  440. package/distHelpers/alarms_and_conditions_demo.js.map +1 -0
  441. package/distHelpers/assertHasMatchingReference.d.ts +19 -0
  442. package/distHelpers/assertHasMatchingReference.js +41 -0
  443. package/distHelpers/assertHasMatchingReference.js.map +1 -0
  444. package/distHelpers/boiler_system.d.ts +113 -0
  445. package/distHelpers/boiler_system.js +397 -0
  446. package/distHelpers/boiler_system.js.map +1 -0
  447. package/distHelpers/create_minimalist_address_space_nodeset.d.ts +5 -0
  448. package/distHelpers/create_minimalist_address_space_nodeset.js +171 -0
  449. package/distHelpers/create_minimalist_address_space_nodeset.js.map +1 -0
  450. package/distHelpers/dump_statemachine.d.ts +6 -0
  451. package/distHelpers/dump_statemachine.js +116 -0
  452. package/distHelpers/dump_statemachine.js.map +1 -0
  453. package/distHelpers/get_address_space_fixture.d.ts +1 -0
  454. package/distHelpers/get_address_space_fixture.js +31 -0
  455. package/distHelpers/get_address_space_fixture.js.map +1 -0
  456. package/distHelpers/get_mini_address_space.d.ts +7 -0
  457. package/distHelpers/get_mini_address_space.js +37 -0
  458. package/distHelpers/get_mini_address_space.js.map +1 -0
  459. package/distHelpers/index.d.ts +11 -0
  460. package/distHelpers/index.js +24 -0
  461. package/distHelpers/index.js.map +1 -0
  462. package/distNodeJS/generate_address_space.d.ts +4 -0
  463. package/distNodeJS/generate_address_space.js +31 -0
  464. package/distNodeJS/generate_address_space.js.map +1 -0
  465. package/distNodeJS/index.d.ts +1 -0
  466. package/distNodeJS/index.js +14 -0
  467. package/distNodeJS/index.js.map +1 -0
  468. package/generate.js +1 -0
  469. package/nodeJS.d.ts +1 -0
  470. package/nodeJS.js +1 -0
  471. package/package.json +87 -0
  472. package/source/address_space_ts.ts +217 -0
  473. package/source/continuation_points/continuation_point_manager.ts +121 -0
  474. package/source/helpers/adjust_browse_direction.ts +15 -0
  475. package/source/helpers/argument_list.ts +286 -0
  476. package/source/helpers/call_helpers.ts +112 -0
  477. package/source/helpers/check_event_clause.ts +62 -0
  478. package/source/helpers/coerce_enum_value.ts +33 -0
  479. package/source/helpers/dump_tools.ts +92 -0
  480. package/source/helpers/ensure_secure_access.ts +88 -0
  481. package/source/helpers/make_optionals_map.ts +49 -0
  482. package/source/helpers/resolve_opaque_on_address_space.ts +23 -0
  483. package/source/index.ts +49 -0
  484. package/source/interfaces/alarms_and_conditions/condition_info_i.ts +13 -0
  485. package/source/interfaces/data_access/ua_multistate_discrete_ex.ts +26 -0
  486. package/source/interfaces/data_access/ua_multistate_value_discrete_ex.ts +34 -0
  487. package/source/interfaces/data_access/ua_two_state_discrete_ex.ts +14 -0
  488. package/source/interfaces/data_access/ua_y_array_item_ex.ts +10 -0
  489. package/source/interfaces/state_machine/ua_exclusive_limit_state_machine_type_ex.ts +14 -0
  490. package/source/interfaces/state_machine/ua_finite_state_machine_type.ts +50 -0
  491. package/source/interfaces/state_machine/ua_program_state_machine_type.ts +13 -0
  492. package/source/interfaces/state_machine/ua_state_machine_type.ts +261 -0
  493. package/source/interfaces/state_machine/ua_transition_ex.ts +7 -0
  494. package/source/interfaces/ua_subscription_diagnostics_variable_ex.ts +8 -0
  495. package/source/loader/generateAddressSpaceRaw.ts +79 -0
  496. package/source/loader/load_nodeset2.ts +1600 -0
  497. package/source/loader/namespace_post_step.ts +36 -0
  498. package/source/loader/register_node_promoter.ts +8 -0
  499. package/source/namespace.ts +9 -0
  500. package/source/namespace_alarm_and_condition.ts +47 -0
  501. package/source/namespace_data_access.ts +60 -0
  502. package/source/namespace_machine_state.ts +13 -0
  503. package/source/pseudo_session.ts +288 -0
  504. package/source/session_context.ts +345 -0
  505. package/source/set_namespace_meta_data.ts +68 -0
  506. package/source/ua_root_folder.ts +10 -0
  507. package/source/ua_two_state_variable_ex.ts +35 -0
  508. package/source/xml_writer.ts +15 -0
  509. package/source_nodejs/generate_address_space.ts +36 -0
  510. package/source_nodejs/index.ts +1 -0
  511. package/src/address_space.ts +1575 -0
  512. package/src/address_space_change_event_tools.ts +177 -0
  513. package/src/address_space_private.ts +98 -0
  514. package/src/alarms_and_conditions/check_where_clause.ts +148 -0
  515. package/src/alarms_and_conditions/condition.ts +89 -0
  516. package/src/alarms_and_conditions/condition_info.ts +66 -0
  517. package/src/alarms_and_conditions/condition_snapshot.ts +766 -0
  518. package/src/alarms_and_conditions/deviation_alarm_helper.ts +66 -0
  519. package/src/alarms_and_conditions/extract_event_fields.ts +104 -0
  520. package/src/alarms_and_conditions/index.ts +18 -0
  521. package/src/alarms_and_conditions/ua_acknowledgeable_condition_impl.ts +339 -0
  522. package/src/alarms_and_conditions/ua_alarm_condition_impl.ts +513 -0
  523. package/src/alarms_and_conditions/ua_base_event_impl.ts +55 -0
  524. package/src/alarms_and_conditions/ua_certificate_expiration_alarm_impl.ts +50 -0
  525. package/src/alarms_and_conditions/ua_condition_impl.ts +1298 -0
  526. package/src/alarms_and_conditions/ua_discrete_alarm_impl.ts +81 -0
  527. package/src/alarms_and_conditions/ua_exclusive_deviation_alarm_impl.ts +110 -0
  528. package/src/alarms_and_conditions/ua_exclusive_level_alarm_impl.ts +19 -0
  529. package/src/alarms_and_conditions/ua_exclusive_limit_alarm_impl.ts +130 -0
  530. package/src/alarms_and_conditions/ua_exclusive_rate_of_change_alarm_impl.ts +24 -0
  531. package/src/alarms_and_conditions/ua_limit_alarm_impl.ts +305 -0
  532. package/src/alarms_and_conditions/ua_non_exclusive_deviation_alarm_impl.ts +108 -0
  533. package/src/alarms_and_conditions/ua_non_exclusive_limit_alarm_impl.ts +224 -0
  534. package/src/alarms_and_conditions/ua_off_normal_alarm_impl.ts +186 -0
  535. package/src/alarms_and_conditions/ua_system_off_normal_alarm_impl.ts +27 -0
  536. package/src/apply_condition_refresh.ts +30 -0
  537. package/src/base_node_impl.ts +1749 -0
  538. package/src/base_node_private.ts +690 -0
  539. package/src/data_access/add_dataItem_stuff.ts +75 -0
  540. package/src/data_access/check_variant_compatibility_ua_analog_item.ts +41 -0
  541. package/src/data_access/ua_multistate_discrete_impl.ts +168 -0
  542. package/src/data_access/ua_multistate_value_discrete.ts +299 -0
  543. package/src/data_access/ua_two_state_discrete.ts +185 -0
  544. package/src/event_data.ts +117 -0
  545. package/src/extension_object_array_node.ts +325 -0
  546. package/src/historical_access/address_space_historical_data_node.ts +828 -0
  547. package/src/index_current.ts +52 -0
  548. package/src/namespace_impl.ts +2181 -0
  549. package/src/namespace_private.ts +60 -0
  550. package/src/nodeid_manager.ts +228 -0
  551. package/src/nodeset_tools/adjust_namespace_array.ts +11 -0
  552. package/src/nodeset_tools/construct_namespace_dependency.ts +40 -0
  553. package/src/nodeset_tools/nodeset_to_xml.ts +1317 -0
  554. package/src/nodeset_tools/typedictionary_to_xml.ts +175 -0
  555. package/src/reference_impl.ts +169 -0
  556. package/src/role_permissions.ts +6 -0
  557. package/src/state_machine/finite_state_machine.ts +428 -0
  558. package/src/state_machine/ua_shelving_state_machine_ex.ts +314 -0
  559. package/src/state_machine/ua_two_state_variable.ts +421 -0
  560. package/src/tool_isSupertypeOf.ts +129 -0
  561. package/src/ua_condition_type.ts +10 -0
  562. package/src/ua_data_type_impl.ts +356 -0
  563. package/src/ua_method_impl.ts +278 -0
  564. package/src/ua_object_impl.ts +203 -0
  565. package/src/ua_object_type_impl.ts +158 -0
  566. package/src/ua_reference_type_impl.ts +174 -0
  567. package/src/ua_variable_impl.ts +2277 -0
  568. package/src/ua_variable_type_impl.ts +741 -0
  569. package/src/ua_view_impl.ts +54 -0
  570. package/testHelpers.d.ts +1 -0
  571. package/testHelpers.js +1 -0
  572. package/test_helpers/add_event_generator_object.ts +71 -0
  573. package/test_helpers/alarms_and_conditions_demo.ts +147 -0
  574. package/test_helpers/assertHasMatchingReference.ts +43 -0
  575. package/test_helpers/boiler_system.ts +618 -0
  576. package/test_helpers/create_minimalist_address_space_nodeset.ts +208 -0
  577. package/test_helpers/dump_statemachine.ts +155 -0
  578. package/test_helpers/get_address_space_fixture.ts +30 -0
  579. package/test_helpers/get_mini_address_space.ts +42 -0
  580. package/test_helpers/index.ts +11 -0
  581. package/test_helpers/test_fixtures/dataType_in_separateNamespace.xml +150 -0
  582. package/test_helpers/test_fixtures/dataType_in_separateNamespace_basic.xml +57 -0
  583. package/test_helpers/test_fixtures/dataType_in_separateNamespace_mix.xml +136 -0
  584. package/test_helpers/test_fixtures/dataType_withEnumeration.xml +82 -0
  585. package/test_helpers/test_fixtures/dataType_with_isOptionSet.xml +194 -0
  586. package/test_helpers/test_fixtures/dataType_with_structures.xml +605 -0
  587. package/test_helpers/test_fixtures/dataType_with_union.xml +1 -0
  588. package/test_helpers/test_fixtures/datatype_as_per_1.04.xml +91 -0
  589. package/test_helpers/test_fixtures/fixture_empty_nodeset2.xml +106 -0
  590. package/test_helpers/test_fixtures/fixture_simple_statemachine_nodeset2.xml +1303 -0
  591. package/test_helpers/test_fixtures/fixuture_nodeset_objects_with_some_methods.xml +362 -0
  592. package/test_helpers/test_fixtures/issue_846.xml +3172 -0
  593. package/test_helpers/test_fixtures/issue_899_variable_with_nodeid_value.xml +33 -0
  594. package/test_helpers/test_fixtures/mini.Node.Set2.xml +4508 -0
  595. package/test_helpers/test_fixtures/mini.nodeset.withVariousVariables.xml +194 -0
  596. package/test_helpers/test_fixtures/minimalist_nodeset_with_models.xml +8 -0
  597. package/test_helpers/test_fixtures/minimalist_nodeset_with_models_more_complex.xml +16 -0
  598. package/test_helpers/test_fixtures/nodeset_with_analog_items.xml +45 -0
@@ -0,0 +1,766 @@
1
+ /**
2
+ * @module node-opcua-address-space.AlarmsAndConditions
3
+ */
4
+ import { EventEmitter } from "events";
5
+
6
+ import { IEventData, UAVariable, BaseNode, ISessionContext, UAObject } from "node-opcua-address-space-base";
7
+ import { assert } from "node-opcua-assert";
8
+ import { UInt16 } from "node-opcua-basic-types";
9
+ import { coerceLocalizedText, LocalizedText, LocalizedTextLike, NodeClass } from "node-opcua-data-model";
10
+ import { DataValue } from "node-opcua-data-value";
11
+ import { checkDebugFlag, make_debugLog } from "node-opcua-debug";
12
+ import { NodeId } from "node-opcua-nodeid";
13
+ import { UAAcknowledgeableCondition } from "node-opcua-nodeset-ua";
14
+ import { StatusCode, StatusCodes } from "node-opcua-status-code";
15
+ import { SimpleAttributeOperand, TimeZoneDataType } from "node-opcua-types";
16
+ import * as utils from "node-opcua-utils";
17
+ import { DataType, Variant } from "node-opcua-variant";
18
+ import { UtcTime } from "../../source/interfaces/state_machine/ua_state_machine_type";
19
+
20
+ import { EventData } from "../event_data";
21
+ import { UATwoStateVariableImpl } from "../state_machine/ua_two_state_variable";
22
+ import { _setAckedState } from "./condition";
23
+ import { UAConditionImpl } from "./ua_condition_impl";
24
+
25
+ const debugLog = make_debugLog(__filename);
26
+ const doDebug = checkDebugFlag(__filename);
27
+
28
+ export interface ConditionSnapshot {
29
+ on(eventName: "value_changed", eventHandler: (node: UAVariable, variant: Variant) => void): this;
30
+ }
31
+
32
+ function normalizeName(str: string): string {
33
+ return str.split(".").map(utils.lowerFirstLetter).join(".");
34
+ }
35
+
36
+ function _visit(self: any, node: BaseNode, prefix: string): void {
37
+ const aggregates = node.getAggregates();
38
+ for (const aggregate of aggregates) {
39
+ if (aggregate.nodeClass === NodeClass.Variable) {
40
+ let name = aggregate.browseName.toString();
41
+ name = utils.lowerFirstLetter(name);
42
+
43
+ const key = prefix + name;
44
+
45
+ // istanbul ignore next
46
+ if (doDebug) {
47
+ debugLog("adding key =", key);
48
+ }
49
+
50
+ const aggregateVariable = aggregate as UAVariable;
51
+ self._map[key] = aggregateVariable.readValue().value;
52
+ self._node_index[key] = aggregateVariable;
53
+
54
+ _visit(self, aggregate, prefix + name + ".");
55
+ }
56
+ }
57
+ }
58
+
59
+ function _record_condition_state(self: any, condition: any) {
60
+ self._map = {};
61
+ self._node_index = {};
62
+ assert(condition instanceof UAConditionImpl);
63
+ _visit(self, condition, "");
64
+ }
65
+
66
+ function _installOnChangeEventHandlers(self: any, node: BaseNode, prefix: string): void {
67
+ const aggregates = node.getAggregates();
68
+ for (const aggregate of aggregates) {
69
+ if (aggregate.nodeClass === NodeClass.Variable) {
70
+ let name = aggregate.browseName.toString();
71
+ name = utils.lowerFirstLetter(name);
72
+
73
+ const key = prefix + name;
74
+
75
+ // istanbul ignore next
76
+ if (doDebug) {
77
+ debugLog("adding key =", key);
78
+ }
79
+
80
+ aggregate.on("value_changed", (newDataValue: DataValue) => {
81
+ self._map[key] = newDataValue.value;
82
+ self._node_index[key] = aggregate;
83
+ });
84
+
85
+ _installOnChangeEventHandlers(self, aggregate, prefix + name + ".");
86
+ }
87
+ }
88
+ }
89
+
90
+ function _ensure_condition_values_correctness(self: any, node: BaseNode, prefix: string, error: string[]) {
91
+ const displayError = !!error;
92
+ error = error || [];
93
+
94
+ const aggregates = node.getAggregates();
95
+
96
+ for (const aggregate of aggregates) {
97
+ if (aggregate.nodeClass === NodeClass.Variable) {
98
+ let name = aggregate.browseName.toString();
99
+ name = utils.lowerFirstLetter(name);
100
+
101
+ const key = prefix + name;
102
+
103
+ const snapshot_value = self._map[key].toString();
104
+
105
+ const aggregateVariable = aggregate as UAVariable;
106
+ const condition_value = aggregateVariable.readValue().value.toString();
107
+
108
+ if (snapshot_value !== condition_value) {
109
+ error.push(
110
+ " Condition Branch0 is not in sync with node values for " +
111
+ key +
112
+ "\n v1= " +
113
+ snapshot_value +
114
+ "\n v2= " +
115
+ condition_value
116
+ );
117
+ }
118
+
119
+ self._node_index[key] = aggregate;
120
+ _ensure_condition_values_correctness(self, aggregate, prefix + name + ".", error);
121
+ }
122
+ }
123
+
124
+ if (displayError && error.length) {
125
+ throw new Error(error.join("\n"));
126
+ }
127
+ }
128
+
129
+ const disabledVar = new Variant({
130
+ dataType: "StatusCode",
131
+ value: StatusCodes.BadConditionDisabled
132
+ });
133
+
134
+ // list of Condition variables that should not be published as BadConditionDisabled when the condition
135
+ // is in a disabled state.
136
+ const _varTable = {
137
+ branchId: 1,
138
+ conditionClassId: 1,
139
+ conditionClassName: 1,
140
+ conditionName: 1,
141
+ enabledState: 1,
142
+ "enabledState.effectiveDisplayName": 1,
143
+ "enabledState.id": 1,
144
+ "enabledState.transitionTime": 1,
145
+ eventId: 1,
146
+ eventType: 1,
147
+ localTime: 1,
148
+ sourceName: 1,
149
+ sourceNode: 1,
150
+ time: 1
151
+ };
152
+
153
+ export class ConditionSnapshot extends EventEmitter {
154
+ public static normalizeName = normalizeName;
155
+
156
+ public condition: BaseNode;
157
+ public eventData: IEventData | null = null;
158
+ public branchId: NodeId | null = null;
159
+ private _map: { [key: string]: Variant } = {};
160
+ private _node_index: { [key: string]: UAVariable } = {};
161
+
162
+ /**
163
+ * @class ConditionSnapshot
164
+ * @extends EventEmitter
165
+ * @param condition
166
+ * @param branchId
167
+ * @constructor
168
+ */
169
+ constructor(condition: BaseNode, branchId: NodeId) {
170
+ super();
171
+ assert(branchId instanceof NodeId);
172
+ // xx self.branchId = branchId;
173
+ this.condition = condition;
174
+ this.eventData = new EventData(condition);
175
+ // a nodeId/Variant map
176
+ _record_condition_state(this, condition);
177
+
178
+ if (branchId === NodeId.nullNodeId) {
179
+ _installOnChangeEventHandlers(this, condition, "");
180
+ }
181
+ this._set_var("branchId", DataType.NodeId, branchId);
182
+ }
183
+
184
+ public _constructEventData(): IEventData {
185
+ if (this.branchId === NodeId.nullNodeId) {
186
+ _ensure_condition_values_correctness(this, this.condition!, "", []);
187
+ }
188
+ const c = this.condition as UAConditionImpl;
189
+ const isDisabled = !c.getEnabledState();
190
+ const eventData = new EventData(this.condition!);
191
+ for (const key of Object.keys(this._map)) {
192
+ const node = this._node_index[key];
193
+ if (!node) {
194
+ debugLog("cannot node for find key", key);
195
+ continue;
196
+ }
197
+ if (isDisabled && !Object.prototype.hasOwnProperty.call(_varTable, key)) {
198
+ eventData.setValue(key, node, disabledVar);
199
+ } else {
200
+ eventData.setValue(key, node, this._map[key]);
201
+ }
202
+ }
203
+
204
+ return eventData;
205
+ }
206
+
207
+ /**
208
+ * @method resolveSelectClause
209
+ * @param selectClause {SelectClause}
210
+ */
211
+ public resolveSelectClause(selectClause: SimpleAttributeOperand): NodeId | null {
212
+ return this.eventData?.resolveSelectClause(selectClause) || null;
213
+ }
214
+
215
+ /**
216
+ *
217
+ */
218
+ public readValue(sessionContext: ISessionContext, nodeId: NodeId, selectClause: SimpleAttributeOperand): Variant {
219
+ const c = this.condition as UAConditionImpl;
220
+ const isDisabled = !c.getEnabledState();
221
+ if (isDisabled) {
222
+ return disabledVar;
223
+ }
224
+
225
+ const key = nodeId.toString();
226
+ const variant = this._map[key];
227
+ if (!variant) {
228
+ // the value is not handled by us .. let's delegate
229
+ // to the eventData helper object
230
+ return this.eventData?.readValue(sessionContext, nodeId, selectClause) || disabledVar;
231
+ }
232
+ return variant;
233
+ }
234
+
235
+ public _get_var(varName: string): any {
236
+ const c = this.condition as UAConditionImpl;
237
+ if (!c.getEnabledState() && !Object.prototype.hasOwnProperty.call(_varTable, varName)) {
238
+ // xx console.log("ConditionSnapshot#_get_var condition enabled =", self.condition.getEnabledState());
239
+ return disabledVar;
240
+ }
241
+
242
+ const key = normalizeName(varName);
243
+ const variant = this._map[key];
244
+ return variant.value;
245
+ }
246
+
247
+ public _set_var(varName: string, dataType: DataType, value: unknown): void {
248
+ const key = normalizeName(varName);
249
+ // istanbul ignore next
250
+ if (!Object.prototype.hasOwnProperty.call(this._map, key)) {
251
+ if (doDebug) {
252
+ debugLog(" cannot find node " + varName);
253
+ debugLog(" map=", Object.keys(this._map).join(" "));
254
+ }
255
+ }
256
+ this._map[key] = new Variant({
257
+ dataType,
258
+ value
259
+ });
260
+
261
+ if (this._map[key + ".sourceTimestamp"]) {
262
+ this._map[key + ".sourceTimestamp"] = new Variant({
263
+ dataType: DataType.DateTime,
264
+ value: new Date()
265
+ });
266
+ }
267
+
268
+ const variant = this._map[key];
269
+ const node = this._node_index[key];
270
+ if (!node) {
271
+ // for instance localTime is optional
272
+ debugLog("Cannot serVar " + varName + " dataType " + DataType[dataType]);
273
+ return;
274
+ }
275
+ assert(node.nodeClass === NodeClass.Variable);
276
+ this.emit("value_changed", node, variant);
277
+ }
278
+
279
+ /**
280
+ * @method getBrandId
281
+ * @return {NodeId}
282
+ */
283
+ public getBranchId(): NodeId {
284
+ return this._get_var("branchId") as NodeId;
285
+ }
286
+
287
+ /**
288
+ * @method getEventId
289
+ * @return {ByteString}
290
+ */
291
+ public getEventId(): Buffer {
292
+ return this._get_var("eventId") as Buffer;
293
+ }
294
+
295
+ /**
296
+ * @method getRetain
297
+ * @return {Boolean}
298
+ */
299
+ public getRetain(): boolean {
300
+ return this._get_var("retain") as boolean;
301
+ }
302
+
303
+ /**
304
+ *
305
+ * @method setRetain
306
+ * @param retainFlag {Boolean}
307
+ */
308
+ public setRetain(retainFlag: boolean): void {
309
+ retainFlag = !!retainFlag;
310
+ return this._set_var("retain", DataType.Boolean, retainFlag);
311
+ }
312
+
313
+ /**
314
+ * @method renewEventId
315
+ *
316
+ */
317
+ public renewEventId(): void {
318
+ const addressSpace = this.condition.addressSpace;
319
+ // create a new event Id for this new condition
320
+ const eventId = addressSpace.generateEventId();
321
+ const ret = this._set_var("eventId", DataType.ByteString, eventId.value);
322
+
323
+ // xx var branch = self; console.log("MMMMMMMMrenewEventId branch " +
324
+ // branch.getBranchId().toString() + " eventId = " + branch.getEventId().toString("hex"));
325
+
326
+ return ret;
327
+ }
328
+
329
+ /**
330
+ * @method getEnabledState
331
+ * @return {Boolean}
332
+ */
333
+ public getEnabledState(): boolean {
334
+ return this._get_twoStateVariable("enabledState");
335
+ }
336
+
337
+ /**
338
+ * @method setEnabledState
339
+ * @param value {Boolean}
340
+ * @return void
341
+ */
342
+ public setEnabledState(value: boolean): void {
343
+ return this._set_twoStateVariable("enabledState", value);
344
+ }
345
+
346
+ /**
347
+ * @method getEnabledStateAsString
348
+ * @return {String}
349
+ */
350
+ public getEnabledStateAsString(): string {
351
+ return this._get_var("enabledState").text;
352
+ }
353
+
354
+ /**
355
+ * @method getComment
356
+ * @return {LocalizedText}
357
+ */
358
+ public getComment(): LocalizedText {
359
+ return this._get_var("comment");
360
+ }
361
+
362
+ /**
363
+ * Set condition comment
364
+ *
365
+ * Comment contains the last comment provided for a certain state (ConditionBranch). It may
366
+ * have been provided by an AddComment Method, some other Method or in some other
367
+ * manner. The initial value of this Variable is null, unless it is provided in some other manner. If
368
+ * a Method provides as an option the ability to set a Comment, then the value of this Variable is
369
+ * reset to null if an optional comment is not provided.
370
+ *
371
+ * @method setComment
372
+ * @param txtMessage {LocalizedText}
373
+ */
374
+ public setComment(txtMessage: LocalizedTextLike): void {
375
+ const txtMessage1 = coerceLocalizedText(txtMessage);
376
+ this._set_var("comment", DataType.LocalizedText, txtMessage1);
377
+ }
378
+
379
+ /**
380
+ *
381
+ * @method setMessage
382
+ * @param txtMessage {LocalizedText}
383
+ */
384
+ public setMessage(txtMessage: LocalizedTextLike | LocalizedText): void {
385
+ const txtMessage1 = coerceLocalizedText(txtMessage);
386
+ return this._set_var("message", DataType.LocalizedText, txtMessage1);
387
+ }
388
+
389
+ /**
390
+ * @method setClientUserId
391
+ * @param userIdentity {String}
392
+ */
393
+ public setClientUserId(userIdentity: string): void {
394
+ return this._set_var("clientUserId", DataType.String, userIdentity.toString());
395
+ }
396
+
397
+ /*
398
+ *
399
+ *
400
+ * as per spec 1.0.3 - Part 9
401
+ *
402
+ * Quality reveals the status of process values or other resources that this Condition instance is
403
+ * based upon. If, for example, a process value is “Uncertain”, the associated “LevelAlarm”
404
+ * Condition is also questionable. Values for the Quality can be any of the OPC StatusCodes
405
+ * defined in Part 8 as well as Good, Uncertain and Bad as defined in Part 4. These
406
+ * StatusCodes are similar to but slightly more generic than the description of data quality in the
407
+ * various field bus specifications. It is the responsibility of the Server to map internal status
408
+ * information to these codes. A Server which supports no quality information shall return Good.
409
+ * This quality can also reflect the communication status associated with the system that this
410
+ * value or resource is based on and from which this Alarm was received. For communication
411
+ * errors to the underlying system, especially those that result in some unavailable Event fields,
412
+ * the quality shall be BadNoCommunication error.
413
+ *
414
+ * Quality refers to the quality of the data value(s) upon which this Condition is based. Since a
415
+ * Condition is usually based on one or more Variables, the Condition inherits the quality of
416
+ * these Variables. E.g., if the process value is “Uncertain”, the “LevelAlarm” Condition is also
417
+ * questionable. If more than one variable is represented by a given condition or if the condition
418
+ * is from an underlining system and no direct mapping to a variable is available, it is up to the
419
+ * application to determine what quality is displayed as part of the condition.
420
+ */
421
+
422
+ /**
423
+ * set the condition quality
424
+ * @method setQuality
425
+ * @param quality {StatusCode}
426
+ */
427
+ public setQuality(quality: StatusCode): void {
428
+ this._set_var("quality", DataType.StatusCode, quality);
429
+ }
430
+
431
+ /**
432
+ * @method getQuality
433
+ * @return {StatusCode}
434
+ */
435
+ public getQuality(): StatusCode {
436
+ return this._get_var("quality") as StatusCode;
437
+ }
438
+
439
+ /*
440
+ * as per spec 1.0.3 - Part 9
441
+ * The Severity of a Condition is inherited from the base Event model defined in Part 5. It
442
+ * indicates the urgency of the Condition and is also commonly called ‘priority’, especially in
443
+ * relation to Alarms in the ProcessConditionClass.
444
+ *
445
+ * as per spec 1.0.3 - PArt 5
446
+ * Severity is an indication of the urgency of the Event. This is also commonly called “priority”.
447
+ * Values will range from 1 to 1 000, with 1 being the lowest severity and 1 000 being the highest.
448
+ * Typically, a severity of 1 would indicate an Event which is informational in nature, while a value
449
+ * of 1 000 would indicate an Event of catastrophic nature, which could potentially result in severe
450
+ * financial loss or loss of life.
451
+ * It is expected that very few Server implementations will support 1 000 distinct severity levels.
452
+ * Therefore, Server developers are responsible for distributing their severity levels across the
453
+ * 1 to 1 000 range in such a manner that clients can assume a linear distribution. For example, a
454
+ * client wishing to present five severity levels to a user should be able to do the following
455
+ * mapping:
456
+ * Client Severity OPC Severity
457
+ * HIGH 801 – 1 000
458
+ * MEDIUM HIGH 601 – 800
459
+ * MEDIUM 401 – 600
460
+ * MEDIUM LOW 201 – 400
461
+ * LOW 1 – 200
462
+ * In many cases a strict linear mapping of underlying source severities to the OPC Severity range
463
+ * is not appropriate. The Server developer will instead intelligently map the underlying source
464
+ * severities to the 1 to 1 000 OPC Severity range in some other fashion. In particular, it is
465
+ * recommended that Server developers map Events of high urgency into the OPC severity range
466
+ * of 667 to 1 000, Events of medium urgency into the OPC severity range of 334 to 666 and
467
+ * Events of low urgency into OPC severities of 1 to 333.
468
+ */
469
+ /**
470
+ * @method setSeverity
471
+ * @param severity {UInt16}
472
+ */
473
+ public setSeverity(severity: UInt16): void {
474
+ assert(isFinite(severity), "expecting a UInt16");
475
+
476
+ // record automatically last severity
477
+ const lastSeverity = this.getSeverity();
478
+ this.setLastSeverity(lastSeverity);
479
+ this._set_var("severity", DataType.UInt16, severity);
480
+ }
481
+
482
+ /**
483
+ * @method getSeverity
484
+ * @return {UInt16}
485
+ */
486
+ public getSeverity(): UInt16 {
487
+ const c = this.condition as UAConditionImpl;
488
+ assert(c.getEnabledState(), "condition must be enabled");
489
+ const value = this._get_var("severity");
490
+ return +value;
491
+ }
492
+
493
+ /*
494
+ * as per spec 1.0.3 - part 9:
495
+ * LastSeverity provides the previous severity of the ConditionBranch. Initially this Variable
496
+ * contains a zero value; it will return a value only after a severity change. The new severity is
497
+ * supplied via the Severity Property which is inherited from the BaseEventType.
498
+ *
499
+ */
500
+ /**
501
+ * @method setLastSeverity
502
+ * @param severity {UInt16}
503
+ */
504
+ public setLastSeverity(severity: UInt16): void {
505
+ severity = +severity;
506
+ return this._set_var("lastSeverity", DataType.UInt16, severity);
507
+ }
508
+
509
+ /**
510
+ * @method getLastSeverity
511
+ * @return {UInt16}
512
+ */
513
+ public getLastSeverity(): UInt16 {
514
+ const value = this._get_var("lastSeverity");
515
+ return +value;
516
+ }
517
+
518
+ /**
519
+ * setReceiveTime
520
+ *
521
+ * (as per OPCUA 1.0.3 part 5)
522
+ *
523
+ * ReceiveTime provides the time the OPC UA Server received the Event from the underlying
524
+ * device of another Server.
525
+ *
526
+ * ReceiveTime is analogous to ServerTimestamp defined in Part 4, i.e.
527
+ * in the case where the OPC UA Server gets an Event from another OPC UA Server, each Server
528
+ * applies its own ReceiveTime. That implies that a Client may get the same Event, having the
529
+ * same EventId, from different Servers having different values of the ReceiveTime.
530
+ *
531
+ * The ReceiveTime shall always be returned as value and the Server is not allowed to return a
532
+ * StatusCode for the ReceiveTime indicating an error.
533
+ *
534
+ * @method setReceiveTime
535
+ * @param time {Date} : UTCTime
536
+ */
537
+ public setReceiveTime(time: UtcTime): void {
538
+ assert(time instanceof Date);
539
+ return this._set_var("receiveTime", DataType.DateTime, time);
540
+ }
541
+
542
+ /**
543
+ * (as per OPCUA 1.0.3 part 5)
544
+ * Time provides the time the Event occurred. This value is set as close to the event generator as
545
+ * possible. It often comes from the underlying system or device. Once set, intermediate OPC UA
546
+ * Servers shall not alter the value.
547
+ *
548
+ * @method setTime
549
+ * @param time {Date}
550
+ */
551
+ public setTime(time: Date): void {
552
+ assert(time instanceof Date);
553
+ return this._set_var("time", DataType.DateTime, time);
554
+ }
555
+
556
+ /**
557
+ * LocalTime is a structure containing the Offset and the DaylightSavingInOffset flag. The Offset
558
+ * specifies the time difference (in minutes) between the Time Property and the time at the location
559
+ * in which the event was issued. If DaylightSavingInOffset is TRUE, then Standard/Daylight
560
+ * savings time (DST) at the originating location is in effect and Offset includes the DST c orrection.
561
+ * If FALSE then the Offset does not include DST correction and DST may or may not have been
562
+ * in effect.
563
+ * @method setLocalTime
564
+ * @param localTime {TimeZone}
565
+ */
566
+ public setLocalTime(localTime: TimeZoneDataType): void {
567
+ assert(localTime instanceof TimeZoneDataType);
568
+ return this._set_var("localTime", DataType.ExtensionObject, new TimeZoneDataType(localTime));
569
+ }
570
+
571
+ // read only !
572
+ public getSourceName(): LocalizedText {
573
+ return this._get_var("sourceName");
574
+ }
575
+
576
+ /**
577
+ * @method getSourceNode
578
+ * return {NodeId}
579
+ */
580
+ public getSourceNode(): NodeId {
581
+ return this._get_var("sourceNode");
582
+ }
583
+
584
+ /**
585
+ * @method getEventType
586
+ * return {NodeId}
587
+ */
588
+ public getEventType(): NodeId {
589
+ return this._get_var("eventType");
590
+ }
591
+
592
+ public getMessage(): LocalizedText {
593
+ return this._get_var("message");
594
+ }
595
+
596
+ public isCurrentBranch(): boolean {
597
+ return this._get_var("branchId") === NodeId.nullNodeId;
598
+ }
599
+
600
+ // -- ACKNOWLEDGEABLE -------------------------------------------------------------------
601
+
602
+ public getAckedState(): boolean {
603
+ const acknowledgeableCondition = this.condition as UAAcknowledgeableCondition;
604
+ if (!acknowledgeableCondition.ackedState) {
605
+ throw new Error(
606
+ "Node " +
607
+ acknowledgeableCondition.browseName.toString() +
608
+ " of type " +
609
+ acknowledgeableCondition.typeDefinitionObj.browseName.toString() +
610
+ " has no AckedState"
611
+ );
612
+ }
613
+ return this._get_twoStateVariable("ackedState");
614
+ }
615
+
616
+ public setAckedState(ackedState: boolean): StatusCode {
617
+ ackedState = !!ackedState;
618
+
619
+ return _setAckedState(this, ackedState);
620
+ }
621
+
622
+ public getConfirmedState(): boolean {
623
+ const acknowledgeableCondition = this.condition as UAAcknowledgeableCondition;
624
+ assert(acknowledgeableCondition.confirmedState, "Must have a confirmed state");
625
+ return this._get_twoStateVariable("confirmedState");
626
+ }
627
+
628
+ public setConfirmedStateIfExists(confirmedState: boolean): void {
629
+ confirmedState = !!confirmedState;
630
+ const acknowledgeableCondition = this.condition as UAAcknowledgeableCondition;
631
+ if (!acknowledgeableCondition.confirmedState) {
632
+ // no condition node has been defined (this is valid)
633
+ // confirm state cannot be set
634
+ return;
635
+ }
636
+ // todo deal with Error code BadConditionBranchAlreadyConfirmed
637
+ return this._set_twoStateVariable("confirmedState", confirmedState);
638
+ }
639
+
640
+ public setConfirmedState(confirmedState: boolean): void {
641
+ const acknowledgeableCondition = this.condition as UAAcknowledgeableCondition;
642
+ assert(acknowledgeableCondition.confirmedState, "Must have a confirmed state. Add ConfirmedState to the optionals");
643
+ return this.setConfirmedStateIfExists(confirmedState);
644
+ }
645
+
646
+ // ---- Shelving
647
+ /**
648
+ * @class ConditionSnapshot
649
+ */
650
+ /**
651
+ * @method getSuppressedState
652
+ * @return {Boolean}
653
+ */
654
+ public getSuppressedState(): boolean {
655
+ return this._get_twoStateVariable("suppressedState");
656
+ }
657
+
658
+ /**
659
+ * @method setSuppressedState
660
+ * @param suppressed {Boolean}
661
+ */
662
+ public setSuppressedState(suppressed: boolean): void {
663
+ suppressed = !!suppressed;
664
+ this._set_twoStateVariable("suppressedState", suppressed);
665
+ }
666
+
667
+ public getActiveState(): boolean {
668
+ return this._get_twoStateVariable("activeState");
669
+ }
670
+
671
+ public setActiveState(newActiveState: boolean): StatusCode {
672
+ // xx var activeState = self.getActiveState();
673
+ // xx if (activeState === newActiveState) {
674
+ // xx return StatusCodes.Bad;
675
+ // xx }
676
+ this._set_twoStateVariable("activeState", newActiveState);
677
+ return StatusCodes.Good;
678
+ }
679
+
680
+ // tslint:disable:no-empty
681
+ public setShelvingState(): void {
682
+ // todo
683
+ }
684
+
685
+ public toString(): string {
686
+ // public condition: any = null;
687
+ // public eventData: any = null;
688
+ // public branchId: NodeId | null = null;
689
+ const t = this.condition.addressSpace.findNode((this.condition as UAObject).typeDefinition)!;
690
+ return (
691
+ "" +
692
+ "condition: " +
693
+ (this.condition.browseName.toString() + " " + this.condition.nodeId.toString()) +
694
+ ", type: " +
695
+ (t.browseName.toString() + " " + t.nodeId.toString()) +
696
+ ", branchId: " +
697
+ (this.branchId ? this.branchId.toString() : "<null>") +
698
+ ", acked: " +
699
+ this.getAckedState() +
700
+ ", confirmed: " +
701
+ this.getConfirmedState() +
702
+ ", activeState: " +
703
+ this.getActiveState() +
704
+ // + ", suppressed: " + this.getSuppressedState()
705
+ ", retain: " +
706
+ this.getRetain() +
707
+ ", message: " +
708
+ this.getMessage() +
709
+ ", comment: " +
710
+ this.getComment()
711
+ );
712
+ }
713
+ /**
714
+ * @class ConditionSnapshot
715
+ * @param varName
716
+ * @param value
717
+ * @private
718
+ */
719
+ public _set_twoStateVariable(varName: string, value: boolean): void {
720
+ value = !!value;
721
+
722
+ const hrKey = ConditionSnapshot.normalizeName(varName);
723
+ const idKey = ConditionSnapshot.normalizeName(varName) + ".id";
724
+
725
+ const variant = new Variant({ dataType: DataType.Boolean, value });
726
+ this._map[idKey] = variant;
727
+
728
+ // also change varName with human readable text
729
+ const twoStateNode = this._node_index[hrKey];
730
+ if (!twoStateNode) {
731
+ throw new Error("Cannot find twoState Variable with name " + varName);
732
+ }
733
+ if (!(twoStateNode instanceof UATwoStateVariableImpl)) {
734
+ throw new Error("Cannot find twoState Variable with name " + varName + " " + twoStateNode);
735
+ }
736
+
737
+ const hrValue = new Variant({
738
+ dataType: DataType.LocalizedText,
739
+ value: value ? twoStateNode.getTrueState() : twoStateNode.getFalseState()
740
+ });
741
+ this._map[hrKey] = hrValue;
742
+
743
+ const node = this._node_index[idKey];
744
+
745
+ // also change ConditionNode if we are on currentBranch
746
+ if (this.isCurrentBranch()) {
747
+ assert(twoStateNode instanceof UATwoStateVariableImpl);
748
+ twoStateNode.setValue(value as boolean);
749
+ // xx console.log("Is current branch", twoStateNode.toString(),variant.toString());
750
+ // xx console.log(" = ",twoStateNode.getValue());
751
+ }
752
+ this.emit("value_changed", node, variant);
753
+ }
754
+
755
+ protected _get_twoStateVariable(varName: string): any {
756
+ const key = ConditionSnapshot.normalizeName(varName) + ".id";
757
+ const variant = this._map[key];
758
+
759
+ // istanbul ignore next
760
+ if (!variant) {
761
+ return "???";
762
+ // throw new Error("Cannot find TwoStateVariable with name " + varName);
763
+ }
764
+ return variant.value;
765
+ }
766
+ }