ffi-snap7 0.1.1 → 0.1.3
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.
- data/lib/ffi-snap7/client/client.rb +13 -0
- data/lib/ffi-snap7/client/wrapper.rb +8 -2
- data/lib/ffi-snap7/version.rb +1 -1
- metadata +4 -4
@@ -19,6 +19,19 @@ module Snap7
|
|
19
19
|
end
|
20
20
|
|
21
21
|
|
22
|
+
def set_session_password(password)
|
23
|
+
check_rc Snap7.cli_set_session_password(@cli, password)
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
def plc_status
|
28
|
+
p_status = FFI::MemoryPointer.new :uchar, 1
|
29
|
+
check_rc Snap7.cli_get_plc_status(@cli, p_status)
|
30
|
+
result = p_status.get_array_of_uint8 0, 1
|
31
|
+
{ 0 => 'unknown', 4 => 'stopped', 8 => 'running'}[result.first]
|
32
|
+
end
|
33
|
+
|
34
|
+
|
22
35
|
def db_read(db_number, start, size)
|
23
36
|
p_usr_data = FFI::MemoryPointer.new :uchar, size
|
24
37
|
check_rc Snap7.cli_db_read(@cli, db_number, start, size, p_usr_data)
|
@@ -4,8 +4,10 @@ module Snap7
|
|
4
4
|
attach_function :cli_create, :Cli_Create, [], :s7obj
|
5
5
|
|
6
6
|
# EXPORTSPEC void S7API Cli_Destroy(S7Object &Client);
|
7
|
-
# FIXME crashes MRI
|
8
|
-
|
7
|
+
# attach_function :cli_destroy, :Cli_Destroy, [:s7obj], :void # FIXME crashes MRI
|
8
|
+
|
9
|
+
# EXPORTSPEC int S7API Cli_SetSessionPassword(S7Object Client, char *Password);
|
10
|
+
attach_function :cli_set_session_password, :Cli_SetSessionPassword, [:s7obj, :string], :int
|
9
11
|
|
10
12
|
# EXPORTSPEC int S7API Cli_ConnectTo(S7Object Client, const char *Address, int Rack, int Slot);
|
11
13
|
attach_function :cli_connect_to, :Cli_ConnectTo, [:s7obj, :string, :int, :int], :int
|
@@ -13,6 +15,9 @@ module Snap7
|
|
13
15
|
# EXPORTSPEC int S7API Cli_Disconnect(S7Object Client);
|
14
16
|
attach_function :cli_disconnect, :Cli_Disconnect, [:s7obj], :int
|
15
17
|
|
18
|
+
# EXPORTSPEC int S7API Cli_GetPlcStatus(S7Object Client, int &Status);
|
19
|
+
attach_function :cli_get_plc_status, :Cli_GetPlcStatus, [:s7obj, :pointer], :int
|
20
|
+
|
16
21
|
# EXPORTSPEC int S7API Cli_DBRead(S7Object Client, int DBNumber, int Start, int Size, void *pUsrData);
|
17
22
|
attach_function :cli_db_read, :Cli_DBRead, [:s7obj, :int, :int, :int, :pointer], :int
|
18
23
|
|
@@ -23,4 +28,5 @@ module Snap7
|
|
23
28
|
attach_function :cli_error_text, :Cli_ErrorText, [:int, :pointer, :int], :int
|
24
29
|
|
25
30
|
|
31
|
+
|
26
32
|
end
|
data/lib/ffi-snap7/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ffi-snap7
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 29
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 3
|
10
|
+
version: 0.1.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Andy Rohr
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2016-05-11 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
type: :runtime
|