2023-04-02 01:13:22 +02:00
|
|
|
from sqlalchemy import Column, Integer, ForeignKey
|
|
|
|
|
2023-10-04 09:50:10 +02:00
|
|
|
from platypush.common.db import is_defined
|
2023-04-02 01:13:22 +02:00
|
|
|
|
|
|
|
from .three_axis import ThreeAxisSensor
|
|
|
|
|
|
|
|
|
2023-10-04 09:50:10 +02:00
|
|
|
if not is_defined('magnetometer'):
|
2023-04-02 01:13:22 +02:00
|
|
|
|
|
|
|
class Magnetometer(ThreeAxisSensor):
|
|
|
|
"""
|
|
|
|
An entity that represents the value of a magnetometer.
|
|
|
|
"""
|
|
|
|
|
|
|
|
__tablename__ = 'magnetometer'
|
|
|
|
|
|
|
|
id = Column(
|
|
|
|
Integer,
|
|
|
|
ForeignKey(ThreeAxisSensor.id, ondelete='CASCADE'),
|
|
|
|
primary_key=True,
|
|
|
|
)
|
|
|
|
|
2023-10-04 09:50:10 +02:00
|
|
|
__table_args__ = {'extend_existing': True}
|
2023-04-02 01:13:22 +02:00
|
|
|
__mapper_args__ = {
|
|
|
|
'polymorphic_identity': __tablename__,
|
|
|
|
}
|