parse FixedDataHeader in longframe
This commit is contained in:
@ -2,7 +2,9 @@ import {MeterbusLib} from './meterbus'
|
||||
import {MeterbusLibLongFrame} from './longframe'
|
||||
import {MeterbusLibExceptions} from './exceptions'
|
||||
import {MeterbusLibFrames} from './simpleframes'
|
||||
import {MeterbusLibCodeTables} from './codetables'
|
||||
|
||||
|
||||
import * as mocha from 'mocha'
|
||||
import * as chai from 'chai'
|
||||
|
||||
@ -134,4 +136,43 @@ describe('The Meterbus Library', () => {
|
||||
expect((telegram.frame as MeterbusLibFrames.ControlFrame).ciField).to.equal(3)
|
||||
})
|
||||
|
||||
describe('The Meterbus Longframe Library', () => {
|
||||
let telegram : MeterbusLib.Telegram
|
||||
|
||||
beforeEach(() => {
|
||||
telegram = new MeterbusLib.Telegram()
|
||||
telegram.fromHexString(inputOkLongFrame_1phase_electric)
|
||||
telegram.parse()
|
||||
})
|
||||
|
||||
it('should find the identNo', () => {
|
||||
expect((telegram.frame as MeterbusLibLongFrame.LongFrame).fixedDataHeader.identNo)
|
||||
.to.equal(17001300)
|
||||
})
|
||||
it('should find the manufacturer', () => {
|
||||
expect((telegram.frame as MeterbusLibLongFrame.LongFrame).fixedDataHeader.manufacturer)
|
||||
.to.equal("FIN")
|
||||
})
|
||||
it('should find the version', () => {
|
||||
expect((telegram.frame as MeterbusLibLongFrame.LongFrame).fixedDataHeader.version)
|
||||
.to.equal(0x24)
|
||||
})
|
||||
it('should find the medium', () => {
|
||||
expect((telegram.frame as MeterbusLibLongFrame.LongFrame).fixedDataHeader.medium)
|
||||
.to.equal("Electrity")
|
||||
})
|
||||
it('should find the accessNo', () => {
|
||||
expect((telegram.frame as MeterbusLibLongFrame.LongFrame).fixedDataHeader.accessNo)
|
||||
.to.equal(0xd6)
|
||||
})
|
||||
it('should find the status', () => {
|
||||
expect((telegram.frame as MeterbusLibLongFrame.LongFrame).fixedDataHeader.status)
|
||||
.to.equal(0)
|
||||
})
|
||||
it('should find the signature', () => {
|
||||
expect((telegram.frame as MeterbusLibLongFrame.LongFrame).fixedDataHeader.signature)
|
||||
.to.deep.equal([0,0])
|
||||
})
|
||||
})
|
||||
|
||||
})
|
Reference in New Issue
Block a user