2019-06-29 14:26:14 +00:00
|
|
|
import datetime
|
|
|
|
|
2022-06-15 10:17:16 +00:00
|
|
|
from marshmallow import fields as f
|
|
|
|
from marshmallow import post_load, pre_load
|
|
|
|
from marshmallow.fields import (
|
|
|
|
UUID,
|
|
|
|
Boolean,
|
|
|
|
Date,
|
|
|
|
DateTime,
|
|
|
|
Dict,
|
|
|
|
Float,
|
|
|
|
Integer,
|
|
|
|
List,
|
|
|
|
Str,
|
|
|
|
String,
|
|
|
|
)
|
2018-08-03 16:15:08 +00:00
|
|
|
from marshmallow.validate import Length, OneOf, Range
|
|
|
|
from sqlalchemy.util import OrderedSet
|
2023-06-07 10:50:21 +00:00
|
|
|
from stdnum import meid
|
2018-08-03 16:15:08 +00:00
|
|
|
|
2018-06-20 21:18:15 +00:00
|
|
|
from ereuse_devicehub.marshmallow import NestedOn
|
2018-11-09 10:22:13 +00:00
|
|
|
from ereuse_devicehub.resources import enums
|
2022-06-15 10:17:16 +00:00
|
|
|
from ereuse_devicehub.resources.device import models as m
|
|
|
|
from ereuse_devicehub.resources.device import states
|
2018-06-20 21:18:15 +00:00
|
|
|
from ereuse_devicehub.resources.models import STR_BIG_SIZE, STR_SIZE
|
|
|
|
from ereuse_devicehub.resources.schemas import Thing, UnitCodes
|
2023-03-21 11:08:13 +00:00
|
|
|
from ereuse_devicehub.teal.enums import Layouts
|
|
|
|
from ereuse_devicehub.teal.marshmallow import (
|
|
|
|
URL,
|
|
|
|
EnumField,
|
|
|
|
SanitizedStr,
|
|
|
|
ValidationError,
|
|
|
|
)
|
|
|
|
from ereuse_devicehub.teal.resource import Schema
|
2018-04-10 15:06:39 +00:00
|
|
|
|
|
|
|
|
|
|
|
class Device(Thing):
|
2019-02-03 16:12:53 +00:00
|
|
|
__doc__ = m.Device.__doc__
|
2018-06-26 13:35:13 +00:00
|
|
|
id = Integer(description=m.Device.id.comment, dump_only=True)
|
2020-03-25 15:47:57 +00:00
|
|
|
hid = SanitizedStr(lower=True, description=m.Device.hid.comment)
|
2022-06-15 10:17:16 +00:00
|
|
|
tags = NestedOn(
|
|
|
|
'Tag',
|
|
|
|
many=True,
|
|
|
|
collection_class=OrderedSet,
|
|
|
|
description='A set of tags that identify the device.',
|
|
|
|
)
|
|
|
|
model = SanitizedStr(
|
|
|
|
lower=True,
|
|
|
|
validate=Length(max=STR_BIG_SIZE),
|
|
|
|
description=m.Device.model.comment,
|
|
|
|
)
|
|
|
|
manufacturer = SanitizedStr(
|
|
|
|
lower=True,
|
|
|
|
validate=Length(max=STR_SIZE),
|
|
|
|
description=m.Device.manufacturer.comment,
|
|
|
|
)
|
|
|
|
serial_number = SanitizedStr(
|
|
|
|
lower=True, validate=Length(max=STR_BIG_SIZE), data_key='serialNumber'
|
|
|
|
)
|
2022-09-13 16:15:50 +00:00
|
|
|
part_number = SanitizedStr(
|
|
|
|
lower=True, validate=Length(max=STR_BIG_SIZE), data_key='partNumber'
|
|
|
|
)
|
2022-06-15 10:17:16 +00:00
|
|
|
brand = SanitizedStr(
|
|
|
|
validate=Length(max=STR_BIG_SIZE), description=m.Device.brand.comment
|
|
|
|
)
|
|
|
|
generation = Integer(
|
|
|
|
validate=Range(1, 100), description=m.Device.generation.comment
|
|
|
|
)
|
2019-06-29 14:26:14 +00:00
|
|
|
version = SanitizedStr(description=m.Device.version)
|
2022-06-15 10:17:16 +00:00
|
|
|
weight = Float(
|
|
|
|
validate=Range(0.1, 5), unit=UnitCodes.kgm, description=m.Device.weight.comment
|
|
|
|
)
|
|
|
|
width = Float(
|
|
|
|
validate=Range(0.1, 5), unit=UnitCodes.m, description=m.Device.width.comment
|
|
|
|
)
|
|
|
|
height = Float(
|
|
|
|
validate=Range(0.1, 5), unit=UnitCodes.m, description=m.Device.height.comment
|
|
|
|
)
|
|
|
|
depth = Float(
|
|
|
|
validate=Range(0.1, 5), unit=UnitCodes.m, description=m.Device.depth.comment
|
|
|
|
)
|
2021-11-19 10:34:13 +00:00
|
|
|
# TODO TimeOut 2. Comment actions and lots if there are time out.
|
2022-06-15 10:17:16 +00:00
|
|
|
actions = NestedOn(
|
|
|
|
'Action', many=True, dump_only=True, description=m.Device.actions.__doc__
|
|
|
|
)
|
2021-11-19 10:34:13 +00:00
|
|
|
# TODO TimeOut 2. Comment actions_one and lots if there are time out.
|
2022-06-15 10:17:16 +00:00
|
|
|
actions_one = NestedOn(
|
|
|
|
'Action', many=True, load_only=True, collection_class=OrderedSet
|
|
|
|
)
|
|
|
|
problems = NestedOn(
|
|
|
|
'Action', many=True, dump_only=True, description=m.Device.problems.__doc__
|
|
|
|
)
|
2018-10-05 15:13:23 +00:00
|
|
|
url = URL(dump_only=True, description=m.Device.url.__doc__)
|
2021-11-19 10:34:13 +00:00
|
|
|
# TODO TimeOut 2. Comment actions and lots if there are time out.
|
2022-06-15 10:17:16 +00:00
|
|
|
lots = NestedOn(
|
|
|
|
'Lot',
|
|
|
|
many=True,
|
|
|
|
dump_only=True,
|
|
|
|
description='The lots where this device is directly under.',
|
|
|
|
)
|
2019-04-23 19:27:31 +00:00
|
|
|
rate = NestedOn('Rate', dump_only=True, description=m.Device.rate.__doc__)
|
2018-10-14 18:10:52 +00:00
|
|
|
price = NestedOn('Price', dump_only=True, description=m.Device.price.__doc__)
|
2021-11-10 17:59:44 +00:00
|
|
|
tradings = Dict(dump_only=True, description='')
|
2022-06-15 10:17:16 +00:00
|
|
|
physical = EnumField(
|
|
|
|
states.Physical, dump_only=True, description=m.Device.physical.__doc__
|
|
|
|
)
|
|
|
|
traking = EnumField(
|
|
|
|
states.Traking, dump_only=True, description=m.Device.physical.__doc__
|
|
|
|
)
|
|
|
|
usage = EnumField(
|
|
|
|
states.Usage, dump_only=True, description=m.Device.physical.__doc__
|
|
|
|
)
|
2021-11-10 17:59:44 +00:00
|
|
|
revoke = UUID(dump_only=True)
|
2018-10-13 12:53:46 +00:00
|
|
|
physical_possessor = NestedOn('Agent', dump_only=True, data_key='physicalPossessor')
|
2022-06-15 10:17:16 +00:00
|
|
|
production_date = DateTime(
|
|
|
|
'iso', description=m.Device.updated.comment, data_key='productionDate'
|
|
|
|
)
|
|
|
|
working = NestedOn(
|
|
|
|
'Action', many=True, dump_only=True, description=m.Device.working.__doc__
|
|
|
|
)
|
2019-07-07 19:36:09 +00:00
|
|
|
variant = SanitizedStr(description=m.Device.variant.comment)
|
|
|
|
sku = SanitizedStr(description=m.Device.sku.comment)
|
|
|
|
image = URL(description=m.Device.image.comment)
|
2020-11-23 14:53:56 +00:00
|
|
|
allocated = Boolean(description=m.Device.allocated.comment)
|
2022-08-31 15:27:17 +00:00
|
|
|
dhid = SanitizedStr(
|
2022-06-15 10:17:16 +00:00
|
|
|
data_key='devicehubID', description=m.Device.devicehub_id.comment
|
|
|
|
)
|
2022-11-16 10:51:31 +00:00
|
|
|
family = SanitizedStr(validate=Length(max=STR_BIG_SIZE))
|
2018-06-16 10:41:12 +00:00
|
|
|
|
|
|
|
@pre_load
|
2019-05-11 14:27:22 +00:00
|
|
|
def from_actions_to_actions_one(self, data: dict):
|
2018-06-16 10:41:12 +00:00
|
|
|
"""
|
2019-05-11 14:27:22 +00:00
|
|
|
Not an elegant way of allowing submitting actions to a device
|
|
|
|
(in the context of Snapshots) without creating an ``actions``
|
2018-06-16 10:41:12 +00:00
|
|
|
field at the model (which is not possible).
|
|
|
|
:param data:
|
|
|
|
:return:
|
|
|
|
"""
|
2019-05-11 14:27:22 +00:00
|
|
|
# Note that it is secure to allow uploading actions_one
|
2018-06-16 10:41:12 +00:00
|
|
|
# as the only time an user can send a device object is
|
|
|
|
# in snapshots.
|
2019-05-11 14:27:22 +00:00
|
|
|
data['actions_one'] = data.pop('actions', [])
|
2018-06-16 10:41:12 +00:00
|
|
|
return data
|
|
|
|
|
|
|
|
@post_load
|
2019-05-11 14:27:22 +00:00
|
|
|
def validate_snapshot_actions(self, data):
|
|
|
|
"""Validates that only snapshot-related actions can be uploaded."""
|
2022-06-15 10:17:16 +00:00
|
|
|
from ereuse_devicehub.resources.action.models import (
|
|
|
|
Benchmark,
|
|
|
|
EraseBasic,
|
|
|
|
Install,
|
|
|
|
Rate,
|
|
|
|
Test,
|
|
|
|
)
|
|
|
|
|
2019-05-11 14:27:22 +00:00
|
|
|
for action in data['actions_one']:
|
|
|
|
if not isinstance(action, (Install, EraseBasic, Rate, Test, Benchmark)):
|
2022-06-15 10:17:16 +00:00
|
|
|
raise ValidationError(
|
|
|
|
'You cannot upload {}'.format(action), field_names=['actions']
|
|
|
|
)
|
2018-04-10 15:06:39 +00:00
|
|
|
|
|
|
|
|
|
|
|
class Computer(Device):
|
2019-02-03 16:12:53 +00:00
|
|
|
__doc__ = m.Computer.__doc__
|
2021-11-19 10:34:13 +00:00
|
|
|
# TODO TimeOut 1. Comment components if there are time out.
|
2022-06-15 10:17:16 +00:00
|
|
|
components = NestedOn(
|
|
|
|
'Component',
|
|
|
|
many=True,
|
|
|
|
dump_only=True,
|
|
|
|
collection_class=OrderedSet,
|
|
|
|
description='The components that are inside this computer.',
|
|
|
|
)
|
|
|
|
chassis = EnumField(enums.ComputerChassis, description=m.Computer.chassis.comment)
|
|
|
|
ram_size = Integer(
|
|
|
|
dump_only=True, data_key='ramSize', description=m.Computer.ram_size.__doc__
|
|
|
|
)
|
|
|
|
data_storage_size = Integer(
|
|
|
|
dump_only=True,
|
|
|
|
data_key='dataStorageSize',
|
|
|
|
description=m.Computer.data_storage_size.__doc__,
|
|
|
|
)
|
|
|
|
processor_model = Str(
|
|
|
|
dump_only=True,
|
|
|
|
data_key='processorModel',
|
|
|
|
description=m.Computer.processor_model.__doc__,
|
|
|
|
)
|
|
|
|
graphic_card_model = Str(
|
|
|
|
dump_only=True,
|
|
|
|
data_key='graphicCardModel',
|
|
|
|
description=m.Computer.graphic_card_model.__doc__,
|
|
|
|
)
|
|
|
|
network_speeds = List(
|
|
|
|
Integer(dump_only=True),
|
|
|
|
dump_only=True,
|
|
|
|
data_key='networkSpeeds',
|
|
|
|
description=m.Computer.network_speeds.__doc__,
|
|
|
|
)
|
|
|
|
privacy = NestedOn(
|
|
|
|
'Action',
|
|
|
|
many=True,
|
|
|
|
dump_only=True,
|
|
|
|
collection_class=set,
|
|
|
|
description=m.Computer.privacy.__doc__,
|
|
|
|
)
|
|
|
|
amount = Integer(
|
|
|
|
validate=f.validate.Range(min=0, max=100), description=m.Computer.amount.__doc__
|
|
|
|
)
|
2021-11-18 10:50:29 +00:00
|
|
|
# author_id = NestedOn(s_user.User, only_query='author_id')
|
2020-04-01 17:11:14 +00:00
|
|
|
owner_id = UUID(data_key='ownerID')
|
2022-06-15 10:17:16 +00:00
|
|
|
transfer_state = EnumField(
|
|
|
|
enums.TransferState, description=m.Computer.transfer_state.comment
|
|
|
|
)
|
2020-04-01 17:11:14 +00:00
|
|
|
receiver_id = UUID(data_key='receiverID')
|
2022-06-15 10:17:16 +00:00
|
|
|
system_uuid = UUID(required=False)
|
2019-12-10 23:35:17 +00:00
|
|
|
|
2018-04-10 15:06:39 +00:00
|
|
|
|
|
|
|
class Desktop(Computer):
|
2019-02-03 16:12:53 +00:00
|
|
|
__doc__ = m.Desktop.__doc__
|
2018-04-10 15:06:39 +00:00
|
|
|
|
|
|
|
|
|
|
|
class Laptop(Computer):
|
2019-02-03 16:12:53 +00:00
|
|
|
__doc__ = m.Laptop.__doc__
|
2019-05-03 12:31:49 +00:00
|
|
|
layout = EnumField(Layouts, description=m.Laptop.layout.comment)
|
2018-04-10 15:06:39 +00:00
|
|
|
|
|
|
|
|
2018-06-26 13:35:13 +00:00
|
|
|
class Server(Computer):
|
2019-02-03 16:12:53 +00:00
|
|
|
__doc__ = m.Server.__doc__
|
2018-04-10 15:06:39 +00:00
|
|
|
|
|
|
|
|
2018-06-26 13:35:13 +00:00
|
|
|
class DisplayMixin:
|
2019-02-03 16:12:53 +00:00
|
|
|
__doc__ = m.DisplayMixin.__doc__
|
2020-12-17 14:09:21 +00:00
|
|
|
size = Float(description=m.DisplayMixin.size.comment, validate=Range(2, 150))
|
2022-06-15 10:17:16 +00:00
|
|
|
technology = EnumField(
|
|
|
|
enums.DisplayTech, description=m.DisplayMixin.technology.comment
|
|
|
|
)
|
|
|
|
resolution_width = Integer(
|
|
|
|
data_key='resolutionWidth',
|
|
|
|
validate=Range(10, 20000),
|
|
|
|
description=m.DisplayMixin.resolution_width.comment,
|
|
|
|
)
|
|
|
|
resolution_height = Integer(
|
|
|
|
data_key='resolutionHeight',
|
|
|
|
validate=Range(10, 20000),
|
|
|
|
description=m.DisplayMixin.resolution_height.comment,
|
|
|
|
)
|
2018-10-23 13:37:37 +00:00
|
|
|
refresh_rate = Integer(data_key='refreshRate', validate=Range(10, 1000))
|
|
|
|
contrast_ratio = Integer(data_key='contrastRatio', validate=Range(100, 100000))
|
2019-05-03 12:31:49 +00:00
|
|
|
touchable = Boolean(description=m.DisplayMixin.touchable.comment)
|
2022-06-15 10:17:16 +00:00
|
|
|
aspect_ratio = String(
|
|
|
|
dump_only=True, description=m.DisplayMixin.aspect_ratio.__doc__
|
|
|
|
)
|
2019-05-03 12:31:49 +00:00
|
|
|
widescreen = Boolean(dump_only=True, description=m.DisplayMixin.widescreen.__doc__)
|
2018-06-26 13:35:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
class NetworkMixin:
|
2019-02-03 16:12:53 +00:00
|
|
|
__doc__ = m.NetworkMixin.__doc__
|
|
|
|
|
2022-06-15 10:17:16 +00:00
|
|
|
speed = Integer(
|
|
|
|
validate=Range(min=10, max=10000),
|
|
|
|
unit=UnitCodes.mbps,
|
|
|
|
description=m.NetworkAdapter.speed.comment,
|
|
|
|
)
|
2018-07-19 19:25:06 +00:00
|
|
|
wireless = Boolean(required=True)
|
2018-06-26 13:35:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
class Monitor(DisplayMixin, Device):
|
2019-02-03 16:12:53 +00:00
|
|
|
__doc__ = m.Monitor.__doc__
|
2018-04-10 15:06:39 +00:00
|
|
|
|
|
|
|
|
2018-06-26 13:35:13 +00:00
|
|
|
class ComputerMonitor(Monitor):
|
2019-02-03 16:12:53 +00:00
|
|
|
__doc__ = m.ComputerMonitor.__doc__
|
2018-04-10 15:06:39 +00:00
|
|
|
|
|
|
|
|
2018-06-26 13:35:13 +00:00
|
|
|
class TelevisionSet(Monitor):
|
2019-02-03 16:12:53 +00:00
|
|
|
__doc__ = m.TelevisionSet.__doc__
|
2018-06-26 13:35:13 +00:00
|
|
|
|
|
|
|
|
2022-11-22 14:44:44 +00:00
|
|
|
class Projector(Monitor):
|
|
|
|
__doc__ = m.Projector.__doc__
|
|
|
|
|
|
|
|
|
2018-06-26 13:35:13 +00:00
|
|
|
class Mobile(Device):
|
2019-02-03 16:12:53 +00:00
|
|
|
__doc__ = m.Mobile.__doc__
|
|
|
|
|
2018-10-04 08:59:31 +00:00
|
|
|
imei = Integer(description=m.Mobile.imei.comment)
|
|
|
|
meid = Str(description=m.Mobile.meid.comment)
|
2022-06-15 10:17:16 +00:00
|
|
|
ram_size = Integer(
|
|
|
|
validate=Range(min=128, max=36000),
|
|
|
|
data_key='ramSize',
|
|
|
|
unit=UnitCodes.mbyte,
|
|
|
|
description=m.Mobile.ram_size.comment,
|
|
|
|
)
|
|
|
|
data_storage_size = Integer(
|
|
|
|
validate=Range(0, 10**8),
|
|
|
|
data_key='dataStorageSize',
|
|
|
|
description=m.Mobile.data_storage_size,
|
|
|
|
)
|
|
|
|
display_size = Float(
|
|
|
|
validate=Range(min=0.1, max=30.0),
|
|
|
|
data_key='displaySize',
|
|
|
|
description=m.Mobile.display_size.comment,
|
|
|
|
)
|
2019-05-03 12:31:49 +00:00
|
|
|
|
2023-06-07 11:36:08 +00:00
|
|
|
@pre_load
|
|
|
|
def convert_check_imei(self, data):
|
|
|
|
if data.get('imei', None):
|
|
|
|
# data['imei'] = int(imei.validate(data['imei']))
|
|
|
|
data['imei'] = int(data['imei'].replace("-", ""))
|
|
|
|
return data
|
2018-10-04 08:59:31 +00:00
|
|
|
|
|
|
|
@pre_load
|
|
|
|
def convert_check_meid(self, data: dict):
|
|
|
|
if data.get('meid', None):
|
2018-06-26 13:35:13 +00:00
|
|
|
data['meid'] = meid.compact(data['meid'])
|
2018-11-17 18:22:41 +00:00
|
|
|
return data
|
2018-06-26 13:35:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
class Smartphone(Mobile):
|
2019-02-03 16:12:53 +00:00
|
|
|
__doc__ = m.Smartphone.__doc__
|
2018-06-26 13:35:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
class Tablet(Mobile):
|
2019-02-03 16:12:53 +00:00
|
|
|
__doc__ = m.Tablet.__doc__
|
2018-06-26 13:35:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
class Cellphone(Mobile):
|
2019-02-03 16:12:53 +00:00
|
|
|
__doc__ = m.Cellphone.__doc__
|
2018-06-20 21:18:15 +00:00
|
|
|
|
|
|
|
|
2018-04-10 15:06:39 +00:00
|
|
|
class Component(Device):
|
2019-02-03 16:12:53 +00:00
|
|
|
__doc__ = m.Component.__doc__
|
|
|
|
|
2018-05-11 16:58:48 +00:00
|
|
|
parent = NestedOn(Device, dump_only=True)
|
2018-04-10 15:06:39 +00:00
|
|
|
|
|
|
|
|
|
|
|
class GraphicCard(Component):
|
2019-02-03 16:12:53 +00:00
|
|
|
__doc__ = m.GraphicCard.__doc__
|
|
|
|
|
2022-06-15 10:17:16 +00:00
|
|
|
memory = Integer(
|
|
|
|
validate=Range(0, 10000),
|
|
|
|
unit=UnitCodes.mbyte,
|
|
|
|
description=m.GraphicCard.memory.comment,
|
|
|
|
)
|
2018-04-10 15:06:39 +00:00
|
|
|
|
|
|
|
|
2018-06-10 16:47:49 +00:00
|
|
|
class DataStorage(Component):
|
2019-02-03 16:12:53 +00:00
|
|
|
__doc__ = m.DataStorage.__doc__
|
|
|
|
|
2022-06-15 10:17:16 +00:00
|
|
|
size = Integer(
|
|
|
|
validate=Range(0, 10**8),
|
|
|
|
unit=UnitCodes.mbyte,
|
|
|
|
description=m.DataStorage.size.comment,
|
|
|
|
)
|
2018-11-09 10:22:13 +00:00
|
|
|
interface = EnumField(enums.DataStorageInterface)
|
2019-05-11 14:27:22 +00:00
|
|
|
privacy = NestedOn('Action', dump_only=True)
|
2018-04-10 15:06:39 +00:00
|
|
|
|
|
|
|
|
2018-06-10 16:47:49 +00:00
|
|
|
class HardDrive(DataStorage):
|
2019-02-03 16:12:53 +00:00
|
|
|
__doc__ = m.HardDrive.__doc__
|
2018-06-10 16:47:49 +00:00
|
|
|
|
|
|
|
|
|
|
|
class SolidStateDrive(DataStorage):
|
2019-02-03 16:12:53 +00:00
|
|
|
__doc__ = m.SolidStateDrive.__doc__
|
2018-06-10 16:47:49 +00:00
|
|
|
|
|
|
|
|
2018-04-10 15:06:39 +00:00
|
|
|
class Motherboard(Component):
|
2019-02-03 16:12:53 +00:00
|
|
|
__doc__ = m.Motherboard.__doc__
|
|
|
|
|
2022-06-15 10:17:16 +00:00
|
|
|
slots = Integer(validate=Range(0, 20), description=m.Motherboard.slots.comment)
|
2019-02-03 16:12:53 +00:00
|
|
|
usb = Integer(validate=Range(0, 20), description=m.Motherboard.usb.comment)
|
2022-06-15 10:17:16 +00:00
|
|
|
firewire = Integer(
|
|
|
|
validate=Range(0, 20), description=m.Motherboard.firewire.comment
|
|
|
|
)
|
2019-02-03 16:12:53 +00:00
|
|
|
serial = Integer(validate=Range(0, 20), description=m.Motherboard.serial.comment)
|
|
|
|
pcmcia = Integer(validate=Range(0, 20), description=m.Motherboard.pcmcia.comment)
|
2022-06-15 10:17:16 +00:00
|
|
|
bios_date = Date(
|
|
|
|
validate=Range(
|
|
|
|
datetime.date(year=1980, month=1, day=1),
|
|
|
|
datetime.date(year=2030, month=1, day=1),
|
|
|
|
),
|
|
|
|
data_key='biosDate',
|
|
|
|
description=m.Motherboard.bios_date,
|
|
|
|
)
|
2019-06-29 14:26:14 +00:00
|
|
|
ram_slots = Integer(validate=Range(1), data_key='ramSlots')
|
|
|
|
ram_max_size = Integer(validate=Range(1), data_key='ramMaxSize')
|
2018-04-10 15:06:39 +00:00
|
|
|
|
|
|
|
|
2018-06-26 13:36:21 +00:00
|
|
|
class NetworkAdapter(NetworkMixin, Component):
|
2019-02-03 16:12:53 +00:00
|
|
|
__doc__ = m.NetworkAdapter.__doc__
|
2018-04-27 17:16:43 +00:00
|
|
|
|
|
|
|
|
2018-05-11 16:58:48 +00:00
|
|
|
class Processor(Component):
|
2019-02-03 16:12:53 +00:00
|
|
|
__doc__ = m.Processor.__doc__
|
|
|
|
|
2022-06-15 10:17:16 +00:00
|
|
|
speed = Float(
|
|
|
|
validate=Range(min=0.1, max=15),
|
|
|
|
unit=UnitCodes.ghz,
|
|
|
|
description=m.Processor.speed.comment,
|
|
|
|
)
|
|
|
|
cores = Integer(
|
|
|
|
validate=Range(min=1, max=10), description=m.Processor.cores.comment
|
|
|
|
)
|
|
|
|
threads = Integer(
|
|
|
|
validate=Range(min=1, max=20), description=m.Processor.threads.comment
|
|
|
|
)
|
|
|
|
address = Integer(
|
|
|
|
validate=OneOf({8, 16, 32, 64, 128, 256}),
|
|
|
|
description=m.Processor.address.comment,
|
|
|
|
)
|
2019-05-03 12:31:49 +00:00
|
|
|
abi = SanitizedStr(lower=True, description=m.Processor.abi.comment)
|
2018-05-11 16:58:48 +00:00
|
|
|
|
|
|
|
|
2018-04-27 17:16:43 +00:00
|
|
|
class RamModule(Component):
|
2019-02-03 16:12:53 +00:00
|
|
|
__doc__ = m.RamModule.__doc__
|
|
|
|
|
2022-06-15 10:17:16 +00:00
|
|
|
size = Integer(
|
|
|
|
validate=Range(min=128, max=17000),
|
|
|
|
unit=UnitCodes.mbyte,
|
|
|
|
description=m.RamModule.size.comment,
|
|
|
|
)
|
2018-07-19 19:25:06 +00:00
|
|
|
speed = Integer(validate=Range(min=100, max=10000), unit=UnitCodes.mhz)
|
2018-11-09 10:22:13 +00:00
|
|
|
interface = EnumField(enums.RamInterface)
|
|
|
|
format = EnumField(enums.RamFormat)
|
2018-06-26 13:36:21 +00:00
|
|
|
|
|
|
|
|
2018-07-02 10:52:54 +00:00
|
|
|
class SoundCard(Component):
|
2019-02-03 16:12:53 +00:00
|
|
|
__doc__ = m.SoundCard.__doc__
|
2018-07-02 10:52:54 +00:00
|
|
|
|
|
|
|
|
2018-06-26 13:36:21 +00:00
|
|
|
class Display(DisplayMixin, Component):
|
2019-02-03 16:12:53 +00:00
|
|
|
__doc__ = m.Display.__doc__
|
2018-09-30 17:40:28 +00:00
|
|
|
|
|
|
|
|
2019-05-03 12:31:49 +00:00
|
|
|
class Battery(Component):
|
2020-03-17 17:42:53 +00:00
|
|
|
__doc__ = m.Battery.__doc__
|
2019-05-03 12:31:49 +00:00
|
|
|
|
|
|
|
wireless = Boolean(description=m.Battery.wireless.comment)
|
2022-06-15 10:17:16 +00:00
|
|
|
technology = EnumField(
|
|
|
|
enums.BatteryTechnology, description=m.Battery.technology.comment
|
|
|
|
)
|
2019-05-03 12:31:49 +00:00
|
|
|
size = Integer(required=True, description=m.Battery.size.comment)
|
|
|
|
|
|
|
|
|
2019-07-01 18:39:32 +00:00
|
|
|
class Camera(Component):
|
2020-03-17 17:42:53 +00:00
|
|
|
__doc__ = m.Camera.__doc__
|
2019-07-01 18:39:32 +00:00
|
|
|
|
|
|
|
focal_length = Integer(data_key='focalLength')
|
|
|
|
video_height = Integer(data_key='videoHeight')
|
|
|
|
video_width = Integer(data_key='videoWidth')
|
|
|
|
horizontal_view_angle = Integer(data_key='horizontalViewAngle')
|
|
|
|
facing = Integer()
|
|
|
|
vertical_view_angle = Integer(data_key='verticalViewAngle')
|
|
|
|
video_stabilization = Integer(data_key='videoStabilization')
|
|
|
|
flash = Integer()
|
|
|
|
|
|
|
|
|
2018-09-30 17:40:28 +00:00
|
|
|
class Manufacturer(Schema):
|
2019-02-03 16:12:53 +00:00
|
|
|
__doc__ = m.Manufacturer.__doc__
|
|
|
|
|
2018-09-30 17:40:28 +00:00
|
|
|
name = String(dump_only=True)
|
|
|
|
url = URL(dump_only=True)
|
|
|
|
logo = URL(dump_only=True)
|
2018-10-23 13:37:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
class ComputerAccessory(Device):
|
2019-02-03 16:12:53 +00:00
|
|
|
__doc__ = m.ComputerAccessory.__doc__
|
2018-10-23 13:37:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
class Mouse(ComputerAccessory):
|
2019-02-03 16:12:53 +00:00
|
|
|
__doc__ = m.Mouse.__doc__
|
2018-10-23 13:37:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
class MemoryCardReader(ComputerAccessory):
|
2019-02-03 16:12:53 +00:00
|
|
|
__doc__ = m.MemoryCardReader.__doc__
|
2018-10-23 13:37:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
class SAI(ComputerAccessory):
|
2019-02-03 16:12:53 +00:00
|
|
|
__doc__ = m.SAI.__doc__
|
2018-10-23 13:37:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
class Keyboard(ComputerAccessory):
|
2019-02-03 16:12:53 +00:00
|
|
|
__doc__ = m.Keyboard.__doc__
|
|
|
|
|
2018-10-23 13:37:37 +00:00
|
|
|
layout = EnumField(Layouts)
|
|
|
|
|
|
|
|
|
|
|
|
class Networking(NetworkMixin, Device):
|
2019-02-03 16:12:53 +00:00
|
|
|
__doc__ = m.Networking.__doc__
|
2018-10-23 13:37:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
class Router(Networking):
|
2019-02-03 16:12:53 +00:00
|
|
|
__doc__ = m.Router.__doc__
|
2018-10-23 13:37:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
class Switch(Networking):
|
2019-02-03 16:12:53 +00:00
|
|
|
__doc__ = m.Switch.__doc__
|
2018-10-23 13:37:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
class Hub(Networking):
|
2019-02-03 16:12:53 +00:00
|
|
|
__doc__ = m.Hub.__doc__
|
2018-10-23 13:37:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
class WirelessAccessPoint(Networking):
|
2019-02-03 16:12:53 +00:00
|
|
|
__doc__ = m.WirelessAccessPoint.__doc__
|
2018-10-23 13:37:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
class Printer(Device):
|
2019-02-03 16:12:53 +00:00
|
|
|
__doc__ = m.Printer.__doc__
|
|
|
|
|
2022-06-15 10:17:16 +00:00
|
|
|
wireless = Boolean(
|
|
|
|
required=True, missing=False, description=m.Printer.wireless.comment
|
|
|
|
)
|
|
|
|
scanning = Boolean(
|
|
|
|
required=True, missing=False, description=m.Printer.scanning.comment
|
|
|
|
)
|
|
|
|
technology = EnumField(
|
|
|
|
enums.PrinterTechnology, required=True, description=m.Printer.technology.comment
|
|
|
|
)
|
|
|
|
monochrome = Boolean(
|
|
|
|
required=True, missing=True, description=m.Printer.monochrome.comment
|
|
|
|
)
|
2018-10-23 13:37:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
class LabelPrinter(Printer):
|
2019-02-03 16:12:53 +00:00
|
|
|
__doc__ = m.LabelPrinter.__doc__
|
2018-10-23 13:37:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
class Sound(Device):
|
2019-02-03 16:12:53 +00:00
|
|
|
__doc__ = m.Sound.__doc__
|
2018-10-23 13:37:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
class Microphone(Sound):
|
2019-02-03 16:12:53 +00:00
|
|
|
__doc__ = m.Microphone.__doc__
|
2018-10-23 13:37:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
class Video(Device):
|
2019-02-03 16:12:53 +00:00
|
|
|
__doc__ = m.Video.__doc__
|
2018-10-23 13:37:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
class VideoScaler(Video):
|
2019-02-03 16:12:53 +00:00
|
|
|
__doc__ = m.VideoScaler.__doc__
|
2018-10-23 13:37:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
class Videoconference(Video):
|
2019-02-03 16:12:53 +00:00
|
|
|
__doc__ = m.Videoconference.__doc__
|
2018-11-12 10:59:49 +00:00
|
|
|
|
|
|
|
|
|
|
|
class Cooking(Device):
|
2019-02-03 16:12:53 +00:00
|
|
|
__doc__ = m.Cooking.__doc__
|
2018-11-12 10:59:49 +00:00
|
|
|
|
|
|
|
|
|
|
|
class Mixer(Cooking):
|
2019-02-03 16:12:53 +00:00
|
|
|
__doc__ = m.Mixer.__doc__
|
2019-07-01 18:39:32 +00:00
|
|
|
|
|
|
|
|
2019-07-07 19:36:09 +00:00
|
|
|
class DIYAndGardening(Device):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
class Drill(DIYAndGardening):
|
2019-07-01 18:39:32 +00:00
|
|
|
max_drill_bit_size = Integer(data_key='maxDrillBitSize')
|
|
|
|
|
|
|
|
|
2019-07-07 19:36:09 +00:00
|
|
|
class PackOfScrewdrivers(DIYAndGardening):
|
2019-07-01 18:39:32 +00:00
|
|
|
size = Integer()
|
|
|
|
|
|
|
|
|
2019-07-07 19:36:09 +00:00
|
|
|
class Home(Device):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
class Dehumidifier(Home):
|
2019-07-01 18:39:32 +00:00
|
|
|
size = Integer()
|
|
|
|
|
|
|
|
|
2019-07-07 19:36:09 +00:00
|
|
|
class Stairs(Home):
|
2019-07-01 18:39:32 +00:00
|
|
|
max_allowed_weight = Integer(data_key='maxAllowedWeight')
|
|
|
|
|
|
|
|
|
2019-07-07 19:36:09 +00:00
|
|
|
class Recreation(Device):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
class Bike(Recreation):
|
2019-07-01 18:39:32 +00:00
|
|
|
wheel_size = Integer(data_key='wheelSize')
|
|
|
|
gears = Integer()
|
|
|
|
|
|
|
|
|
2019-07-07 19:36:09 +00:00
|
|
|
class Racket(Recreation):
|
2019-07-01 18:39:32 +00:00
|
|
|
pass
|
2022-11-29 15:49:23 +00:00
|
|
|
|
|
|
|
|
2023-07-26 10:58:07 +00:00
|
|
|
class SolarPanel(Device):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
2022-11-29 15:49:23 +00:00
|
|
|
class Other(Device):
|
|
|
|
pass
|