Struct proj_billing::billing::sign_on_meter::SignOnMeter
[−]
[src]
pub struct SignOnMeter<T: Read + Write> { /* fields omitted */ }
State of the billing protocol
Trait Implementations
impl<T: Read + Write> BillingProtocol<T, f64> for SignOnMeter<T>
[src]
type Consumption = FloatingConsumption
Consumption information for billing e.g. the time of consumption and the units consumed
type Prices = Prices
Information used to calculate the bill (e.g. coefficients for each in which a unit could be consumed)
fn null_prices() -> Self::Prices
returns a null Prices object
fn consume(&mut self, consumption: &Self::Consumption)
To be run on the meter. This function should check for any new prices, and then add the price of consumption to the running bill Read more
fn send_billing_information(&mut self)
Get the server up to speed with the current billing information: a message from the device to the server.
fn pay_bill(&mut self) -> f64
Pay bill (run on the server) This will block until it has received the billing information from the meter (via send_billing_information) Read more
fn change_prices(&mut self, prices: &Self::Prices)
Change the way bills are calculated. This is a message sent from the server (utility company) to the meter.
fn new_meter(channel: T,
prices: &Prices,
meter_keys: MeterKeys)
-> SignOnMeter<T>
prices: &Prices,
meter_keys: MeterKeys)
-> SignOnMeter<T>
Instantiate a new meter
fn new_server(channel: T, keys: Keys, prices: &Prices) -> SignOnMeter<T>
Instantiate a new server