コード例 #1
0
 /// <summary>
 /// Disposes this object.
 /// </summary>
 public void Dispose()
 {
     this.linkingEvent.Dispose();
     this.port.Dispose();
     this.devices.Clear();
     this.devices        = null;
     this.deviceFactory  = null;
     this.linkedDevices  = null;
     this.linkingEvent   = null;
     this.plm            = null;
     this.port           = null;
     this.provider       = null;
     this.receivedPacket = null;
     this.sendingPacket  = null;
     this.connected      = false;
 }
コード例 #2
0
        /// <summary>
        /// Reads all the devices from the PLM and stores the mapping locally.  Along with the
        /// basic info and config of the plm.
        /// </summary>
        public bool Startup()
        {
            GetInfo info = new GetInfo();

            PowerLineModemMessage.MessageResponse response = port.SendCommand(info);
            if (response == PowerLineModemMessage.MessageResponse.Ack)
            {
                plm = new PowerLineModule(this, info.Id, info.Category, info.Subcategory, info.FirmwareVersion);
                // Ask for the config and info about the modem.
                GetConfiguration config = new GetConfiguration();
                response = port.SendCommand(config);
                if (response == PowerLineModemMessage.MessageResponse.Ack)
                {
                    plm.Config = config.Configuration;
                    this.ReadAllLinks();
                    this.SetupAllDevices();
                    return(true);
                }
            }
            return(false);
        }