2018-02-09 18:55:53 +00:00
|
|
|
# Copyright 2018 Stuart Buchanan
|
|
|
|
# This file is part of FlightGear.
|
|
|
|
#
|
|
|
|
# Foobar is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# FlightGear is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with FlightGear. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
#
|
2018-01-13 21:07:32 +00:00
|
|
|
#
|
|
|
|
# Emesary interface to access nav data such as airport information, fixes etc.
|
|
|
|
#
|
|
|
|
|
|
|
|
var NavDataInterface = {
|
|
|
|
|
2018-04-06 18:52:18 +00:00
|
|
|
# Valid FMS Modes
|
|
|
|
|
|
|
|
FMS_MODES : {
|
|
|
|
direct : 1,
|
|
|
|
leg : 1,
|
|
|
|
obs : 1,
|
|
|
|
},
|
|
|
|
|
2018-02-09 15:01:33 +00:00
|
|
|
new : func ()
|
2018-01-13 21:07:32 +00:00
|
|
|
{
|
|
|
|
var obj = { parents : [ NavDataInterface ] };
|
|
|
|
|
|
|
|
# Emesary
|
|
|
|
obj._recipient = nil;
|
|
|
|
obj._transmitter = emesary.GlobalTransmitter;
|
|
|
|
obj._registered = 0;
|
2018-01-30 20:59:16 +00:00
|
|
|
obj._defaultDTO = "";
|
2018-01-13 21:07:32 +00:00
|
|
|
|
2018-01-27 21:55:22 +00:00
|
|
|
# List of recently use waypoints
|
|
|
|
obj._recentWaypoints = std.Vector.new();
|
|
|
|
|
2018-01-13 21:07:32 +00:00
|
|
|
return obj;
|
|
|
|
},
|
|
|
|
|
|
|
|
# Find the airports within 200nm and return them.
|
|
|
|
getNearestAirports : func()
|
|
|
|
{
|
|
|
|
# To make this more efficient for areas with a high density of airports, we'll try
|
|
|
|
# a small radius first and expand until we have reached 200nm or have 25 airports.
|
|
|
|
var radius = 0;
|
|
|
|
var apts = [];
|
|
|
|
|
|
|
|
while ((radius <= 200) and (size(apts) < 25)) {
|
|
|
|
radius = radius + 50;
|
|
|
|
apts = findAirportsWithinRange(radius);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (size(apts) > 25) {
|
|
|
|
apts = subvec(apts, 0, 25);
|
|
|
|
}
|
|
|
|
|
|
|
|
return apts;
|
|
|
|
},
|
|
|
|
|
2018-01-31 22:47:35 +00:00
|
|
|
# Find the nearest nav aids of a given type within 200nm, to a maximum of 25.
|
|
|
|
getNavDataWithinRange: func(type)
|
|
|
|
{
|
|
|
|
# To make this more efficient for areas with a high density of fixes, we'll try
|
|
|
|
# a small radius first and expand until we have reached 200nm or have 25 nav aids.
|
|
|
|
var radius = 0;
|
|
|
|
var navdata = [];
|
|
|
|
|
|
|
|
while ((radius <= 200) and (size(navdata) < 25)) {
|
|
|
|
radius = radius + 50;
|
|
|
|
navdata = findNavaidsWithinRange(radius, type);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (size(navdata) > 25) {
|
|
|
|
navdata = subvec(navdata, 0, 25);
|
|
|
|
}
|
|
|
|
|
|
|
|
return navdata;
|
|
|
|
},
|
|
|
|
|
2018-01-26 19:06:06 +00:00
|
|
|
# Find a specific airport by ID. Return an array of airport objects
|
2018-01-13 21:07:32 +00:00
|
|
|
getAirportById : func(id)
|
|
|
|
{
|
2018-01-26 19:06:06 +00:00
|
|
|
var apt = findAirportsByICAO(id, "airport");
|
2018-01-27 21:55:22 +00:00
|
|
|
|
|
|
|
if ((apt != nil) and (! me._recentWaypoints.contains(id))) {
|
|
|
|
me._recentWaypoints.insert(0, id);
|
|
|
|
}
|
|
|
|
|
2018-01-13 21:07:32 +00:00
|
|
|
return apt;
|
|
|
|
},
|
|
|
|
|
2018-01-26 19:06:06 +00:00
|
|
|
# Find an arbritrary piece of nav data by ID. This searches based on the
|
|
|
|
# current location and returns an array of objects that match the id.
|
|
|
|
getNavDataById : func (id)
|
|
|
|
{
|
|
|
|
# Check for airport first
|
|
|
|
var navdata = findAirportsByICAO(id, "airport");
|
|
|
|
|
|
|
|
# Check for Navaids.
|
|
|
|
if (size(navdata) == 0) navdata = findNavaidsByID(id);
|
|
|
|
|
|
|
|
# Check for fix.
|
|
|
|
if (size(navdata) == 0) navdata = findFixesByID(id);
|
|
|
|
|
2018-01-30 19:51:58 +00:00
|
|
|
# Check for a pseudo-fix in the flightplan
|
|
|
|
if (size(navdata) == 0) {
|
|
|
|
var fp = flightplan();
|
|
|
|
if (fp != nil) {
|
|
|
|
for (var i = 0; i < fp.getPlanSize(); i = i +1) {
|
|
|
|
var wp = fp.getWP(i);
|
|
|
|
if (wp.wp_name == id) {
|
|
|
|
append(navdata, wp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-01-27 21:55:22 +00:00
|
|
|
if ((size(navdata) > 0) and (! me._recentWaypoints.contains(id))) {
|
|
|
|
me._recentWaypoints.insert(0, id);
|
|
|
|
}
|
|
|
|
|
2018-01-26 19:06:06 +00:00
|
|
|
return navdata;
|
|
|
|
},
|
|
|
|
|
2018-02-02 16:06:42 +00:00
|
|
|
# Find a Nav Aid by ID. This searches based on the
|
|
|
|
# current location and returns an array of objects that match the id.
|
|
|
|
getNavAidById : func (params)
|
|
|
|
{
|
|
|
|
var id = params.id;
|
|
|
|
var type = "all";
|
|
|
|
if (params.type != nil) type = params.type;
|
2018-02-04 21:40:37 +00:00
|
|
|
|
2018-02-02 16:06:42 +00:00
|
|
|
var navdata = findNavaidsByID(id, type);
|
|
|
|
if ((size(navdata) > 0) and (! me._recentWaypoints.contains(id))) {
|
|
|
|
me._recentWaypoints.insert(0, id);
|
|
|
|
}
|
|
|
|
return navdata;
|
|
|
|
},
|
|
|
|
|
2018-01-27 21:55:22 +00:00
|
|
|
# Retrieve the current flightplan and return it
|
|
|
|
getFlightplan : func ()
|
|
|
|
{
|
|
|
|
return flightplan();
|
|
|
|
},
|
|
|
|
|
2018-04-07 12:23:26 +00:00
|
|
|
# Retrieve the checklists for this aircraft.
|
|
|
|
getChecklists : func()
|
|
|
|
{
|
2018-04-11 19:56:22 +00:00
|
|
|
var checklists = {};
|
|
|
|
var checklistprops = props.globals.getNode("/sim/checklists");
|
|
|
|
|
2018-04-12 21:26:58 +00:00
|
|
|
var groups = checklistprops.getChildren("group");
|
|
|
|
|
|
|
|
if (size(groups) > 0) {
|
|
|
|
foreach (var group; groups) {
|
|
|
|
var grp = group.getNode("name", 1).getValue();
|
|
|
|
checklists[grp] = {};
|
|
|
|
foreach (var chklist; group.getChildren("checklist")) {
|
|
|
|
var items = [];
|
|
|
|
var title = chklist.getNode("title", 1).getValue();
|
|
|
|
|
|
|
|
# Checklists can optionally be broken down into individual pages.
|
|
|
|
foreach (var pg; chklist.getChildren("page")) {
|
|
|
|
foreach (var item; pg.getChildren("item")) {
|
|
|
|
var name = item.getNode("name", 1).getValue();
|
|
|
|
var value = item.getNode("value", 1).getValue();
|
|
|
|
append(items, { Name : name, Value: value, Checked: 0 });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach (var item; chklist.getChildren("item")) {
|
|
|
|
var name = item.getNode("name", 1).getValue();
|
|
|
|
var value = item.getNode("value", 1).getValue();
|
|
|
|
append(items, { Name : name, Value: value, Checked: 0 });
|
|
|
|
}
|
|
|
|
|
|
|
|
# items now contains a list of all the checklists for
|
|
|
|
checklists[grp][title] = items;
|
|
|
|
}
|
2018-04-11 19:56:22 +00:00
|
|
|
}
|
2018-04-12 21:26:58 +00:00
|
|
|
} else {
|
|
|
|
# Checklist doesn't contain any groups, so try to split into Standard
|
|
|
|
# and Emergency groups by looking at the checklist titles.
|
|
|
|
|
|
|
|
foreach (var chklist; checklistprops.getChildren("checklist")) {
|
|
|
|
var title = chklist.getNode("title", 1).getValue();
|
|
|
|
var grp = "Standard";
|
|
|
|
var items = [];
|
|
|
|
if (find("emergency", string.lc(title)) != -1) {
|
|
|
|
grp = "EMERGENCY";
|
|
|
|
}
|
|
|
|
|
|
|
|
# Checklists can optionally be broken down into individual pages.
|
|
|
|
foreach (var pg; chklist.getChildren("page")) {
|
|
|
|
foreach (var item; pg.getChildren("item")) {
|
|
|
|
var name = item.getNode("name", 1).getValue();
|
|
|
|
var value = item.getNode("value", 1).getValue();
|
|
|
|
append(items, { Name : name, Value: value, Checked: 0 });
|
|
|
|
}
|
|
|
|
}
|
2018-04-11 19:56:22 +00:00
|
|
|
|
2018-04-12 21:26:58 +00:00
|
|
|
foreach (var item; chklist.getChildren("item")) {
|
2018-04-11 19:56:22 +00:00
|
|
|
var name = item.getNode("name", 1).getValue();
|
|
|
|
var value = item.getNode("value", 1).getValue();
|
2018-04-12 21:26:58 +00:00
|
|
|
append(items, { Name : name, Value: value, Checked: 0 });
|
2018-04-11 19:56:22 +00:00
|
|
|
}
|
|
|
|
|
2018-04-12 21:26:58 +00:00
|
|
|
# items now contains a list of all the checklists for
|
|
|
|
checklists[grp][title] = items;
|
2018-04-11 19:56:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return checklists;
|
2018-04-07 12:23:26 +00:00
|
|
|
},
|
|
|
|
|
2018-04-06 18:52:18 +00:00
|
|
|
insertWaypoint : func (data)
|
|
|
|
{
|
|
|
|
assert(data["index"] != nil, "InsertWaypoint message with no index parameter");
|
|
|
|
assert(data["wp"] != nil, "InsertWaypoint message with no wp parameter");
|
|
|
|
|
|
|
|
var wp = data["wp"];
|
|
|
|
var idx = int(data["index"]);
|
|
|
|
|
|
|
|
# Simple data verification that we have the parameters we need
|
|
|
|
assert(idx != nil, "InsertWaypoint index parameter does not contain an integer index");
|
|
|
|
assert(wp.id != nil, "InsertWaypoint wp parameter does not contain an id");
|
|
|
|
assert(wp.lat != nil, "InsertWaypoint wp parameter does not contain a lat");
|
|
|
|
assert(wp.lon != nil, "InsertWaypoint wp parameter does not contain an lon");
|
|
|
|
|
|
|
|
var newwp = createWP(wp.lat, wp.lon, wp.id);
|
|
|
|
|
|
|
|
var fp = flightplan();
|
|
|
|
fp.insertWP(newwp, idx);
|
|
|
|
|
|
|
|
# Set a suitable name.
|
|
|
|
if ((fp.id == nil) or (fp.id == "default-flightplan")) {
|
|
|
|
var from = "????";
|
|
|
|
var dest = "????";
|
|
|
|
|
|
|
|
if ((fp.getWP(0) != nil) and (fp.getWP(0).wp_name != nil)) {
|
|
|
|
from = fp.getWP(0).wp_name;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((fp.getWP(fp.getPlanSize() -1) != nil) and (fp.getWP(fp.getPlanSize() -1).wp_name != nil)) {
|
|
|
|
dest = fp.getWP(fp.getPlanSize() -1).wp_name;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (fp.departure != nil) from = fp.departure.id;
|
|
|
|
if (fp.destination != nil) dest = fp.destination.id;
|
|
|
|
fp.id == from ~ " / " ~ dest;
|
|
|
|
}
|
|
|
|
|
|
|
|
# Activate flightplan
|
|
|
|
if (fp.getPlanSize() == 2) fgcommand("activate-flightplan", props.Node.new({"activate": 1}));
|
|
|
|
},
|
|
|
|
|
2018-01-27 21:55:22 +00:00
|
|
|
# Retrieve the Airway waypoints on the current leg.
|
|
|
|
getAirwayWaypoints : func() {
|
|
|
|
var fp = flightplan();
|
|
|
|
if (fp != nil) {
|
|
|
|
var current_wp = fp.currentWP();
|
|
|
|
if ((current_wp != nil) and (fp.indexOfWP(current_wp) > 0)) {
|
|
|
|
var last_wp = fp.getWP(fp.indexOfWP(current_wp) -1);
|
|
|
|
return airwaysRoute(last_wp, current_wp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return nil;
|
|
|
|
},
|
|
|
|
|
|
|
|
# Return the recently seen waypoints, collected from previous calls to
|
|
|
|
# other nav data functions
|
|
|
|
getRecentWaypoints : func()
|
|
|
|
{
|
|
|
|
return me._recentWaypoints.vector;
|
|
|
|
},
|
|
|
|
|
|
|
|
# Add an ID to the list of recent waypoints
|
|
|
|
addRecentWaypoint : func(id)
|
|
|
|
{
|
|
|
|
if ((id != nil) and (! me._recentWaypoints.contains(id))) {
|
|
|
|
me._recentWaypoints.insert(0, id);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
# Return the array of user waypoints. TODO
|
|
|
|
getUserWaypoints : func()
|
|
|
|
{
|
|
|
|
return [];
|
|
|
|
},
|
|
|
|
|
2018-01-29 21:43:43 +00:00
|
|
|
# Set up a DirectTo a given ID, with optional VNAV altitude offset.
|
|
|
|
setDirectTo : func(param)
|
|
|
|
{
|
|
|
|
var id = param.id;
|
|
|
|
var alt_ft = param.alt_ft;
|
|
|
|
var offset_nm = param.offset_nm;
|
|
|
|
|
|
|
|
var fp = flightplan();
|
|
|
|
var wp_idx = -1;
|
|
|
|
|
|
|
|
if (fp != nil) {
|
|
|
|
# We've already got a flightplan, so see if this WP already exists.
|
|
|
|
|
|
|
|
for (var i = 0; i < fp.getPlanSize(); i = i + 1) {
|
|
|
|
var wp = fp.getWP(i);
|
2018-01-30 19:51:58 +00:00
|
|
|
if ((wp.wp_name != nil) and (wp.wp_name == id)) {
|
2018-01-29 21:43:43 +00:00
|
|
|
# OK, we're assuming that if the names actually match, then
|
2018-01-30 19:51:58 +00:00
|
|
|
# they refer to the same ID. So direct to that index.
|
2018-01-29 21:43:43 +00:00
|
|
|
wp_idx = i;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (wp_idx != -1) {
|
2018-01-30 19:51:58 +00:00
|
|
|
# Found the waypoint in the plan, so use that as the DTO.
|
|
|
|
var wp = fp.getWP(wp_idx);
|
|
|
|
setprop("/instrumentation/gps/scratch/ident", wp.wp_name);
|
|
|
|
setprop("/instrumentation/gps/scratch/altitude-ft", 0);
|
|
|
|
setprop("/instrumentation/gps/scratch/latitude-deg", wp.lat);
|
|
|
|
setprop("/instrumentation/gps/scratch/longitude-deg", wp.lon);
|
2018-01-29 21:43:43 +00:00
|
|
|
} else {
|
|
|
|
# No flightplan, or waypoint not found, so use the GPS DTO function.
|
|
|
|
# Hokey property-based interface.
|
|
|
|
setprop("/instrumentation/gps/scratch/ident", id);
|
|
|
|
setprop("/instrumentation/gps/scratch/altitude-ft", 0);
|
|
|
|
setprop("/instrumentation/gps/scratch/latitude-deg", 0);
|
|
|
|
setprop("/instrumentation/gps/scratch/longitude-deg", 0);
|
|
|
|
}
|
2018-01-30 19:51:58 +00:00
|
|
|
|
|
|
|
# Switch the GPS to DTO mode.
|
|
|
|
setprop("/instrumentation/gps/command", "direct");
|
2018-01-29 21:43:43 +00:00
|
|
|
},
|
|
|
|
|
2018-04-06 18:52:18 +00:00
|
|
|
setFMSMode : func(mode) {
|
|
|
|
if (NavDataInterface.FMS_MODES[mode] != nil) {
|
|
|
|
# mode is valid, so simply set it as the GPS command
|
|
|
|
setprop("/instrumentation/gps/command", mode);
|
|
|
|
} else {
|
|
|
|
die("Invalid FMS Mode " ~ mode);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2018-01-27 21:55:22 +00:00
|
|
|
# Return the current DTO location to use
|
|
|
|
getCurrentDTO : func()
|
|
|
|
{
|
2018-01-30 20:59:16 +00:00
|
|
|
return me._defaultDTO;
|
2018-01-27 21:55:22 +00:00
|
|
|
},
|
|
|
|
|
2018-01-29 21:43:43 +00:00
|
|
|
# Set the current DTO location to use
|
2018-01-30 20:59:16 +00:00
|
|
|
setDefaultDTO : func(id)
|
2018-01-27 21:55:22 +00:00
|
|
|
{
|
2018-01-30 20:59:16 +00:00
|
|
|
me._defaultDTO = id;
|
2018-01-27 21:55:22 +00:00
|
|
|
},
|
|
|
|
|
2018-01-13 21:07:32 +00:00
|
|
|
RegisterWithEmesary : func()
|
|
|
|
{
|
|
|
|
if (me._recipient == nil){
|
|
|
|
me._recipient = emesary.Recipient.new("DataInterface");
|
|
|
|
var controller = me;
|
2018-02-04 21:40:37 +00:00
|
|
|
|
|
|
|
# Note that unlike the various keys, this data isn't specific to a particular
|
|
|
|
# Device - it's shared by all. Hence we don't check for the notificaiton
|
|
|
|
# Device_Id.
|
2018-01-13 21:07:32 +00:00
|
|
|
me._recipient.Receive = func(notification)
|
|
|
|
{
|
2018-02-04 21:40:37 +00:00
|
|
|
if (notification.NotificationType == notifications.PFDEventNotification.DefaultType and
|
|
|
|
notification.Event_Id == notifications.PFDEventNotification.NavData and
|
|
|
|
notification.EventParameter != nil)
|
|
|
|
{
|
|
|
|
var id = notification.EventParameter.Id;
|
|
|
|
|
|
|
|
if (id == "NearestAirports") {
|
|
|
|
notification.EventParameter.Value = controller.getNearestAirports();
|
|
|
|
return emesary.Transmitter.ReceiptStatus_Finished;
|
|
|
|
}
|
|
|
|
if (id == "AirportByID") {
|
|
|
|
notification.EventParameter.Value = controller.getAirportById(notification.EventParameter.Value);
|
|
|
|
return emesary.Transmitter.ReceiptStatus_Finished;
|
|
|
|
}
|
|
|
|
if (id == "NavDataByID") {
|
|
|
|
notification.EventParameter.Value = controller.getNavDataById(notification.EventParameter.Value);
|
|
|
|
return emesary.Transmitter.ReceiptStatus_Finished;
|
|
|
|
}
|
|
|
|
if (id == "NavAidByID") {
|
|
|
|
notification.EventParameter.Value = controller.getNavAidById(notification.EventParameter.Value);
|
|
|
|
return emesary.Transmitter.ReceiptStatus_Finished;
|
|
|
|
}
|
|
|
|
if (id == "NavDataWithinRange") {
|
|
|
|
notification.EventParameter.Value = controller.getNavDataWithinRange(notification.EventParameter.Value);
|
|
|
|
return emesary.Transmitter.ReceiptStatus_Finished;
|
|
|
|
}
|
|
|
|
if (id == "Flightplan") {
|
|
|
|
notification.EventParameter.Value = controller.getFlightplan();
|
|
|
|
return emesary.Transmitter.ReceiptStatus_Finished;
|
|
|
|
}
|
|
|
|
if (id == "RecentWaypoints") {
|
|
|
|
notification.EventParameter.Value = controller.getRecentWaypoints();
|
|
|
|
return emesary.Transmitter.ReceiptStatus_Finished;
|
|
|
|
}
|
|
|
|
if (id == "AddRecentWaypoint") {
|
|
|
|
controller.addRecentWaypoint(notification.EventParameter.Value);
|
|
|
|
return emesary.Transmitter.ReceiptStatus_Finished;
|
|
|
|
}
|
|
|
|
if (id == "AirwayWaypoints") {
|
|
|
|
notification.EventParameter.Value = controller.getAirwayWaypoints();
|
|
|
|
return emesary.Transmitter.ReceiptStatus_Finished;
|
|
|
|
}
|
|
|
|
if (id == "UserWaypoints") {
|
|
|
|
notification.EventParameter.Value = controller.getUserWaypoints();
|
|
|
|
return emesary.Transmitter.ReceiptStatus_Finished;
|
|
|
|
}
|
|
|
|
if (id == "CurrentDTO") {
|
|
|
|
notification.EventParameter.Value = controller.getCurrentDTO();
|
|
|
|
return emesary.Transmitter.ReceiptStatus_Finished;
|
|
|
|
}
|
|
|
|
if (id == "SetDirectTo") {
|
|
|
|
controller.setDirectTo(notification.EventParameter.Value);
|
|
|
|
return emesary.Transmitter.ReceiptStatus_Finished;
|
|
|
|
}
|
|
|
|
if (id == "SetDefaultDTO") {
|
|
|
|
controller.setDefaultDTO(notification.EventParameter.Value);
|
|
|
|
return emesary.Transmitter.ReceiptStatus_Finished;
|
2018-01-13 21:07:32 +00:00
|
|
|
}
|
2018-04-06 18:52:18 +00:00
|
|
|
if (id == "SetFMSMode") {
|
|
|
|
controller.setFMSMode(notification.EventParameter.Value);
|
|
|
|
return emesary.Transmitter.ReceiptStatus_Finished;
|
|
|
|
}
|
|
|
|
if (id == "InsertWaypoint") {
|
|
|
|
controller.insertWaypoint(notification.EventParameter.Value);
|
|
|
|
return emesary.Transmitter.ReceiptStatus_Finished;
|
|
|
|
}
|
2018-04-11 19:56:22 +00:00
|
|
|
if (id == "GetChecklists") {
|
2018-04-07 12:23:26 +00:00
|
|
|
notification.EventParameter.Value = controller.getChecklists();
|
|
|
|
return emesary.Transmitter.ReceiptStatus_Finished;
|
|
|
|
}
|
2018-01-13 21:07:32 +00:00
|
|
|
}
|
|
|
|
return emesary.Transmitter.ReceiptStatus_NotProcessed;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
me._transmitter.Register(me._recipient);
|
|
|
|
me._registered = 1;
|
|
|
|
},
|
|
|
|
|
|
|
|
DeRegisterWithEmesary : func()
|
|
|
|
{
|
|
|
|
# remove registration from transmitter; but keep the recipient once it is created.
|
|
|
|
if (me._registered == 1) me._transmitter.DeRegister(me._recipient);
|
|
|
|
me._registered = 0;
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
start : func() {
|
|
|
|
me.RegisterWithEmesary();
|
|
|
|
},
|
|
|
|
stop : func() {
|
|
|
|
me.DeRegisterWithEmesary();
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
};
|