haruzira_sdk 1.1.0 → 1.2.0
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.
- checksums.yaml +4 -4
- data/lib/haruzira_sdk/HzClientTcpCommunication.rb +133 -124
- data/lib/haruzira_sdk/MsgSendSpeechData.rb +1 -1
- data/lib/haruzira_sdk/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5f6c0e61251fba110613e04fc3ab42d8d0834db8
|
|
4
|
+
data.tar.gz: f2ae5ef6f61ce270a3210101168e3ead1ec37f40
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a7f26b3b879e9033c1ccabee540a4d64f6672bb5d52f14e09f656dc528f49d710817798d2183c7eb1c157879d1c179612c095981645cd606fedaa8e954ea042c
|
|
7
|
+
data.tar.gz: 6e002295dde6e100e2caaca4688203d572aa9073c170221dea4670d40812d3f683c74cc4d7e4b4d0ec8c47457f02dd8066f8a65c5c6467b145365dd82227e321
|
|
@@ -90,6 +90,139 @@ class ClientTcpCommunication
|
|
|
90
90
|
:EvNotifyCompeteSpeech, :EvNotifyMessageEvent, :EvNotifyReceivedDisConnectEvent
|
|
91
91
|
attr_reader :SendDataHexStr, :SendDataLength, :ReceiveStatus, :Version
|
|
92
92
|
|
|
93
|
+
# <summary>
|
|
94
|
+
# トレース出力設定
|
|
95
|
+
# </summary>
|
|
96
|
+
# <returns></returns>
|
|
97
|
+
def setTraceOutPut(val)
|
|
98
|
+
HzTrace.setTraceOutPut(val)
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
# <summary>
|
|
102
|
+
# 応答受信時タイムアウト取得
|
|
103
|
+
# </summary>
|
|
104
|
+
# <param name="value">タイムアウト値</param>
|
|
105
|
+
def ReceiveAckTimeOut
|
|
106
|
+
#Get
|
|
107
|
+
return @ReceiveAckTimeOut
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
# <summary>
|
|
111
|
+
# 応答受信時タイムアウト設定
|
|
112
|
+
# </summary>
|
|
113
|
+
# <param name="value">タイムアウト値</param>
|
|
114
|
+
def ReceiveAckTimeOut=(value)
|
|
115
|
+
#Set
|
|
116
|
+
if(value > RECEIVE_MAX_TIME_OUT)
|
|
117
|
+
@ReceiveAckTimeOut = RECEIVE_MAX_TIME_OUT
|
|
118
|
+
elsif(value < RECEIVE_MIN_TIME_OUT)
|
|
119
|
+
@ReceiveAckTimeOut = RECEIVE_MIN_TIME_OUT
|
|
120
|
+
else
|
|
121
|
+
@ReceiveAckTimeOut = value
|
|
122
|
+
end
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
# <summary>
|
|
126
|
+
# 読み上げデータ送信(自動)
|
|
127
|
+
# </summary>
|
|
128
|
+
# <returns>OK:タイムスタンプ文字列(00:00:00形式), NG:nil</returns>
|
|
129
|
+
def sendSpeechDataEx()
|
|
130
|
+
timeStamp = ""
|
|
131
|
+
notifyEndComm = MsgNotifyEndComm.new()
|
|
132
|
+
|
|
133
|
+
begin
|
|
134
|
+
|
|
135
|
+
#電文シーケンス開始
|
|
136
|
+
#通信開始要求(0x00)
|
|
137
|
+
if (@ReqSendDataAccountName != nil && @ReqSendDataPasswd != nil && @ReqSendDataEncryptKey != nil)
|
|
138
|
+
#暗号化パスワード認証
|
|
139
|
+
retStatus = reqStartCommProc(@ReqSendDataAccountName, @ReqSendDataPasswd, @ReqSendDataEncryptKey)
|
|
140
|
+
elsif (@ReqSendDataAccountName != nil && @ReqSendDataPasswd != nil)
|
|
141
|
+
#パスワード認証
|
|
142
|
+
retStatus = reqStartCommProc(@ReqSendDataAccountName, @ReqSendDataPasswd)
|
|
143
|
+
else
|
|
144
|
+
#認証無
|
|
145
|
+
retStatus = reqStartCommProc()
|
|
146
|
+
end
|
|
147
|
+
if (!retStatus)
|
|
148
|
+
#puts("【CL】通信開始応答受信(0x%02x):待機結果[%s]" % [reqStartComm.id, "Time Out"])
|
|
149
|
+
#raise("通信開始要求メッセージ送信に失敗しました。\r\n通信処理を中断します。")
|
|
150
|
+
puts("[CL]Received, Responce of Communication Start Request(0x%02x):Waiting Result[%s]" % [reqStartComm.id, "Time Out"])
|
|
151
|
+
raise("Sending the message of Communication Strat Request has failed. and then the communication stop.")
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
#非同期メッセージ受信タスク起動
|
|
155
|
+
if(@listenTask == nil)
|
|
156
|
+
@listenTask = Thread.start do
|
|
157
|
+
listenerTask()
|
|
158
|
+
end
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
#読み上げデータ送信(0x03)
|
|
162
|
+
if (@ReqSendDataAccountName != nil && @ReqSendDataEncryptKey != nil)
|
|
163
|
+
#暗号化(アカウント名および暗号化キー有)
|
|
164
|
+
@ReqSendDataEncrypt = true
|
|
165
|
+
elsif (@ReqSendDataAccountName == nil && @ReqSendDataEncryptKey != nil)
|
|
166
|
+
#暗号化(暗号化キーのみ)エラーケース
|
|
167
|
+
@ReqSendDataAccountName = ""
|
|
168
|
+
@ReqSendDataEncrypt = true
|
|
169
|
+
elsif (@ReqSendDataAccountName != nil && @ReqSendDataEncryptKey == nil)
|
|
170
|
+
#平文(アカウント名のみ)
|
|
171
|
+
@ReqSendDataEncrypt = false
|
|
172
|
+
@ReqSendDataEncryptKey = ""
|
|
173
|
+
else
|
|
174
|
+
#平文(認証が有効の場合はエラーとなる)
|
|
175
|
+
@ReqSendDataAccountName = ""
|
|
176
|
+
@ReqSendDataEncrypt = false
|
|
177
|
+
@ReqSendDataEncryptKey = ""
|
|
178
|
+
end
|
|
179
|
+
timeStamp = sendSpeechData()
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
#通信終了通知(0x01)
|
|
183
|
+
if(timeStamp == nil || @ReceiveStatus != 0x00)
|
|
184
|
+
notifyEndCommProc(notifyEndComm.ERR_CODE_OTHER_REASONS)
|
|
185
|
+
else
|
|
186
|
+
notifyEndCommProc(notifyEndComm.ERR_CODE_NONE)
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
rescue => ex
|
|
190
|
+
HzTrace.traceCommMessage("%s" % [ex])
|
|
191
|
+
timeStamp = nil
|
|
192
|
+
ensure
|
|
193
|
+
return timeStamp
|
|
194
|
+
end
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
# <summary>
|
|
198
|
+
# 非同期メッセージ受信スレッドの終了
|
|
199
|
+
# </summary>
|
|
200
|
+
def cancelAsynchronousListener()
|
|
201
|
+
if (@listenTask != nil)
|
|
202
|
+
@listenTask.kill
|
|
203
|
+
@listenTask = nil
|
|
204
|
+
#HzTrace.traceCommMessage("非同期メッセージ受信スレッドをキャンセルしました。")
|
|
205
|
+
HzTrace.traceCommMessage("The thread for receiving some asynchronous messsages was canceled.")
|
|
206
|
+
end
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
# <summary>
|
|
210
|
+
# 読み上げデータ送信の停止(中断)
|
|
211
|
+
# </summary>
|
|
212
|
+
def stopSendSpeechData()
|
|
213
|
+
if (@tcpSvr != nil)
|
|
214
|
+
@tcpSvr.kill
|
|
215
|
+
@tcpSvr = nil
|
|
216
|
+
#HzTrace.traceCommMessage("読み上げデータ送信処理をキャンセルしました。")
|
|
217
|
+
HzTrace.traceCommMessage("The sending proccess for send of Speech Data was canceled.")
|
|
218
|
+
end
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
#****************************************
|
|
223
|
+
#Private Methods define
|
|
224
|
+
#****************************************
|
|
225
|
+
private
|
|
93
226
|
#region イベントコールバック関数ラッパー
|
|
94
227
|
def evNotifyMessageEvent(msg, msg_id, err_code)
|
|
95
228
|
if(@EvNotifyMessageEvent != nil)
|
|
@@ -110,34 +243,6 @@ class ClientTcpCommunication
|
|
|
110
243
|
end
|
|
111
244
|
#endregion
|
|
112
245
|
|
|
113
|
-
# <summary>
|
|
114
|
-
# トレース出力設定
|
|
115
|
-
# </summary>
|
|
116
|
-
# <returns></returns>
|
|
117
|
-
def setTraceOutPut(val)
|
|
118
|
-
HzTrace.setTraceOutPut(val)
|
|
119
|
-
end
|
|
120
|
-
|
|
121
|
-
# <summary>
|
|
122
|
-
# 応答受信時タイムアウト取得・設定
|
|
123
|
-
# </summary>
|
|
124
|
-
# <param name="value">タイムアウト値</param>
|
|
125
|
-
def receiveAckTimeOut(value = nil)
|
|
126
|
-
if(value == nil)
|
|
127
|
-
#Get
|
|
128
|
-
return @ReceiveAckTimeOut
|
|
129
|
-
else
|
|
130
|
-
#Set
|
|
131
|
-
if(value > RECEIVE_MAX_TIME_OUT)
|
|
132
|
-
@ReceiveAckTimeOut = RECEIVE_MAX_TIME_OUT
|
|
133
|
-
elsif(value < RECEIVE_MIN_TIME_OUT)
|
|
134
|
-
@ReceiveAckTimeOut = RECEIVE_MIN_TIME_OUT
|
|
135
|
-
else
|
|
136
|
-
@ReceiveAckTimeOut = value
|
|
137
|
-
end
|
|
138
|
-
end
|
|
139
|
-
end
|
|
140
|
-
|
|
141
246
|
# <summary>
|
|
142
247
|
# 非同期メッセージ受信用リスナータスク
|
|
143
248
|
# </summary>
|
|
@@ -755,100 +860,4 @@ class ClientTcpCommunication
|
|
|
755
860
|
end
|
|
756
861
|
end
|
|
757
862
|
|
|
758
|
-
# <summary>
|
|
759
|
-
# 読み上げデータ送信(自動)
|
|
760
|
-
# </summary>
|
|
761
|
-
# <returns>OK:タイムスタンプ文字列(00:00:00形式), NG:nil</returns>
|
|
762
|
-
def sendSpeechDataEx()
|
|
763
|
-
timeStamp = ""
|
|
764
|
-
notifyEndComm = MsgNotifyEndComm.new()
|
|
765
|
-
|
|
766
|
-
begin
|
|
767
|
-
|
|
768
|
-
#電文シーケンス開始
|
|
769
|
-
#通信開始要求(0x00)
|
|
770
|
-
if (@ReqSendDataAccountName != nil && @ReqSendDataPasswd != nil && @ReqSendDataEncryptKey != nil)
|
|
771
|
-
#暗号化パスワード認証
|
|
772
|
-
retStatus = reqStartCommProc(@ReqSendDataAccountName, @ReqSendDataPasswd, @ReqSendDataEncryptKey)
|
|
773
|
-
elsif (@ReqSendDataAccountName != nil && @ReqSendDataPasswd != nil)
|
|
774
|
-
#パスワード認証
|
|
775
|
-
retStatus = reqStartCommProc(@ReqSendDataAccountName, @ReqSendDataPasswd)
|
|
776
|
-
else
|
|
777
|
-
#認証無
|
|
778
|
-
retStatus = reqStartCommProc()
|
|
779
|
-
end
|
|
780
|
-
if (!retStatus)
|
|
781
|
-
#puts("【CL】通信開始応答受信(0x%02x):待機結果[%s]" % [reqStartComm.id, "Time Out"])
|
|
782
|
-
#raise("通信開始要求メッセージ送信に失敗しました。\r\n通信処理を中断します。")
|
|
783
|
-
puts("[CL]Received, Responce of Communication Start Request(0x%02x):Waiting Result[%s]" % [reqStartComm.id, "Time Out"])
|
|
784
|
-
raise("Sending the message of Communication Strat Request has failed. and then the communication stop.")
|
|
785
|
-
end
|
|
786
|
-
|
|
787
|
-
#非同期メッセージ受信タスク起動
|
|
788
|
-
if(@listenTask == nil)
|
|
789
|
-
@listenTask = Thread.start do
|
|
790
|
-
listenerTask()
|
|
791
|
-
end
|
|
792
|
-
end
|
|
793
|
-
|
|
794
|
-
#読み上げデータ送信(0x03)
|
|
795
|
-
if (@ReqSendDataAccountName != nil && @ReqSendDataEncryptKey != nil)
|
|
796
|
-
#暗号化(アカウント名および暗号化キー有)
|
|
797
|
-
@ReqSendDataEncrypt = true
|
|
798
|
-
elsif (@ReqSendDataAccountName == nil && @ReqSendDataEncryptKey != nil)
|
|
799
|
-
#暗号化(暗号化キーのみ)エラーケース
|
|
800
|
-
@ReqSendDataAccountName = ""
|
|
801
|
-
@ReqSendDataEncrypt = true
|
|
802
|
-
elsif (@ReqSendDataAccountName != nil && @ReqSendDataEncryptKey == nil)
|
|
803
|
-
#平文(アカウント名のみ)
|
|
804
|
-
@ReqSendDataEncrypt = false
|
|
805
|
-
@ReqSendDataEncryptKey = ""
|
|
806
|
-
else
|
|
807
|
-
#平文(認証が有効の場合はエラーとなる)
|
|
808
|
-
@ReqSendDataAccountName = ""
|
|
809
|
-
@ReqSendDataEncrypt = false
|
|
810
|
-
@ReqSendDataEncryptKey = ""
|
|
811
|
-
end
|
|
812
|
-
timeStamp = sendSpeechData()
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
#通信終了通知(0x01)
|
|
816
|
-
if(timeStamp == nil || @ReceiveStatus != 0x00)
|
|
817
|
-
notifyEndCommProc(notifyEndComm.ERR_CODE_OTHER_REASONS)
|
|
818
|
-
else
|
|
819
|
-
notifyEndCommProc(notifyEndComm.ERR_CODE_NONE)
|
|
820
|
-
end
|
|
821
|
-
|
|
822
|
-
rescue => ex
|
|
823
|
-
HzTrace.traceCommMessage("%s" % [ex])
|
|
824
|
-
timeStamp = nil
|
|
825
|
-
ensure
|
|
826
|
-
return timeStamp
|
|
827
|
-
end
|
|
828
|
-
end
|
|
829
|
-
|
|
830
|
-
# <summary>
|
|
831
|
-
# 非同期メッセージ受信スレッドの終了
|
|
832
|
-
# </summary>
|
|
833
|
-
def cancelAsynchronousListener()
|
|
834
|
-
if (@listenTask != nil)
|
|
835
|
-
@listenTask.kill
|
|
836
|
-
@listenTask = nil
|
|
837
|
-
#HzTrace.traceCommMessage("非同期メッセージ受信スレッドをキャンセルしました。")
|
|
838
|
-
HzTrace.traceCommMessage("The thread for receiving some asynchronous messsages was canceled.")
|
|
839
|
-
end
|
|
840
|
-
end
|
|
841
|
-
|
|
842
|
-
# <summary>
|
|
843
|
-
# 読み上げデータ送信の停止(中断)
|
|
844
|
-
# </summary>
|
|
845
|
-
def stopSendSpeechData()
|
|
846
|
-
if (@tcpSvr != nil)
|
|
847
|
-
@tcpSvr.kill
|
|
848
|
-
@tcpSvr = nil
|
|
849
|
-
#HzTrace.traceCommMessage("読み上げデータ送信処理をキャンセルしました。")
|
|
850
|
-
HzTrace.traceCommMessage("The sending proccess for send of Speech Data was canceled.")
|
|
851
|
-
end
|
|
852
|
-
end
|
|
853
|
-
|
|
854
863
|
end
|
|
@@ -72,7 +72,7 @@ class MsgSendSpeechData
|
|
|
72
72
|
end
|
|
73
73
|
|
|
74
74
|
#アクセサ定義(メンバーIndex offset)
|
|
75
|
-
attr_reader :INDEX_ID, :INDEX_ENC_FLG, :INDEX_DATA_TYPE, :INDEX_PRIORITY, :INDEX_LANG_CODE,
|
|
75
|
+
attr_reader :INDEX_ID, :INDEX_ENC_FLG, :INDEX_DATA_TYPE, :INDEX_PRIORITY, :INDEX_LANG_CODE, \
|
|
76
76
|
:INDEX_GENDER, :INDEX_AGE, :INDEX_REPEAT, :INDEX_TIME_STAMP, :INDEX_PADDING, :INDEX_NAME_LEN, \
|
|
77
77
|
:INDEX_SIZE, :INDEX_NAME
|
|
78
78
|
|
data/lib/haruzira_sdk/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: haruzira_sdk
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Symmetry Soft
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-10-
|
|
11
|
+
date: 2016-10-30 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|