cwmp_ex v0.2.1 CWMP.Protocol.GenerateHelpers

A helper module for generating various bits of XML or other stings for the Generator modules.

Summary

Functions

Translates a boolean value to “0” or “1”

Generates the XML for a FaultStruct used in TransferComplete and AutonomousTransferComplete and which ever other requests that include a FaultStruct. The ‘fault’ parameter is a types/fault_struct.ex type

Ensures that the passed value is an integer and that it satisfies the restraints layed out by the anon function passed

Generates a string that represents the timestructure. If the timestructure given is somehow invalid, the default is used to generate a timestring. For Inform that would be today. For TransferComplete and others that have epoch as the default value, that is used

Functions

boolValue(b)

Translates a boolean value to “0” or “1”

faultStruct(fault)

Generates the XML for a FaultStruct used in TransferComplete and AutonomousTransferComplete and which ever other requests that include a FaultStruct. The ‘fault’ parameter is a types/fault_struct.ex type.

integerValue(i, fun \\ fn x -> x end)

Ensures that the passed value is an integer and that it satisfies the restraints layed out by the anon function passed.

timeString(timestruct, default \\ DateTime.from_unix!(0))
timeString(DateTime.t, DateTime.t) :: String.t

Generates a string that represents the timestructure. If the timestructure given is somehow invalid, the default is used to generate a timestring. For Inform that would be today. For TransferComplete and others that have epoch as the default value, that is used.