aboutsummaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
Diffstat (limited to 'misc')
-rw-r--r--misc/main.go107
1 files changed, 84 insertions, 23 deletions
diff --git a/misc/main.go b/misc/main.go
index ddabba1..d2ef8fe 100644
--- a/misc/main.go
+++ b/misc/main.go
@@ -90,14 +90,14 @@ var release = []byte{0x62, 0x00}
* A1 0C ROSE-Invoke
* 02 01 01 invokeId present: 1
* 02 02 00 D3 opcode local: 211
- * 30 03 SystemStatusArgiment
+ * 30 03 SystemStatusArg
* 0A 01 02 systemStatus normal
*/
/* SystemStatus Result
* A2 0B ROSE-ReturnResult
* 02 01 01 invokeId present: 1
- * 30 06 SystemStatusResult
+ * 30 06 SystemStatusRes
* 02 02 00 D3 opcode local: 211
* 05 00 noData
*/
@@ -115,6 +115,68 @@ var status = []byte{
* 80 01 00 ABRT-source: acse-service-user
*/
+/* Request CO lines
+ * A1 16 ROSE-Invoke
+ * 02 02 00 E0 invokeId: 224
+ * 02 01 33 opcode local: 51
+ * 30 0D EscapeArgument
+ * A4 0B kmeSystemData
+ * A0 09 getSystemData
+ * A4 07 deviceList
+ * A1 05 category
+ * A0 03 standardDevice
+ * 0A 01 02 networkInterface
+ */
+
+var co = []byte{
+ 0xA1, 0x16,
+ 0x02, 0x02, 0x00, 0xE0,
+ 0x02, 0x01, 0x33,
+ 0x30, 0x0D,
+ 0xA4, 0x0B,
+ 0xA0, 0x09,
+ 0xA4, 0x07,
+ 0xA1, 0x05,
+ 0xA0, 0x03,
+ 0x0A, 0x01, 0x02,
+}
+
+/* Request EXT
+ * A1 16 ROSE-Invoke
+ * 02 02 06 02 invokeId: 1538
+ * 02 01 33 opcode local: 51
+ * 30 0D EscapeArgument
+ * A4 0B kmeSystemData
+ * A0 09 getSystemData
+ * A4 07 deviceList
+ * A1 05 category
+ * A0 03 standardDevice
+ * 0A 01 05 station
+ */
+
+var ext = []byte{
+ 0xA1, 0x16,
+ 0x02, 0x02, 0x06, 0x02,
+ 0x02, 0x01, 0x33,
+ 0x30, 0x0D,
+ 0xA4, 0x0B,
+ 0xA0, 0x09,
+ 0xA4, 0x07,
+ 0xA1, 0x05,
+ 0xA0, 0x03,
+ 0x0A, 0x01, 0x05,
+}
+
+/* Monitor 111
+ * A1 11 ROSE-Invoke
+ * 02 01 78 invoceId: 120
+ * 02 01 47 opcode local: 71
+ * 30 09 MonitorStartArgument
+ * 30 05 MonitorObject (CSTAObject)
+ * 80 03 31 31 31 dialingNumber '111'
+ * A0 00 ?
+ */
+
var nbo = binary.BigEndian // Network Byte Order
func send(c net.Conn, b []byte) {
@@ -139,31 +201,27 @@ func recv(c net.Conn) []byte {
return r
}
-func dump(b []byte, dir string) {
- log.Println(dir)
+func dump(b []byte) {
fmt.Println(hex.Dump(b))
}
-func Associate(c net.Conn) {
- dump(associate, ">>> Send associate")
- send(c, associate)
- in := recv(c)
- dump(in, "<<< Recv associate")
-}
-
-func Release(c net.Conn) {
- dump(release, ">>> Send release")
- send(c, release)
- in := recv(c)
- dump(in, "<<< Recv release")
+func Ask(c net.Conn, b []byte) []byte {
+ log.Println("Ask")
+ dump(b)
+ send(c, b)
+ r := recv(c)
+ log.Println("Reply length", len(r))
+ dump(r)
+ return r
}
func Status(c net.Conn) {
+ log.Println("Status")
in := recv(c)
- dump(in, "<<< Recv status")
+ dump(in)
out := status
out[4] = in[4]
- dump(out, ">>> Send status")
+ dump(out)
send(c, out)
}
@@ -174,10 +232,13 @@ func main() {
}
defer conn.Close()
- Associate(conn)
- defer Release(conn)
+ Ask(conn, associate)
+ Status(conn)
+ defer Ask(conn, release)
- for i := 0; i < 3; i++ {
- Status(conn)
- }
+ //Ask(conn, co)
+ //Status(conn)
+
+ Ask(conn, ext)
+ //Status(conn)
}