Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
Streaming modes that supported by genesis meter.
Set meter to this Streaming mode means that , the meter pushes mode-specific record to port without any responses
Test mode with raw record to log. Should give one
3 times and repeat this till led mode is switch
Test mode should give out
Calibration mode should give out
Deactivate streaming
not set or an new not supported Streaming mode
Genesis meter, main class for all action that occurs on production life of meter
one meter always have a linked port for UART communication and one for LED (even if you don't need them)
it´s has to be open for vb6 COM so don't use any record types or objects that vb6 didn't understand or
interprets differently than dotNet
Default constructor.
R.Drabesch, 2018-Feb-16.
Transmit protocol access for underlie objects to change response timeout
Slot number for test-bench
for request Port
for streaming Port
don´t send CRC error or telegrams with error flag to caller
If you have a password for highest access level you need, if you don't want to access the meter
(just read led record) than you can leave it null
Keep up the highest access level for all function in where used
Logout with level 0
Property is redundant because is also stored in
but never less is
is the identification of the meter it has a separate Property
Save Slot Number (position at test-bench) for logging purposes
Represent
proposed for login
Add on ctor a password and it will be used for login in if no other password is set
default false only enabled by
when it is true, the meter will enforce the login when session is gone or access is denied
Enable raw record logging, if set every incoming package will be logged
Enable use of registers that are not valid (last version not match the current app)
All parameter store in this Genesis is up in here
if you want to read them from meter use
if you want to set them to meter use
All applications defined by configuration.json
request port assignment/info
request protocol assignment/info
streaming port assignment/info
streaming protocol assignment/info
to reduce the IrdA communication in test bench, preparation will be done once (when SkipPrepearationForTestBench is true)
Response received after request for record
Returns meter registers
do not use it to set ProcessStatus
if you want to change ProcessStatus of this genesis use
is just store for some routines
if state is change
will be invoked.
on some states other events will be invoke as well
do not use it to set ErrorStatus
if you want to change ErrorStatus of this genesis use
is just store for some routines
fires up
Logged in to device
Hold the current process name e.g. FlowTest, Preadjustemtn for logging
Setup water meter from configuration file:
-slot,
-streaming protocol,
-streaming port
-request port
just internal setup. called on ctor or from vb6 setup function
Slot Number for test-bench
for RFID/UART/IrDA Port
for LED Port
don´t send CRC error or telegrams with error flag to caller
If you have a password for highest access level you need, if you don't want to access the meter
(just read led record) than you can leave it nullS
Start Event listening, has to be called after
Add a port to working queue
On should one once added in runtime
Synchronization of the record for the streaming interface
call this if session is expired and you need an re-authorization
A helper to invoke events only if someone is listening, otherwise nothing will happen
Event handler to call
Sender (can be null)
Event arguments (can be null)
Track all incoming led record packages (Calibration and Flow)
I should be or
otherwise this method does nothing
tracking request record processing
QueryCaps can send before login
arrange record for communication (e.g. Baud rate)
Running outgoing command
The backup login level is needed for re-authorization
SetRegister to loginLvl and wait for response
true = process command; false = add command to list. call
to process login command
if is completed and no error occurred it is true
Set
if null , use password from initialization
true = process command; false = add command to list. call
to process login command
Login with identical password as last time
- Initial
Get password from server
Starting a timer to keep session active,
starting the .
password string to login
Starting a timer to keep session active,
starting the .
password string to login
true = process command; false = add command to list. call
to process login command
pass runImmediately for auto login
- Avoid retries during login, a retry will lock the Genesis for 2s, 4s, 8s, 16s and so on.
Building the FW Version string out of 2 bytes of data.
REASON: FLEXNETVERSION is one application which does not follow the same rule of
decimal numbers. Instead it uses hexadecimal digits. After the conversion of this
number to a pure Uint32, needed for comparison of file versions in configuration.json,
the hexadecimal outline will be lost and the comparison with the rowproduct.txt fails.
FW-update needs this information to validate a tested package!
most significant byte
last significant byte
converted "msb.lsb" as string e.g. "12.34" or "2.0C"
List of all present meter applications
Core revision of boot code.
Region (EMEA or NA) and Radio frequency (433 or 868 or null).
Metrology upgrade permission.
Reading all applications which can be found in the configuration.json and have been stored
to the meter register dictionary in advance.
The read process covers the FW version and the CRC.
After reading the version, all valid registers are going to be selected.
- Removed "Cordonel " from CoreRevision to have the e.g. "1.64" remaining
- Read radio frequency
Automatic login to meter enabled if logged out by lost authentication
If the timeout timer elapsed to keep the session active, this routine will be called
awaking the .
Thread to keep the connection to the meter open and the session alive,
because on missing communication the meter is going to logout automatically.
This thread will be started at and aborted on
Check if EMPTY_PIPE or REBOOT is set
Check if alarmToCheck is set on register
is Flags so you can use more than one alarms (like Alarm.EMPTY_PIPE | Alarm.REBOOT)
Read out all AlarmStatus register and combine them to one
Reset the empty pipe alarm
Reads the PCB Identification, can be accessed at all login levels,
Read Privilege is always needed to BUGFIX read access to PCB ID
PCB ID
Get the actual register dictionary
Serial number of meter married with PcbId
Event to Sync Register on MeterSide and
Fired on Write or read register
Register to update with value to update
Write Register, optional: wait for result and validate,
write register will ALWAYS log the data DON'T use for password write
Data type of Register
Register to change
Value to save
wait until result is ready
check the content of the register by read back
skip retries on this error code return
true on successful operation
Read Register and return byte array
expected length for response
skip retries on this error code return
- Removed throw because the throw always kicks in to
the FW-Update process causing an unpredictable stop!
Clear Ports
Logging of register write processes to meter
ATTENTION: DON'T USE FOR PASSWORDS!
Storage of calibration values
Calibration factors for all channels
Registers needed to store the calibration for the individual channel
Just stop recording without calculation
List of ongoing measurements, base- and calibration-measurements
All channels required to process
Perpetration of Measurement
SampleRate 10 and Led mode Test
Testing the flow direction
the first measurement is ALWAYS a FlowTestRecord due to the underlying routine logic.
The first measurement is ALWAYS a FlowTestRecord.
Calibration content
has been calibrated
Channel for calibration
Register to store the calibration
Ctor for calibration factor
set the user readable relative (around 1.0) calibration factor
and convert it to the raw calibration factor for the meter
Read the relative (around 1.0) calibration factor calculated from the actual
meter calibration factor divided by the default calibration factor
Genesis internal raw default value (around 15625)
Set the meter raw calibration factor (around 15625)
Get the meter raw calibration factor (around 15625)
Port scanner:
using the Windows Device Manager listed ports,
tries to open the port with an exception if it cannot be accessed (very time consuming),
tries to use the request protocol to detect a Genesis device.
Genesis for test access
Auto detected port name
Port scan result event for message dispatcher to caller
Stop the port scan
Number of ports
Actual Port Counter
Returns the port scan state
- Initial
Ctor
true if one port has been validated
- Initial
type of communication port to meter like IrDA
- Initial.
- Remove all meters removed as _meterBatch.Dispose will remove all meters.
Use initially the port configuration to speed up search,
If configuration file contains wrong port setup than scan all serial ports listed in
the windows device manager,
Read available ports,
Try to open port and connect to Genesis meter.
slot to search for
configuration of port to speed up search
true if port found
true if one port has been validated
- Initial
- Port type from Ctor,
- Event message changed:
- Overall message: ctr / counts - ongoing scan,
- Actual message: Information to log
- Changed exit of function,
- Added configuration file handling.
- Remove all meters removed as _meterBatch.Dispose will remove all meters.
JSON filer reader for generation of register lists
Registers defined in configuration.json file
Applications defined in configuration.json file
Ctor
the file path for configuration.json as interface description to the meter
Convert file content to register list
A strongly-typed resource class, for looking up localized strings, etc.
Returns the cached ResourceManager instance used by this class.
Overrides the current thread's CurrentUICulture property for all
resource lookups using this strongly typed resource class.
Looks up a localized string similar to Compare register.
Looks up a localized string similar to Access request..
Looks up a localized string similar to Failed to open..
Looks up a localized string similar to Ports listed in the Windows device manager..
Looks up a localized string similar to Automatic port scan started..
Looks up a localized string similar to Successfully accessed..
Looks up a localized string similar to Read register.
Looks up a localized string similar to Reading registers after update.
Looks up a localized string similar to Reading registers before update.
Looks up a localized string similar to Cordonel not detected!.
Looks up a localized string similar to Scan port.
Looks up a localized string similar to Write register.
Read, compare and restore if unequal al registers marked with
equals
".
The reader will use the byte values as they are unmodified and
will not be rounded and therefor possibly fail the comparison.
For logging the register value will be converted its unit.
PCB ID for pre update for comparison
PCB ID for post update for comparison
Register content before update
Register content after update
Register access event for message dispatcher to caller
Actual Port Counter
Stop register access
Genesis meter object
Extraction of registers names needed to restore after FW-Update
Extraction of registers names needed to log
Ctor
Assign new genesis after reboot and keep the RegisterRestorer object.
- Initial
Avoid doubling of register restore on subsequent FW-Update trials.
true if registers already backed up
- Initial.
Avoid doubling of register backup on subsequent FW-Update trials.
true if registers already backed up
- Initial.
- Extended checks for Genesis is assigned and PCB ID is identical.
Restore all registers which can be restored and finalize with "safe configuration process".
true if restoring succeeded
- Initial.
Compare all registers which can be restored.
true if equal
- Initial.
Read the registers after the update for comparision. Build the post update registers here,
because an update may have changed the registers (new or removed registers).
true if registers could be read
- Initial.
- Build here the post update registers, they may have changed due to update!
- Clear pre update registers if post indicates a different PCB ID to avoid wrong overwriting of
registers to non matching new meter.
Get DEFINED registers from GenesisMeter class and read all
registers which are flagged with read write (RW) or read only (RO).
Build a list of all registers being able to restore referenced by name,
flagged with
equals ".
The defined registers are based on the "configuration.json" and
the installed application with a specific version.
true if registers could be read
- Initial.
- Stored registers before and after update.
- Extended register check.
- Removed after update registers and moved them to PostUpdateReadRegisters. They may have changed
during the update.
- Deny register pre update if _pcbIdPreUpdate indicates, that this has been already processed.
Register read loop.
All registers needed to be read with from the Genesis meter as they are only
prepared as template and NOT filled with the register data!
The uses the overall process text and value for user information process
bar and text and the actual process text for logging to the report file!
registers to read
list of registers to read
true if registers could be read
- Initial.
- Set value to actual process message.
- Added PCB ID to logging.
- Removed PCB ID from logging.