This repository has been archived by the owner on Mar 26, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
102 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
107 | ||
115 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
from flask_restful import Resource | ||
from flask_restful import reqparse | ||
from flask import request | ||
from gateway.views.errors import InvalidRequest | ||
from gateway.views.errors import NotFound | ||
from gateway.views.objects_info import UserInfo | ||
from gateway.views_v2.objects_lvl import ObjectInfo | ||
from gateway.views_v2.objects_lvl import ControllerInfo | ||
from gateway.views_v2.objects_lvl import SensorInfo | ||
from gateway.views_v2.objects_lvl import ObjList | ||
from gateway.views_v2.objects_lvl import Listed | ||
from proto import objects_pb2_grpc | ||
from proto import objects_pb2 | ||
from proto import data_pb2_grpc | ||
from proto import data_pb2 | ||
from proto import stats_pb2_grpc | ||
from proto import stats_pb2 | ||
from proto import utils_pb2 | ||
import datetime | ||
import base64 | ||
import time | ||
import logging | ||
|
||
log = logging.getLogger("flask.app") | ||
|
||
|
||
# добавлен для однообразности | ||
class Relations(object): | ||
@staticmethod | ||
def parse_sensor_info(ssr): | ||
rs = SensorInfo(ssr.id, | ||
ssr.controller_id, | ||
ssr.name, | ||
ssr.activation_date, | ||
None, | ||
ssr.sensor_type, | ||
ssr.company) | ||
if ssr.HasField("deactivation_date_val"): | ||
rs.deactivation_date = ssr.deactivation_date_val | ||
return rs | ||
|
||
@staticmethod | ||
def collect_sensor_info(sensor_info, data_chan): | ||
s_inf = Relations.parse_sensor_info(sensor_info) | ||
return s_inf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters