@@ -9,8 +9,6 @@ defmodule DiffoExample.Nbn.Util do
99 Util - various utilities for NBN domain
1010 """
1111
12- alias DiffoExample.Nbn.Technology
13-
1412 @ doc """
1513 Generates a new random NBN identifier with the prefix
1614
@@ -54,123 +52,4 @@ defmodule DiffoExample.Nbn.Util do
5452 % { value: value } -> value |> Diffo.Unwrap . unwrap ( ) |> Map . get ( field )
5553 end
5654 end
57-
58- @ doc """
59- Returns a tuple of maximum downstream and upstream speeds in Mbps
60- given the bandwidth_profile and technology, or :error
61-
62- ## Examples
63- iex> DiffoExample.Nbn.Util.speeds(:D12_U1, :Satellite)
64- {12, 1}
65- iex> DiffoExample.Nbn.Util.speeds(:home_fast, :FTTP)
66- {500, 50}
67- iex> DiffoExample.Nbn.Util.speeds(:home_hyperfast, :HFC)
68- {2000, 100}
69- iex> DiffoExample.Nbn.Util.speeds(:home_fast, :FixedWireless)
70- :error
71- """
72- def speeds ( :D12_U1 , technology ) when is_atom ( technology ) do
73- if technology in Technology . technology ( ) do
74- { 12 , 1 }
75- else
76- :error
77- end
78- end
79-
80- def speeds ( :D25_U5 , technology ) when is_atom ( technology ) do
81- if technology in Technology . technology ( ) do
82- { 25 , 5 }
83- else
84- :error
85- end
86- end
87-
88- def speeds ( :D25_U10 , technology ) when is_atom ( technology ) do
89- if technology in [ :FTTP , :HFC , :FTTC ] do
90- { 25 , 10 }
91- else
92- :error
93- end
94- end
95-
96- def speeds ( :D50_U20 , technology ) when is_atom ( technology ) do
97- if technology in [ :FTTP , :HFC , :FTTC ] do
98- { 50 , 20 }
99- else
100- :error
101- end
102- end
103-
104- def speeds ( bandwidth_profile , :FixedWireless ) do
105- case bandwidth_profile do
106- :wireless_plus ->
107- { 100 , 20 }
108-
109- :wireless_fast ->
110- { 250 , 20 }
111-
112- :wireless_superfast ->
113- { 400 , 40 }
114-
115- _ ->
116- :error
117- end
118- end
119-
120- def speeds ( bandwidth_profile , :HFC ) do
121- case bandwidth_profile do
122- :home_fast ->
123- { 500 , 50 }
124-
125- :home_superfast ->
126- { 750 , 50 }
127-
128- :home_ultrafast ->
129- { 1000 , 100 }
130-
131- :home_hyperfast ->
132- { 2000 , 100 }
133-
134- :U100_D40 ->
135- { 100 , 40 }
136-
137- _ ->
138- :error
139- end
140- end
141-
142- def speeds ( bandwidth_profile , :FTTP ) do
143- case bandwidth_profile do
144- :home_fast ->
145- { 500 , 50 }
146-
147- :home_superfast ->
148- { 750 , 50 }
149-
150- :home_ultrafast ->
151- { 1000 , 100 }
152-
153- :home_hyperfast ->
154- { 2000 , 200 }
155-
156- :D100_U40 ->
157- { 100 , 40 }
158-
159- :D250_U100 ->
160- { 250 , 100 }
161-
162- :D500_200 ->
163- { 500 , 200 }
164-
165- :D1000_400 ->
166- { 1000 , 400 }
167-
168- _ ->
169- :error
170- end
171- end
172-
173- def speed ( _bandwidth , _technology ) do
174- :error
175- end
17655end
0 commit comments