Skip to content

Commit 913bbc7

Browse files
walker-jCharlesworth
authored andcommitted
Remove flat mode
1 parent c019f40 commit 913bbc7

File tree

3 files changed

+12
-13
lines changed

3 files changed

+12
-13
lines changed

evasdk/Eva.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,14 @@ def auth_invalidate_session(self):
6161

6262

6363
# Data
64-
def data_snapshot(self, mode='flat'):
64+
def data_snapshot(self):
6565
self.__logger.debug('Eva.data_snapshot called')
66-
return self.__http_client.data_snapshot(mode=mode)
66+
return self.__http_client.data_snapshot()
6767

6868

69-
def data_snapshot_property(self, prop, mode='object'):
69+
def data_snapshot_property(self, prop):
7070
self.__logger.debug('Eva.data_snapshot_property called')
71-
return self.__http_client.data_snapshot_property(prop, mode=mode)
71+
return self.__http_client.data_snapshot_property(prop)
7272

7373

7474
def data_servo_positions(self):

evasdk/eva_http_client.py

+6-7
Original file line numberDiff line numberDiff line change
@@ -116,16 +116,15 @@ def auth_invalidate_session(self):
116116

117117

118118
# DATA
119-
# TODO consider adding type for switch between flat and object modes
120-
def data_snapshot(self, mode='flat'):
121-
r = self.api_call_with_auth('GET', 'data/snapshot?mode=' + mode)
119+
def data_snapshot(self):
120+
r = self.api_call_with_auth('GET', 'data/snapshot')
122121
if r.status_code != 200:
123122
eva_error('data_snapshot request error', r)
124123
return r.json()['snapshot']
125124

126125

127-
def data_snapshot_property(self, prop, mode='object'):
128-
snapshot = self.data_snapshot(mode=mode)
126+
def data_snapshot_property(self, prop):
127+
snapshot = self.data_snapshot()
129128
if prop in snapshot:
130129
return snapshot[prop]
131130
else:
@@ -171,14 +170,14 @@ def gpio_get(self, pin, pin_type):
171170

172171

173172
# GPIO helper function
174-
def __globals_editing(self, keys, values, mode='flat'):
173+
def __globals_editing(self, keys, values):
175174
data = {'changes': []}
176175
if (isinstance(keys, list) and isinstance(values, list)):
177176
[data['changes'].append({'key': c[0], 'value': c[1]}) for c in zip(keys, values)]
178177
else:
179178
data['changes'].append({'key': keys, 'value': values})
180179
data = json.dumps(data)
181-
r = self.api_call_with_auth('POST', 'data/globals?mode=' + mode, data)
180+
r = self.api_call_with_auth('POST', 'data/globals', data)
182181
return r
183182

184183

evasdk/eva_ws.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import websockets
22

33

4-
async def ws_connect(host_ip, session_token, data_mode="object"):
4+
async def ws_connect(host_ip, session_token):
55
"""
66
Connect is an async function that returns a connected Eva websocket
77
@@ -11,7 +11,7 @@ async def ws_connect(host_ip, session_token, data_mode="object"):
1111
up the websocket connection.
1212
"""
1313
host_uri = 'ws://{}/api/v1/data/stream'.format(host_ip)
14-
subprotocols = ['SessionToken_{}'.format(session_token), data_mode]
14+
subprotocols = ['SessionToken_{}'.format(session_token), "object"]
1515

1616
ws = await websockets.client.connect(host_uri, subprotocols=subprotocols)
1717
return ws

0 commit comments

Comments
 (0)