/// <summary>
        /// registers new package
        /// package recipient and weight is needed in order to request a flightpath from the locationserver
        /// </summary>
        /// <param name="recipient">recipient of the package</param>
        /// <param name="weight">weight of the package</param>
        /// <returns>
        /// true: registration successful, valid flightpath for package was found
        /// false: registration failed; recipient is not reachable (e.g. package to heavy for given distance)
        /// </returns>
        /// <exception cref="ArgumentNullException">recipient must not be null</exception>
        /// <exception cref="ArgumentException">weight must be greater 0 and less than or equal to Defines.MAX_PACKAGE_WEIGHT</exception>
        public bool RegisterPackage( MyAddress recipient, float weight )
        {
            if ( null == recipient ) throw new ArgumentNullException( nameof( recipient ) );
            if ( weight < 0 ) throw new ArgumentException( nameof( weight ) + "must be greater than zero." );
            if ( weight > Defines.MAX_PACKAGE_WEIGHT ) throw new ArgumentException( nameof( weight ) + "must be less or equal to maximum supported weight" );

            Location.MyFlightPath path = this.locationServer.CalculateFlightPath( recipient, weight );
            if ( null == path ) return false;

            var package = this.database.AddPackage( recipient, null, weight );
            package.FlightPath = path;
            this.packages.Add( package.UID, package );
            return true;
        }
Exemple #2
0
 internal MyPackage( ulong uid, MyAddress recipient, MyAddress sender, float weight ) : this( uid, recipient, weight ) {
     this.Sender = sender;
 }
Exemple #3
0
 internal MyPackage( ulong uid, MyAddress recipient, float weight ) : this( uid ) {
     this.Recipient = recipient;
     this.Weight = weight;
 }
 internal MyPackage AddPackage( MyAddress recipient, MyAddress sender, float weight )
 {
     throw new NotImplementedException();
 }
 internal MyFlightPath CalculateFlightPath( MyAddress recipient, float weight )
 {
     throw new NotImplementedException();
 }