Combining Pager Features
Many features of the LRS alphapager protocol can be combined. For instance, a group page may have alert overrides, or a group page may be encrypted. It is important that these features are combined properly to achieve the desired the results.
The following pseudocode illustrates how all the features of the LRS alphapager could be brought together.
procedure send_page(
int system_id,
int id, // pager, group, or table number (0 for system control pages)
bool is_group,
bool is_table,
string message,
PageMode mode,
bool encrypt)
begin
if is_group and is_table
throw invalid_page // cannot be group and table page
end
if not mode.isNull() then
if id == 0 then
// system control pages can’t have alert overrides
throw invalid_page
end
message = message + "\f" + mode.toAlertOverride()
end
if encrypt then
if id == 0 then
// system control messages can’t be encrypted
throw invalid_page
end
message = encrypt_message(message)
end
if is_group then
if not id in [1, 98] then
throw bad_group_id
end
message = sprintf("[%02d]", id) + message
id = 0 // System capcode is pager ID 0
end
if is_table then
if id in [1, 1000] then
throw bad_table_number
end
message = sprintf("[#%05d]", id) + message
id = 0 // System capcode is pager ID 0
end
capcode = calc_capcode(system_id, id)
transmit_page(capcode, message)
end
Updated less than a minute ago