ExCEP.Model (ex_cep v0.1.1)

Copy Markdown

CSG CEP Plug-and-Play Device Model structure aligned with TS2.1 (Section 8, Tables 27–28, Section 9, Appendix B).

Model Naming Convention (TS2.1 Section 8.1)

<manufacturerId>_<devType>_<fileType>_<version>

  • manufacturerId: 1..6 ASCII alphanumeric/hyphen characters (no _)
  • devType: 1..12 ASCII alphanumeric/hyphen characters (no _)
  • fileType: "I" (DL/T 860 ICD) or "J" (simplified JSON)
  • version: "Vx.xx" (e.g. "V1.00")
  • Example: "AABB_ABC-1122C_J_V1.00" -> file "/data/app/model/AABB_ABC-1122C_J_V1.00.json"

Summary

Functions

Builds the TS2.2 GetModelResp / ModelChange metadata map (ModelName, ModifyTime, FullPathFileName, FileCrc) for a model and its serialized file binary.

Returns the default TS2.1 gateway model directory "/data/app/model".

Finds a %Point{} by service_id and its DataRefer ("LDname.LNtype.LNinst.DOname") or bare DOname.

Lists all %Point{} entries for service_id (or across all services if nil).

Returns the 5 standard TS2.1 serviceId values.

Validates a TS2.1 simplified model filename ("<model>.json") or ICD filename ("<model>.icd").

Validates a model name against TS2.1 Section 8.1: <mfg(1..6)>_<devType(1..12)>_<I|J>_V<x.xx>.

Types

t()

@type t() :: %ExCEP.Model{
  dev_type: String.t(),
  manufacturer_desc: String.t(),
  manufacturer_id: String.t(),
  model: String.t(),
  model_desc: String.t(),
  modify_time: String.t() | nil,
  schema: String.t(),
  services: [ExCEP.Model.Service.t()],
  version: String.t()
}

Functions

build_model_meta(model, full_path_file_name, file_binary)

@spec build_model_meta(t(), String.t(), binary()) :: map()

Builds the TS2.2 GetModelResp / ModelChange metadata map (ModelName, ModifyTime, FullPathFileName, FileCrc) for a model and its serialized file binary.

default_model_dir()

@spec default_model_dir() :: String.t()

Returns the default TS2.1 gateway model directory "/data/app/model".

find_point(model, service_id, ref_or_doname)

@spec find_point(t(), String.t(), String.t()) ::
  {:ok, ExCEP.Model.Point.t()} | {:error, :not_found}

Finds a %Point{} by service_id and its DataRefer ("LDname.LNtype.LNinst.DOname") or bare DOname.

list_points(model, service_id)

@spec list_points(t(), String.t() | nil) :: [ExCEP.Model.Point.t()]

Lists all %Point{} entries for service_id (or across all services if nil).

standard_services()

@spec standard_services() :: [String.t()]

Returns the 5 standard TS2.1 serviceId values.

validate_filename(filename)

@spec validate_filename(String.t()) :: :ok | {:error, :invalid_model_filename}

Validates a TS2.1 simplified model filename ("<model>.json") or ICD filename ("<model>.icd").

validate_model_name(name)

@spec validate_model_name(String.t()) :: :ok | {:error, :invalid_model_name}

Validates a model name against TS2.1 Section 8.1: <mfg(1..6)>_<devType(1..12)>_<I|J>_V<x.xx>.