1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
//! This module provides a high-level access to the server-side of Tango.
pub use ;
pub use ;
pub use terminate;
pub use Class;
pub use Dev;
pub use Command;
pub use Attr;
pub use ServerArgs;
use crateDevState;
/// What a device model has to be, gathering in one bound everything a server needs of it:
/// it is shared between the threads serving the requests.
///
/// A model is deleted by being given to the delete function of its class, see
/// [`ClassDef::delete`], which is where it releases what it holds: before every
/// initialization but the first, and once its device is no longer served. A model whose
/// server is dropped without being stopped, see [`Server::stop_async`], is never deleted, and
/// only dropped with the last reference to its device, which may be held long after. Its
/// [`Drop`] is therefore only relied upon to free memory, never to release its hardware or
/// anything else that the new model of a device restarted under the same name takes again.
///
/// Every such type is a model, there being nothing to implement: this is the bound the
/// definitions and the devices are written against rather than a trait a model opts into.
/// The name of the attribute, and of the command, every device gives its state under.
const STATE_NAME: &str = "State";
/// The name of the attribute, and of the command, every device gives its status under.
const STATUS_NAME: &str = "Status";
/// The name of the command every device is initialized again by.
const INIT_NAME: &str = "Init";
/// The names of the attributes every device has whatever its class.
const RESERVED_ATTRS: & = &;
/// The names of the commands every device has whatever its class.
const RESERVED_COMMANDS: & = &;
/// The status of a device that has no model because it has not been initialized yet,
/// which every device is between the moment it is added and the moment it is synchronized.
const MISSING_STATUS: &str = "The device is not initialized";
/// The status of a device whose class derives no status of its own from the model.
const DEFAULT_STATUS: &str = "Device is on";
/// The state of a device whose class derives no state of its own from the model, which is
/// the one every device that has nothing to say of itself is in.
const DEFAULT_STATE: DevState = On;
/// How many readings the history of an attribute keeps unless set otherwise, see
/// [`Attr::set_history_depth`], which is the depth of the polling buffer of cppTango.
const DEFAULT_HISTORY_DEPTH: usize = 10;
/// The reserved name that name is, if it is one: the state, the status and the
/// initialization of a device are answered by the server itself, whatever its class and its
/// devices define, so anything defined under one of those names would never be reached.
///
/// Given back in the spelling of the reserved name rather than of the one that was asked
/// for, the two differing only by their case, so that a refusal can point at both.