@science-corporation/synapse 2.0.0 → 2.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- package/package.json +3 -2
- package/src/config.ts +1 -5
- package/src/device.ts +1 -5
- package/src/nodes/index.ts +0 -2
- package/synapse-api/README.md +1 -1
- package/synapse-api/api/app.proto +55 -0
- package/synapse-api/api/channel.proto +15 -1
- package/synapse-api/api/datatype.proto +97 -1
- package/synapse-api/api/device.proto +65 -0
- package/synapse-api/api/node.proto +19 -18
- package/synapse-api/api/nodes/application.proto +24 -0
- package/synapse-api/api/nodes/broadband_source.proto +1 -0
- package/synapse-api/api/nodes/disk_writer.proto +17 -0
- package/synapse-api/api/nodes/optical_stimulation.proto +29 -0
- package/synapse-api/api/nodes/signal_config.proto +2 -0
- package/synapse-api/api/performance.proto +29 -0
- package/synapse-api/api/query.proto +8 -0
- package/synapse-api/api/status.proto +6 -1
- package/synapse-api/api/synapse.proto +8 -31
- package/synapse-api/api/tap.proto +35 -0
- package/synapse-api/api/time.proto +53 -0
- package/dist/api/api.d.ts +0 -6755
- package/dist/api/api.d.ts.map +0 -1
- package/dist/api/api.js +0 -15729
- package/dist/api/api.js.map +0 -1
- package/dist/api/proto.json +0 -1144
- package/dist/browser.d.ts +0 -4
- package/dist/browser.d.ts.map +0 -1
- package/dist/browser.js +0 -22
- package/dist/browser.js.map +0 -1
- package/dist/config.d.ts +0 -17
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js +0 -115
- package/dist/config.js.map +0 -1
- package/dist/demo.d.ts +0 -2
- package/dist/demo.d.ts.map +0 -1
- package/dist/demo.js +0 -285
- package/dist/demo.js.map +0 -1
- package/dist/device.d.ts +0 -38
- package/dist/device.d.ts.map +0 -1
- package/dist/device.js +0 -185
- package/dist/device.js.map +0 -1
- package/dist/index.d.ts +0 -7
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -30
- package/dist/index.js.map +0 -1
- package/dist/node.d.ts +0 -10
- package/dist/node.d.ts.map +0 -1
- package/dist/node.js +0 -14
- package/dist/node.js.map +0 -1
- package/dist/nodes/broadband_source.d.ts +0 -11
- package/dist/nodes/broadband_source.d.ts.map +0 -1
- package/dist/nodes/broadband_source.js +0 -28
- package/dist/nodes/broadband_source.js.map +0 -1
- package/dist/nodes/disk_writer.d.ts +0 -11
- package/dist/nodes/disk_writer.d.ts.map +0 -1
- package/dist/nodes/disk_writer.js +0 -28
- package/dist/nodes/disk_writer.js.map +0 -1
- package/dist/nodes/electrical_stimulation.d.ts +0 -11
- package/dist/nodes/electrical_stimulation.d.ts.map +0 -1
- package/dist/nodes/electrical_stimulation.js +0 -28
- package/dist/nodes/electrical_stimulation.js.map +0 -1
- package/dist/nodes/index.d.ts +0 -12
- package/dist/nodes/index.d.ts.map +0 -1
- package/dist/nodes/index.js +0 -27
- package/dist/nodes/index.js.map +0 -1
- package/dist/nodes/optical_stimulation.d.ts +0 -11
- package/dist/nodes/optical_stimulation.d.ts.map +0 -1
- package/dist/nodes/optical_stimulation.js +0 -28
- package/dist/nodes/optical_stimulation.js.map +0 -1
- package/dist/nodes/spectral_filter.d.ts +0 -11
- package/dist/nodes/spectral_filter.d.ts.map +0 -1
- package/dist/nodes/spectral_filter.js +0 -28
- package/dist/nodes/spectral_filter.js.map +0 -1
- package/dist/nodes/spike_binner.d.ts +0 -11
- package/dist/nodes/spike_binner.d.ts.map +0 -1
- package/dist/nodes/spike_binner.js +0 -28
- package/dist/nodes/spike_binner.js.map +0 -1
- package/dist/nodes/spike_detector.d.ts +0 -11
- package/dist/nodes/spike_detector.d.ts.map +0 -1
- package/dist/nodes/spike_detector.js +0 -28
- package/dist/nodes/spike_detector.js.map +0 -1
- package/dist/nodes/spike_source.d.ts +0 -11
- package/dist/nodes/spike_source.d.ts.map +0 -1
- package/dist/nodes/spike_source.js +0 -28
- package/dist/nodes/spike_source.js.map +0 -1
- package/dist/nodes/stream_in.d.ts +0 -15
- package/dist/nodes/stream_in.d.ts.map +0 -1
- package/dist/nodes/stream_in.js +0 -66
- package/dist/nodes/stream_in.js.map +0 -1
- package/dist/nodes/stream_out.d.ts +0 -23
- package/dist/nodes/stream_out.d.ts.map +0 -1
- package/dist/nodes/stream_out.js +0 -105
- package/dist/nodes/stream_out.js.map +0 -1
- package/dist/utils/client.d.ts +0 -10
- package/dist/utils/client.d.ts.map +0 -1
- package/dist/utils/client.js +0 -39
- package/dist/utils/client.js.map +0 -1
- package/dist/utils/discover.d.ts +0 -10
- package/dist/utils/discover.d.ts.map +0 -1
- package/dist/utils/discover.js +0 -49
- package/dist/utils/discover.js.map +0 -1
- package/dist/utils/enum.d.ts +0 -2
- package/dist/utils/enum.d.ts.map +0 -1
- package/dist/utils/enum.js +0 -13
- package/dist/utils/enum.js.map +0 -1
- package/dist/utils/index.d.ts +0 -2
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/index.js +0 -6
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/ip.d.ts +0 -2
- package/dist/utils/ip.d.ts.map +0 -1
- package/dist/utils/ip.js +0 -52
- package/dist/utils/ip.js.map +0 -1
- package/dist/utils/status.d.ts +0 -28
- package/dist/utils/status.d.ts.map +0 -1
- package/dist/utils/status.js +0 -54
- package/dist/utils/status.js.map +0 -1
- package/src/api/api.d.ts +0 -6755
- package/src/api/api.js +0 -16783
- package/src/api/proto.json +0 -1144
- package/src/demo.ts +0 -325
- package/src/nodes/stream_in.ts +0 -78
- package/src/nodes/stream_out.ts +0 -109
- package/synapse-api/api/nodes/stream_in.proto +0 -14
- package/synapse-api/api/nodes/stream_out.proto +0 -42
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package synapse;
|
|
4
|
+
|
|
5
|
+
enum TapType {
|
|
6
|
+
TAP_TYPE_UNSPECIFIED = 0;
|
|
7
|
+
|
|
8
|
+
// The tap will be producing data
|
|
9
|
+
TAP_TYPE_PRODUCER = 1;
|
|
10
|
+
|
|
11
|
+
// The tap type will be consuming data
|
|
12
|
+
TAP_TYPE_CONSUMER = 2;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
message TapConnection {
|
|
16
|
+
// Unique name id for this tap
|
|
17
|
+
string name = 1;
|
|
18
|
+
|
|
19
|
+
// What is the zmq endpoint to connect to
|
|
20
|
+
string endpoint = 2;
|
|
21
|
+
|
|
22
|
+
// What is the protobuf message to expect over this
|
|
23
|
+
string message_type = 3;
|
|
24
|
+
|
|
25
|
+
// Is this tap meant to be producing or consuming
|
|
26
|
+
TapType tap_type = 4;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
message ListTapsQuery {
|
|
30
|
+
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
message ListTapsResponse {
|
|
34
|
+
repeated TapConnection taps = 1;
|
|
35
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package synapse;
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Used for precise time synchronization over UDP between clients and a server
|
|
7
|
+
* In most cases, the server is the Synapse device.enum
|
|
8
|
+
*
|
|
9
|
+
* How it works:
|
|
10
|
+
* 1. Client generates a random client_id on first connection
|
|
11
|
+
* 2. Client increments the sequence number on each packet (to detect drops)
|
|
12
|
+
* 3. Client records the send time and sends the packet to the server over udp.
|
|
13
|
+
* - The server port will be available through the Status message
|
|
14
|
+
* - Try to timestamp the packet as close as possible to the send to minimize
|
|
15
|
+
* the calculated offset error. Future improvements could support hardware timestamps
|
|
16
|
+
* 4. Server records the receive time
|
|
17
|
+
* 5. Server immediately echos it back to the client, recording the send time
|
|
18
|
+
* 6. Client records the receive time when the packet returns
|
|
19
|
+
*
|
|
20
|
+
* With these times, the client can calculate
|
|
21
|
+
* - Round Trip Time: (client_receive_time_ns - client_send_time_ns)
|
|
22
|
+
* - Network Latency (assumes symmetric paths): rtt / 2
|
|
23
|
+
* - Clock offset: https://en.wikipedia.org/wiki/Network_Time_Protocol#Clock_synchronization_algorithm
|
|
24
|
+
*
|
|
25
|
+
* Implementation notes:
|
|
26
|
+
* - All timestamps are monotonic nanoseconds since Unix epoch
|
|
27
|
+
* - The server acts as a passive reflector
|
|
28
|
+
* - Multiple sync packets (8 or so) should be sent with a short period (200 ms) between
|
|
29
|
+
*/
|
|
30
|
+
message TimeSyncPacket {
|
|
31
|
+
fixed32 client_id = 1;
|
|
32
|
+
fixed32 sequence = 2;
|
|
33
|
+
|
|
34
|
+
fixed64 client_send_time_ns = 3;
|
|
35
|
+
fixed64 server_receive_time_ns = 4;
|
|
36
|
+
fixed64 server_send_time_ns = 5;
|
|
37
|
+
fixed64 client_receive_time_ns = 6;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Defines the time synchronization method for device timestamps
|
|
41
|
+
enum TimeSource {
|
|
42
|
+
TIME_SOURCE_UNKNOWN = 0;
|
|
43
|
+
|
|
44
|
+
// Use std::chrono::steady_clock (monotonic, immune to system time changes)
|
|
45
|
+
// Note: The epoch is implementation-defined (often system boot time)
|
|
46
|
+
TIME_SOURCE_STEADY_CLOCK = 1;
|
|
47
|
+
|
|
48
|
+
// Calculate timestamps based on sample counter and sampling rate
|
|
49
|
+
// counter_diff = (counter - first_counter)
|
|
50
|
+
// timestamp_ns = (counter_diff * 1e9 / sample_rate) + initial_steady_clock_value
|
|
51
|
+
// Where initial_steady_clock_value = get_steady_clock_now() at start
|
|
52
|
+
TIME_SOURCE_SAMPLE_COUNTER = 2;
|
|
53
|
+
}
|