Exemple #1
0
car.wrapForEncode(buffer, 0, len(buffer))

car.setSerialNumber(1234)
car.setModelYear(2013)
car.setAvailable(BooleanType.TRUE)
car.setCode(Model.A)

# fixed arrays
for i in range(0, car.someNumbersLength()):
    car.setSomeNumbers(i, i)

code = [x for x in 'abcdef']
for i in range(0, car.vehicleCodeLength()):
    car.setVehicleCode(i, code[i])

car.extras().setCruiseControl(True)
car.extras().setSportsPack(True)
car.extras().setSunRoof(False)

# composites
car.engine().setCapacity(2000)
car.engine().setNumCylinders(4)
code = [x for x in '123']
for i in range(0, car.engine().manufacturerCodeLength()):
    car.engine().setManufacturerCode(i, code[i])

# groups
fuelFigures = car.fuelFiguresCount(3)
for speed, mpg in [(30, 35.9), (55, 49.0), (75, 40.0)]:
    fuelFigures.next()
    fuelFigures.setSpeed(speed)
car.wrapForDecode(buffer, 0, car.sbeBlockLength(), car.sbeSchemaVersion(), length)

# single fixed fields
print('serialNumber: '+str(car.getSerialNumber()))
print('modelYear: '+str(car.getModelYear()))
print('available: '+str(car.getAvailable()))
print('code: '+str(car.getCode()))

# fixed arrays
for i in range(0,car.someNumbersLength()):
    print('someNumber'+str(i)+': '+str(car.getSomeNumbers(i)))

print('vehicleCode: "'+str(car.getVehicleCode())) + '"'

# bitsets
print('cruiseControl: '+str(car.extras().getCruiseControl()))
print('sportsPack: '+str(car.extras().getSportsPack()))
print('sunRoof: '+str(car.extras().getSunRoof()))

# composites
print('capacity: '+str(car.engine().getCapacity()))
print('numCylinders: '+str(car.engine().getNumCylinders()))
print('maxRpm: '+str(car.engine().maxRpm()))

print('manufacturerCode: "'+str(car.engine().getManufacturerCode()))+'"'

# groups
figures = car.fuelFigures()
while figures.hasNext():
    figures.next()
    print('speed: '+str(figures.getSpeed()))
car.setSerialNumber(1234)
car.setModelYear(2013)
car.setAvailable(BooleanType.TRUE)
car.setCode(Model.A)

# fixed arrays
for i in range(0, car.someNumbersLength()) :
    car.setSomeNumbers(i, i)

# Note: pad to fixed size if necessary for char arrays:
# car.setVehicleCode('abc'.ljust(6))
#
car.setVehicleCode('abcdef')

car.extras().setCruiseControl(True)
car.extras().setSportsPack(True)
car.extras().setSunRoof(False)

# composites
car.engine().setCapacity(2000)
car.engine().setNumCylinders(4)
car.engine().setManufacturerCode('123')

# groups
fuelFigures = car.fuelFiguresCount(3)
for speed, mpg in [(30,35.9), (55,49.0), (75,40.0)]:
    fuelFigures.next()
    fuelFigures.setSpeed(speed)
    fuelFigures.setMpg(mpg)
Exemple #4
0
# single fixed fields
print('serialNumber: '+str(car.getSerialNumber()))
print('modelYear: '+str(car.getModelYear()))
print('available: '+str(car.getAvailable()))
print('code: '+str(car.getCode()))

# fixed arrays
for i in range(0,car.someNumbersLength()):
    print('someNumber'+str(i)+': '+str(car.getSomeNumbers(i)))

for i in range(0,car.vehicleCodeLength()):
    print('vehicleCode'+str(i)+': '+str(car.getVehicleCode(i)))

# bitsets
print('cruiseControl: '+str(car.extras().getCruiseControl()))
print('sportsPack: '+str(car.extras().getSportsPack()))
print('sunRoof: '+str(car.extras().getSunRoof()))

# composites
print('capacity: '+str(car.engine().getCapacity()))
print('numCylinders: '+str(car.engine().getNumCylinders()))
print('maxRpm: '+str(car.engine().maxRpm()))

for i in range(0,car.engine().manufacturerCodeLength()):
    print('manufacturerCode'+str(i)+': '+str(car.engine().getManufacturerCode(i)))

# groups
figures = car.fuelFigures()
while figures.hasNext():
    figures.next()