haruzira_sdk 0.0.1 → 0.1.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/LICENSE.md +25 -0
- data/haruzira_sdk.gemspec +3 -3
- data/lib/haruzira_sdk/HaruziraMessage.rb +9 -9
- data/lib/haruzira_sdk/HaruziraRequire.rb +2 -2
- data/lib/haruzira_sdk/HzClientTcpCommunication.rb +120 -66
- data/lib/haruzira_sdk/{MsgAckCancelReading.rb → MsgAckCancelSpeech.rb} +1 -1
- data/lib/haruzira_sdk/{MsgReqCancelReading.rb → MsgReqCancelSpeech.rb} +1 -1
- data/lib/haruzira_sdk/version.rb +1 -1
- metadata +9 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fa8765291a9c301d7f546976eac8a46949fe4ef4
|
|
4
|
+
data.tar.gz: 9219d5d0d8990492d0ab3e2be1308a7d9fd7d68d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 102da083e8ed7b8cb2fa8065b8ad90620232aee47283338844ee7f90309cc1d474415b97d6c031da5b637cbb16fec117b5ac1d7648039ba469393a08eb9724ff
|
|
7
|
+
data.tar.gz: 65705e5f77fb2aed90f7c774ab248f077754157283a6560fd621908c454fe47af42938b7e899f58063b13d9f2a5435bcb13a2e6efb7d83ce81f05dc21cdbb87f
|
data/LICENSE.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
=====================
|
|
3
|
+
|
|
4
|
+
Copyright (c) 2016 Symmetry Soft
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person
|
|
7
|
+
obtaining a copy of this software and associated documentation
|
|
8
|
+
files (the "Software"), to deal in the Software without
|
|
9
|
+
restriction, including without limitation the rights to use,
|
|
10
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
copies of the Software, and to permit persons to whom the
|
|
12
|
+
Software is furnished to do so, subject to the following
|
|
13
|
+
conditions:
|
|
14
|
+
|
|
15
|
+
The above copyright notice and this permission notice shall be
|
|
16
|
+
included in all copies or substantial portions of the Software.
|
|
17
|
+
|
|
18
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
19
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
20
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
21
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
22
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
23
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
24
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
25
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
data/haruzira_sdk.gemspec
CHANGED
|
@@ -9,9 +9,9 @@ Gem::Specification.new do |spec|
|
|
|
9
9
|
spec.authors = ["Symmetry Soft"]
|
|
10
10
|
spec.email = ["git@symmetry-soft.com"]
|
|
11
11
|
|
|
12
|
-
spec.summary = %q{SDK for Haruzira UWP
|
|
13
|
-
spec.description = %q{This gem is a SDK for Haruzira to text to remote speech.}
|
|
14
|
-
spec.homepage = ""
|
|
12
|
+
spec.summary = %q{SDK for Haruzira UWP APP.}
|
|
13
|
+
spec.description = %q{This gem is a SDK for Haruzira to text to remote speech. I am currently applying for Haruzira to Microsoft. coming soon.}
|
|
14
|
+
spec.homepage = "https://bitbucket.org/SymmetrySoft/haruzira_sdk_ruby_sample"
|
|
15
15
|
|
|
16
16
|
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
|
17
17
|
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
|
@@ -11,21 +11,21 @@
|
|
|
11
11
|
MSG_NOTIFY_STOP_COMM = 0x11
|
|
12
12
|
MSG_ACK_SEND_SPEECH_DATA = 0x12
|
|
13
13
|
MSG_NOTIFY_COMPLETE_SPEECH = 0x13
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
MSG_REQ_CANCEL_SPEECH = 0x04
|
|
15
|
+
MSG_ACK_CANCEL_SPEECH = 0x14
|
|
16
16
|
MSG_CLIENT_OFFLINE = 0x99
|
|
17
17
|
MSG_CLIENT_NONE_MESSAGE = 0xaa
|
|
18
18
|
MSG_SEND_SPEECH_DATA_AUTO = 0x50 #Debug用
|
|
19
19
|
#endregion
|
|
20
20
|
|
|
21
21
|
#region 変数・定数定義
|
|
22
|
-
RECEIVE_POLLING_TIME_OUT = 2 #
|
|
23
|
-
RECEIVE_TIME_OUT =
|
|
24
|
-
RECEIVE_MAX_TIME_OUT = 60 #
|
|
25
|
-
RECEIVE_MIN_TIME_OUT = 10 #
|
|
26
|
-
WRITE_TIME_OUT = 10 #
|
|
27
|
-
SEND_TIME_OUT = 10 #
|
|
28
|
-
THREAD_JOIN_TIME_OUT = 5 #
|
|
22
|
+
RECEIVE_POLLING_TIME_OUT = 2 #2sec
|
|
23
|
+
RECEIVE_TIME_OUT = 40 #40sec
|
|
24
|
+
RECEIVE_MAX_TIME_OUT = 60 #60sec
|
|
25
|
+
RECEIVE_MIN_TIME_OUT = 10 #10sec
|
|
26
|
+
WRITE_TIME_OUT = 10 #10sec
|
|
27
|
+
SEND_TIME_OUT = 10 #10sec
|
|
28
|
+
THREAD_JOIN_TIME_OUT = 5 #5sec
|
|
29
29
|
SEND_READ_DATA_MAX_SIZE = 1024
|
|
30
30
|
#@SEND_READ_DATA_MAX_SIZE = 12
|
|
31
31
|
RECEIVE_RETRY_MAX_COUNT = 3
|
|
@@ -10,8 +10,8 @@ require "haruzira_sdk/MsgSendSpeechData"
|
|
|
10
10
|
require "haruzira_sdk/MsgAckSendSpeechData"
|
|
11
11
|
require "haruzira_sdk/MsgNotifyCompleteSpeech"
|
|
12
12
|
require "haruzira_sdk/MsgNotifyStopComm"
|
|
13
|
-
require "haruzira_sdk/
|
|
14
|
-
require "haruzira_sdk/
|
|
13
|
+
#require "haruzira_sdk/MsgReqCancelSpeech"
|
|
14
|
+
#require "haruzira_sdk/MsgAckCancelSpeech"
|
|
15
15
|
require "haruzira_sdk/HzClientTcpCommunication"
|
|
16
16
|
require "haruzira_sdk/HzEncryption"
|
|
17
17
|
|
|
@@ -31,7 +31,7 @@ end
|
|
|
31
31
|
module HzSpeechGender
|
|
32
32
|
Female = 0x00 #女性
|
|
33
33
|
Male = 0x01 #男性
|
|
34
|
-
Neutral = 0x02
|
|
34
|
+
Neutral = 0x02 #未指定
|
|
35
35
|
end
|
|
36
36
|
#endregion
|
|
37
37
|
|
|
@@ -77,7 +77,7 @@ class ClientTcpCommunication
|
|
|
77
77
|
@ReceiveAckTimeOut = RECEIVE_TIME_OUT
|
|
78
78
|
|
|
79
79
|
#メッセージ受信時イベント定義
|
|
80
|
-
@
|
|
80
|
+
@EvNotifyCompeteSpeech = nil #読み上げ完了通知受信時イベント
|
|
81
81
|
@EvNotifyMessageEvent = nil #Exception発生時イベント(切断以外)
|
|
82
82
|
@EvNotifyReceivedDisConnectEvent = nil #切断発生時イベント(サーバー側からの切断など)
|
|
83
83
|
#endregion
|
|
@@ -86,7 +86,7 @@ class ClientTcpCommunication
|
|
|
86
86
|
#define accessor
|
|
87
87
|
attr_accessor :ServerPortNo, :ServerIP, :ReceivePort, :ReqSendDataText, :ReqSendDataEncrypt, :ReqSendDataEncryptKey, :ReqSendDataAccountName, :ReqSendDataPasswd, \
|
|
88
88
|
:ReqSendDataSpeechMode, :ReqSendDataSpeechLevel, :ReqSendDataSpeechLocaleId, :ReqSendDataSpeechGender, :ReqSendDataSpeechAge, :ReqSendDataSpeechRepeat, \
|
|
89
|
-
:
|
|
89
|
+
:EvNotifyCompeteSpeech, :EvNotifyMessageEvent, :EvNotifyReceivedDisConnectEvent
|
|
90
90
|
attr_reader :SendDataHexStr, :SendDataLength, :ReceiveStatus
|
|
91
91
|
|
|
92
92
|
#region イベントコールバック関数ラッパー
|
|
@@ -102,9 +102,9 @@ class ClientTcpCommunication
|
|
|
102
102
|
end
|
|
103
103
|
end
|
|
104
104
|
|
|
105
|
-
def
|
|
106
|
-
if (@
|
|
107
|
-
@
|
|
105
|
+
def evNotifyCompeteSpeech(result, time_stamp)
|
|
106
|
+
if (@EvNotifyCompeteSpeech != nil)
|
|
107
|
+
@EvNotifyCompeteSpeech.call(result, time_stamp);
|
|
108
108
|
end
|
|
109
109
|
end
|
|
110
110
|
#endregion
|
|
@@ -145,7 +145,8 @@ class ClientTcpCommunication
|
|
|
145
145
|
Thread.abort_on_exception = true
|
|
146
146
|
begin
|
|
147
147
|
TCPServer.open("0.0.0.0", @ReceivePort) do |svr|
|
|
148
|
-
HzTrace.traceCommMessage("非同期メッセージ受信スレッド開始")
|
|
148
|
+
#HzTrace.traceCommMessage("非同期メッセージ受信スレッド開始")
|
|
149
|
+
HzTrace.traceCommMessage("Start, receiving thread for asynchronous messages.")
|
|
149
150
|
loop do
|
|
150
151
|
@tcpSvr = Thread.start(svr.accept) do |svr_sock|
|
|
151
152
|
rcvLen = 0
|
|
@@ -178,26 +179,31 @@ class ClientTcpCommunication
|
|
|
178
179
|
rcvLen = rcvBuf.length
|
|
179
180
|
#p rcvBuf
|
|
180
181
|
|
|
181
|
-
#puts("【CL
|
|
182
|
-
HzTrace.traceCommMessage("【CL
|
|
182
|
+
#puts("【CL】接続元からデータを受信しました。: Data Size[#{rcvLen}]")
|
|
183
|
+
#HzTrace.traceCommMessage("【CL】接続元からデータを受信しました。: Data Size[%d]" % [rcvLen])
|
|
184
|
+
HzTrace.traceCommMessage("[CL]Received a data from the connection source.: Data Size[%d]" % [rcvLen])
|
|
183
185
|
if (rcvLen <= 0)
|
|
184
|
-
puts("
|
|
186
|
+
#puts("受信データを取得できないため、接続元から切断します。\r\n受信データサイズ[#{rcvLen}]")
|
|
187
|
+
puts("Disconnect from the connection source, because it can't to receive any data.\r\nData Size[#{rcvLen}]")
|
|
185
188
|
@ReceiveStatus = DISCONNECT_REASON_SERVER_IREGULAR
|
|
186
|
-
raise("
|
|
189
|
+
#raise("受信データを取得できないため、接続元から切断します。\r\n受信データサイズ[#{rcvLen}]")
|
|
190
|
+
raise("Disconnect from the connection source, because it can't to receive any data.\r\nData Size[#{rcvLen}]")
|
|
187
191
|
#elsif (@ctsClient.IsCancellationRequested)
|
|
188
192
|
# @ReceiveStatus = @DISCONNECT_REASON_CANCEL
|
|
189
|
-
# raise("
|
|
193
|
+
# raise("キャンセルリクエストが発生しました。接続元から切断します。\r\n受信データサイズ[#{rcvLen}]")
|
|
190
194
|
end
|
|
191
195
|
|
|
192
196
|
else
|
|
193
197
|
@ReceiveStatus = @DISCONNECT_REASON_CLIENT_IREGULAR
|
|
194
|
-
raise("
|
|
198
|
+
raise("Disconnect from the connection source, because it can't to receive any data.\r\nData Size[#{rcvLen}]")
|
|
199
|
+
#raise("受信データを取得できないため、接続元から切断します。\r\n受信データサイズ[#{rcvLen}]")
|
|
195
200
|
end
|
|
196
201
|
|
|
197
202
|
rescue Exception => ex
|
|
198
203
|
#タイムアウト時はWait
|
|
199
204
|
if(!ex.to_s.include?("end of file"))
|
|
200
|
-
puts("【CL listener
|
|
205
|
+
#puts("【CL listener】接続元からのデータ受信エラー:%s}" % [ex])
|
|
206
|
+
puts("[CL listener]receiving data error.:%s}" % [ex])
|
|
201
207
|
raise(ex)
|
|
202
208
|
end
|
|
203
209
|
#next
|
|
@@ -210,27 +216,33 @@ class ClientTcpCommunication
|
|
|
210
216
|
if (rcvLen != notifyCompleteReading.total_len)
|
|
211
217
|
#受信データサイズが不正
|
|
212
218
|
@ReceiveStatus = @DISCONNECT_REASON_SERVER_IREGULAR
|
|
213
|
-
raise("
|
|
219
|
+
#raise("不正なデータを受信したため、接続元から切断します。\r\nnメッセージID[0x%02x], 受信サイズ[%d]" % [notifyCompleteReading.id, rcvLen])
|
|
220
|
+
raise("Disconnect from the connection source, because it has received invaild data.\r\nMessage ID[0x%02x], Data Size[%d]" % [notifyCompleteReading.id, rcvLen])
|
|
214
221
|
end
|
|
215
222
|
notifyCompleteReading.result = rcvBuf[notifyCompleteReading.INDEX_RESULT]
|
|
216
223
|
notifyCompleteReading.time_stamp = rcvBuf[notifyCompleteReading.INDEX_TIME_STAMP..(notifyCompleteReading.INDEX_TIME_STAMP + 7)]
|
|
217
|
-
HzTrace.traceCommMessage("【CL】読み上げ完了通知受信(0x%02x):Result[0x%02x], TimeStamp[%s]" % [notifyCompleteReading.id, notifyCompleteReading.result, notifyCompleteReading.time_stamp.pack("C*")])
|
|
224
|
+
#HzTrace.traceCommMessage("【CL】読み上げ完了通知受信(0x%02x):Result[0x%02x], TimeStamp[%s]" % [notifyCompleteReading.id, notifyCompleteReading.result, notifyCompleteReading.time_stamp.pack("C*")])
|
|
225
|
+
HzTrace.traceCommMessage("[CL]Received, Speech Completion Notice(0x%02x):Result[0x%02x], TimeStamp[%s]" % [notifyCompleteReading.id, notifyCompleteReading.result, notifyCompleteReading.time_stamp.pack("C*")])
|
|
218
226
|
#コールバック関数呼び出し
|
|
219
|
-
|
|
227
|
+
evNotifyCompeteSpeech(notifyCompleteReading.result, notifyCompleteReading.time_stamp.pack("C*"))
|
|
220
228
|
when MSG_NOTIFY_STOP_COMM
|
|
221
229
|
if (rcvLen != notifyStopComm.total_len)
|
|
222
230
|
#受信データサイズが不正
|
|
223
231
|
@ReceiveStatus = @DISCONNECT_REASON_SERVER_IREGULAR
|
|
224
|
-
raise("
|
|
232
|
+
#raise("不正なデータを受信したため、接続元から切断します。\r\nメッセージID[0x%02x], 受信サイズ[%d]" % [notifyStopComm.id, rcvLen])
|
|
233
|
+
raise("Disconnect from the connection source, because it has received invaild data.\r\nMessage ID[0x%02x], Data Size[%d]" % [notifyStopComm.id, rcvLen])
|
|
225
234
|
end
|
|
226
235
|
notifyStopComm.stop_code = rcvBuf[notifyStopComm.INDEX_STOP_CODE]
|
|
227
236
|
@ReceiveStatus = notifyStopComm.reason_code
|
|
228
|
-
HzTrace.traceCommMessage("【CL】通信停止通知受信(0x%02x):Stop Code[0x%02x], Reason Code[0x%02x]" % [notifyStopComm.id, notifyStopComm.stop_code, notifyStopComm.reason_code])
|
|
229
|
-
evNotifyReceivedDisConnectEvent(("クライアント: " + "
|
|
237
|
+
#HzTrace.traceCommMessage("【CL】通信停止通知受信(0x%02x):Stop Code[0x%02x], Reason Code[0x%02x]" % [notifyStopComm.id, notifyStopComm.stop_code, notifyStopComm.reason_code])
|
|
238
|
+
#evNotifyReceivedDisConnectEvent(("クライアント: " + "接続元から通信停止通知を受信しました。接続元から切断します。\r\nメッセージID[0x%02x], 停止コード[0x%02x], 理由コード[0x%02x]" % [notifyStopComm.id, notifyStopComm.stop_code, notifyStopComm.reason_code]), @ReceiveStatus)
|
|
239
|
+
HzTrace.traceCommMessage("[CL]Received, Communication Stop Notice(0x%02x):Stop Code[0x%02x], Reason Code[0x%02x]" % [notifyStopComm.id, notifyStopComm.stop_code, notifyStopComm.reason_code])
|
|
240
|
+
evNotifyReceivedDisConnectEvent(("Client: " + "Received, Communication Stop Notice. disconnect from the connection source.\r\nMessage ID[0x%02x], Stop Code[0x%02x], Reason Code[0x%02x]" % [notifyStopComm.id, notifyStopComm.stop_code, notifyStopComm.reason_code]), @ReceiveStatus)
|
|
230
241
|
rcvEndFlg = true
|
|
231
242
|
else
|
|
232
243
|
@ReceiveStatus = @DISCONNECT_REASON_SERVER_IREGULAR
|
|
233
|
-
raise("不正なデータを受信しました。Message ID[0x%02x], 受信サイズ[%d]", rcvBuf[0], rcvLen)
|
|
244
|
+
#raise("不正なデータを受信しました。Message ID[0x%02x], 受信サイズ[%d]", rcvBuf[0], rcvLen)
|
|
245
|
+
raise("Disconnect from the connection source, because it has received invaild data.\r\nMessage ID[0x%02x], Data Size[%d]" % [rcvBuf[0], rcvLen])
|
|
234
246
|
|
|
235
247
|
end #case
|
|
236
248
|
if (rcvEndFlg)
|
|
@@ -242,7 +254,8 @@ class ClientTcpCommunication
|
|
|
242
254
|
end #loop do
|
|
243
255
|
|
|
244
256
|
rescue Exception => ex
|
|
245
|
-
evNotifyReceivedDisConnectEvent("非同期メッセージ受信スレッド: %s" % [ex], @ReceiveStatus)
|
|
257
|
+
#evNotifyReceivedDisConnectEvent("非同期メッセージ受信スレッド: %s" % [ex], @ReceiveStatus)
|
|
258
|
+
evNotifyReceivedDisConnectEvent("Asynchronous message receiving thread: %s" % [ex], @ReceiveStatus)
|
|
246
259
|
#if (ex.HResult != HaruZiraMessage.HRSEULT_SOCKET_CLOSED)
|
|
247
260
|
# #notifyEndCommProc()
|
|
248
261
|
# evNotifyReceivedDisConnectEvent("受信スレッド: " + ex.Message, @ReceiveStatus)
|
|
@@ -261,13 +274,15 @@ class ClientTcpCommunication
|
|
|
261
274
|
@ReceiveStatus = @DISCONNECT_REASON_CLIENT_IREGULAR
|
|
262
275
|
end
|
|
263
276
|
@ackSendSpeechDataAutoResetEvent.push(@QUEUE_RECEIVED)
|
|
264
|
-
evNotifyReceivedDisConnectEvent("非同期メッセージ受信スレッド: %s" % [ex], @ReceiveStatus)
|
|
277
|
+
#evNotifyReceivedDisConnectEvent("非同期メッセージ受信スレッド: %s" % [ex], @ReceiveStatus)
|
|
278
|
+
evNotifyReceivedDisConnectEvent("Asynchronous message receiving thread: %s" % [ex], @ReceiveStatus)
|
|
265
279
|
ensure
|
|
266
280
|
if(@listenTask != nil)
|
|
267
281
|
@listenTask = nil
|
|
268
282
|
end
|
|
269
283
|
end
|
|
270
|
-
HzTrace.traceCommMessage("非同期メッセージ受信スレッド終了")
|
|
284
|
+
#HzTrace.traceCommMessage("非同期メッセージ受信スレッド終了")
|
|
285
|
+
HzTrace.traceCommMessage("Completed, asynchronous message receiving thread.")
|
|
271
286
|
|
|
272
287
|
end #def
|
|
273
288
|
|
|
@@ -292,7 +307,8 @@ class ClientTcpCommunication
|
|
|
292
307
|
@ReceiveStatus = notifyStopComm.REASON_CODE_NONE #切断発生時ステータス
|
|
293
308
|
|
|
294
309
|
begin
|
|
295
|
-
HzTrace.traceCommMessage("受信ワーカースレッド開始")
|
|
310
|
+
#HzTrace.traceCommMessage("受信ワーカースレッド開始")
|
|
311
|
+
HzTrace.traceCommMessage("Start, receiving worker thread.")
|
|
296
312
|
#サーバーからの送信メッセージをチェック
|
|
297
313
|
loop do
|
|
298
314
|
rcvEndFlg = false
|
|
@@ -312,12 +328,15 @@ class ClientTcpCommunication
|
|
|
312
328
|
#p rcvBuf
|
|
313
329
|
|
|
314
330
|
#puts("【CL】接続先からデータを受信しました。: Data Size[#{rcvLen}]")
|
|
315
|
-
HzTrace.traceCommMessage("【CL】接続先からデータを受信しました。: Data Size[%d]" % [rcvLen])
|
|
331
|
+
#HzTrace.traceCommMessage("【CL】接続先からデータを受信しました。: Data Size[%d]" % [rcvLen])
|
|
332
|
+
HzTrace.traceCommMessage("[CL]Received a data from the access point.: Data Size[%d]" % [rcvLen])
|
|
316
333
|
if (rcvLen <= 0)
|
|
317
334
|
break
|
|
318
|
-
puts("受信データを取得できないため、接続先から切断します。\r\n受信データサイズ[#{rcvLen}]")
|
|
335
|
+
#puts("受信データを取得できないため、接続先から切断します。\r\n受信データサイズ[#{rcvLen}]")
|
|
336
|
+
puts("Disconnect from the access point, because it can't to receive any data.\r\nData Size[#{rcvLen}]")
|
|
319
337
|
@ReceiveStatus = DISCONNECT_REASON_SERVER_IREGULAR
|
|
320
|
-
raise("受信データを取得できないため、接続先から切断します。\r\n受信データサイズ[#{rcvLen}]")
|
|
338
|
+
#raise("受信データを取得できないため、接続先から切断します。\r\n受信データサイズ[#{rcvLen}]")
|
|
339
|
+
raise("Disconnect from the access point, because it can't to receive any data.\r\nData Size[#{rcvLen}]")
|
|
321
340
|
#elsif (@ctsClient.IsCancellationRequested)
|
|
322
341
|
# @ReceiveStatus = @DISCONNECT_REASON_CANCEL
|
|
323
342
|
# raise("キャンセルリクエストが発生しました。接続先から切断します。\r\n受信データサイズ[#{rcvLen}]")
|
|
@@ -325,14 +344,16 @@ class ClientTcpCommunication
|
|
|
325
344
|
|
|
326
345
|
else
|
|
327
346
|
@ReceiveStatus = DISCONNECT_REASON_CLIENT_IREGULAR
|
|
328
|
-
raise("受信データを取得できないため、接続先から切断します。\r\n受信データサイズ[#{rcvLen}]")
|
|
347
|
+
#raise("受信データを取得できないため、接続先から切断します。\r\n受信データサイズ[#{rcvLen}]")
|
|
348
|
+
raise("Disconnect from the access point, because it can't to receive any data.\r\nData Size[#{rcvLen}]")
|
|
329
349
|
end
|
|
330
350
|
|
|
331
351
|
rescue Exception => ex
|
|
332
352
|
#タイムアウト時はWait
|
|
333
353
|
if(!ex.to_s.include?("end of file"))
|
|
334
354
|
@ReceiveStatus = @DISCONNECT_REASON_SERVER_IREGULAR
|
|
335
|
-
puts("【CL】接続先からのデータ受信エラー:%s}" % [ex])
|
|
355
|
+
#puts("【CL】接続先からのデータ受信エラー:%s}" % [ex])
|
|
356
|
+
puts("[CL listener]receiving data error.:%s}" % [ex])
|
|
336
357
|
raise(ex)
|
|
337
358
|
end
|
|
338
359
|
#next
|
|
@@ -345,15 +366,18 @@ class ClientTcpCommunication
|
|
|
345
366
|
if (rcvLen != ackStartComm.total_len)
|
|
346
367
|
#受信データサイズが不正
|
|
347
368
|
@ReceiveStatus = @DISCONNECT_REASON_SERVER_IREGULAR
|
|
348
|
-
raise("不正なデータを受信したため、接続先から切断します。\r\nnメッセージID[0x%02x], 受信サイズ[%d]" % [ackStartComm.id, rcvLen])
|
|
369
|
+
#raise("不正なデータを受信したため、接続先から切断します。\r\nnメッセージID[0x%02x], 受信サイズ[%d]" % [ackStartComm.id, rcvLen])
|
|
370
|
+
raise("Disconnect from the access point, because it has received invaild data.\r\nMessage ID[0x%02x], Data Size[%d]" % [ackStartComm.id, rcvLen])
|
|
349
371
|
end
|
|
350
372
|
ackStartComm.ack_code = rcvBuf[ackStartComm.INDEX_ACK_CODE]
|
|
351
373
|
ackStartComm.err_code = rcvBuf[ackStartComm.INDEX_ERR_CODE]
|
|
352
|
-
HzTrace.traceCommMessage("【CL】通信開始応答受信(0x%02x):Ack Code[0x%02x], Error Code[0x%02x]" % [ackStartComm.id, ackStartComm.ack_code, ackStartComm.err_code])
|
|
374
|
+
#HzTrace.traceCommMessage("【CL】通信開始応答受信(0x%02x):Ack Code[0x%02x], Error Code[0x%02x]" % [ackStartComm.id, ackStartComm.ack_code, ackStartComm.err_code])
|
|
375
|
+
HzTrace.traceCommMessage("[CL]Received, Responce of Communication Start Request(0x%02x):Ack Code[0x%02x], Error Code[0x%02x]" % [ackStartComm.id, ackStartComm.ack_code, ackStartComm.err_code])
|
|
353
376
|
if (ackStartComm.ack_code == ackStartComm.ACK_CODE_NG)
|
|
354
377
|
#エラー発生時
|
|
355
378
|
@ReceiveStatus = ackStartComm.err_code
|
|
356
|
-
evNotifyMessageEvent("接続先からエラーコードを受信しました。\r\nメッセージID[0x%02x], エラーコード[0x%02x]" % [ackStartComm.id, ackStartComm.err_code], ackStartComm.id, ackStartComm.err_code)
|
|
379
|
+
#evNotifyMessageEvent("接続先からエラーコードを受信しました。\r\nメッセージID[0x%02x], エラーコード[0x%02x]" % [ackStartComm.id, ackStartComm.err_code], ackStartComm.id, ackStartComm.err_code)
|
|
380
|
+
evNotifyMessageEvent("Received error code from the access point.\r\nMessage ID[0x%02x], Error Code[0x%02x]" % [ackStartComm.id, ackStartComm.err_code], ackStartComm.id, ackStartComm.err_code)
|
|
357
381
|
rcvEndFlg = true
|
|
358
382
|
end
|
|
359
383
|
@ackStartCommAutoResetEvent.push(@QUEUE_RECEIVED)
|
|
@@ -361,15 +385,18 @@ class ClientTcpCommunication
|
|
|
361
385
|
if (rcvLen != ackSendSpeechData.total_len)
|
|
362
386
|
#受信データサイズが不正
|
|
363
387
|
@ReceiveStatus = @DISCONNECT_REASON_SERVER_IREGULAR
|
|
364
|
-
raise("不正なデータを受信したため、接続先から切断します。\r\nメッセージID[0x%02x], 受信サイズ[%d]" % [ackSendSpeechData.id, rcvLen])
|
|
388
|
+
#raise("不正なデータを受信したため、接続先から切断します。\r\nメッセージID[0x%02x], 受信サイズ[%d]" % [ackSendSpeechData.id, rcvLen])
|
|
389
|
+
raise("Disconnect from the access point, because it has received invaild data.\r\nMessage ID[0x%02x], Data Size[%d]" % [ackSendSpeechData.id, rcvLen])
|
|
365
390
|
end
|
|
366
391
|
ackSendSpeechData.ack_code = rcvBuf[ackSendSpeechData.INDEX_ACK_CODE]
|
|
367
392
|
ackSendSpeechData.err_code = rcvBuf[ackSendSpeechData.INDEX_ERR_CODE]
|
|
368
|
-
HzTrace.traceCommMessage("【CL】読み上げデータ送信応答受信(0x%02x):Ack Code[0x%02x], Error Code[0x%02x]" % [ackSendSpeechData.id, ackSendSpeechData.ack_code, ackSendSpeechData.err_code])
|
|
393
|
+
#HzTrace.traceCommMessage("【CL】読み上げデータ送信応答受信(0x%02x):Ack Code[0x%02x], Error Code[0x%02x]" % [ackSendSpeechData.id, ackSendSpeechData.ack_code, ackSendSpeechData.err_code])
|
|
394
|
+
HzTrace.traceCommMessage("[CL]Received, Responce of Send Speech Data(0x%02x):Ack Code[0x%02x], Error Code[0x%02x]" % [ackSendSpeechData.id, ackSendSpeechData.ack_code, ackSendSpeechData.err_code])
|
|
369
395
|
if (ackSendSpeechData.ack_code == ackSendSpeechData.ACK_CODE_NG)
|
|
370
396
|
#エラー発生時
|
|
371
397
|
@ReceiveStatus = ackSendSpeechData.err_code
|
|
372
|
-
evNotifyMessageEvent("接続先からエラーコードを受信しました。\r\nメッセージID[0x%02x], エラーコード[0x%02x]" % [ackSendSpeechData.id, ackSendSpeechData.err_code], ackSendSpeechData.id, ackSendSpeechData.err_code)
|
|
398
|
+
#evNotifyMessageEvent("接続先からエラーコードを受信しました。\r\nメッセージID[0x%02x], エラーコード[0x%02x]" % [ackSendSpeechData.id, ackSendSpeechData.err_code], ackSendSpeechData.id, ackSendSpeechData.err_code)
|
|
399
|
+
evNotifyMessageEvent("Received error code from the access point.\r\nMessage ID[0x%02x], Error Code[0x%02x]" % [ackSendSpeechData.id, ackSendSpeechData.err_code], ackSendSpeechData.id, ackSendSpeechData.err_code)
|
|
373
400
|
rcvEndFlg = true
|
|
374
401
|
end
|
|
375
402
|
@ackSendSpeechDataAutoResetEvent.push(@QUEUE_RECEIVED)
|
|
@@ -377,27 +404,33 @@ class ClientTcpCommunication
|
|
|
377
404
|
if (rcvLen != notifyCompleteReading.total_len)
|
|
378
405
|
#受信データサイズが不正
|
|
379
406
|
@ReceiveStatus = @DISCONNECT_REASON_SERVER_IREGULAR
|
|
380
|
-
raise("不正なデータを受信したため、接続先から切断します。\r\nnメッセージID[0x%02x], 受信サイズ[%d]" % [notifyCompleteReading.id, rcvLen])
|
|
407
|
+
#raise("不正なデータを受信したため、接続先から切断します。\r\nnメッセージID[0x%02x], 受信サイズ[%d]" % [notifyCompleteReading.id, rcvLen])
|
|
408
|
+
raise("Disconnect from the access point, because it has received invaild data.\r\nMessage ID[0x%02x], Data Size[%d]" % [notifyCompleteReading.id, rcvLen])
|
|
381
409
|
end
|
|
382
410
|
notifyCompleteReading.result = rcvBuf[notifyCompleteReading.INDEX_RESULT]
|
|
383
411
|
notifyCompleteReading.time_stamp = rcvBuf[notifyCompleteReading.INDEX_TIME_STAMP..(notifyCompleteReading.INDEX_TIME_STAMP + 7)]
|
|
384
|
-
HzTrace.traceCommMessage("【CL】読み上げ完了通知受信(0x%02x):Result[0x%02x], TimeStamp[%s]" % [notifyCompleteReading.id, notifyCompleteReading.result, notifyCompleteReading.time_stamp.pack("C*")])
|
|
412
|
+
#HzTrace.traceCommMessage("【CL】読み上げ完了通知受信(0x%02x):Result[0x%02x], TimeStamp[%s]" % [notifyCompleteReading.id, notifyCompleteReading.result, notifyCompleteReading.time_stamp.pack("C*")])
|
|
413
|
+
HzTrace.traceCommMessage("[CL]Received, Speech Completion Notice(0x%02x):Result[0x%02x], TimeStamp[%s]" % [notifyCompleteReading.id, notifyCompleteReading.result, notifyCompleteReading.time_stamp.pack("C*")])
|
|
385
414
|
#コールバック関数呼び出し
|
|
386
|
-
|
|
415
|
+
evNotifyCompeteSpeech(notifyCompleteReading.result, notifyCompleteReading.time_stamp.pack("C*"))
|
|
387
416
|
when MSG_NOTIFY_STOP_COMM
|
|
388
417
|
if (rcvLen != notifyStopComm.total_len)
|
|
389
418
|
#受信データサイズが不正
|
|
390
419
|
@ReceiveStatus = @DISCONNECT_REASON_SERVER_IREGULAR
|
|
391
|
-
raise("不正なデータを受信したため、接続先から切断します。\r\nメッセージID[{0:x2}], 受信サイズ[{1}]", notifyStopComm.id, rcvLen)
|
|
420
|
+
#raise("不正なデータを受信したため、接続先から切断します。\r\nメッセージID[{0:x2}], 受信サイズ[{1}]", notifyStopComm.id, rcvLen)
|
|
421
|
+
raise("Disconnect from the access point, because it has received invaild data.\r\nMessage ID[0x%02x], Data Size[%d]" % [notifyStopComm.id, rcvLen])
|
|
392
422
|
end
|
|
393
423
|
notifyStopComm.stop_code = rcvBuf[notifyStopComm.INDEX_STOP_CODE]
|
|
394
424
|
@ReceiveStatus = notifyStopComm.reason_code
|
|
395
|
-
HzTrace.traceCommMessage("【CL】通信停止通知受信(0x%02x):Stop Code[0x%02x], Reason Code[0x%02x]" % [notifyStopComm.id, notifyStopComm.stop_code, notifyStopComm.reason_code])
|
|
396
|
-
evNotifyReceivedDisConnectEvent(("クライアント: " + "接続先から通信停止通知を受信しました。接続先から切断します。\r\nメッセージID[0x%02x], 停止コード[0x%02x], 理由コード[0x%02x]" % [notifyStopComm.id, notifyStopComm.stop_code, notifyStopComm.reason_code]), @ReceiveStatus)
|
|
425
|
+
#HzTrace.traceCommMessage("【CL】通信停止通知受信(0x%02x):Stop Code[0x%02x], Reason Code[0x%02x]" % [notifyStopComm.id, notifyStopComm.stop_code, notifyStopComm.reason_code])
|
|
426
|
+
#evNotifyReceivedDisConnectEvent(("クライアント: " + "接続先から通信停止通知を受信しました。接続先から切断します。\r\nメッセージID[0x%02x], 停止コード[0x%02x], 理由コード[0x%02x]" % [notifyStopComm.id, notifyStopComm.stop_code, notifyStopComm.reason_code]), @ReceiveStatus)
|
|
427
|
+
HzTrace.traceCommMessage("[CL]Received, Communication Stop Notice(0x%02x):Stop Code[0x%02x], Reason Code[0x%02x]" % [notifyStopComm.id, notifyStopComm.stop_code, notifyStopComm.reason_code])
|
|
428
|
+
evNotifyReceivedDisConnectEvent(("Client: " + "Received, Communication Stop Notice. disconnect from the access point.\r\nMessage ID[0x%02x], Stop Code[0x%02x], Reason Code[0x%02x]" % [notifyStopComm.id, notifyStopComm.stop_code, notifyStopComm.reason_code]), @ReceiveStatus)
|
|
397
429
|
rcvEndFlg = true
|
|
398
430
|
else
|
|
399
431
|
@ReceiveStatus = @DISCONNECT_REASON_SERVER_IREGULAR
|
|
400
|
-
raise("不正なデータを受信しました。Message ID[0x%02x], 受信サイズ[%d]", rcvBuf[0], rcvLen)
|
|
432
|
+
#raise("不正なデータを受信しました。Message ID[0x%02x], 受信サイズ[%d]", rcvBuf[0], rcvLen)
|
|
433
|
+
raise("Disconnect from the access point, because it has received invaild data.\r\nMessage ID[0x%02x], Data Size[%d]" % [rcvBuf[0], rcvLen])
|
|
401
434
|
|
|
402
435
|
end #case
|
|
403
436
|
if (rcvEndFlg)
|
|
@@ -409,7 +442,8 @@ class ClientTcpCommunication
|
|
|
409
442
|
end #loop do
|
|
410
443
|
|
|
411
444
|
rescue Exception => ex
|
|
412
|
-
evNotifyReceivedDisConnectEvent("受信スレッド: %s" % [ex], @ReceiveStatus)
|
|
445
|
+
#evNotifyReceivedDisConnectEvent("受信スレッド: %s" % [ex], @ReceiveStatus)
|
|
446
|
+
evNotifyReceivedDisConnectEvent("Receiving worker thread: %s" % [ex], @ReceiveStatus)
|
|
413
447
|
#if (ex.HResult != HaruZiraMessage.HRSEULT_SOCKET_CLOSED)
|
|
414
448
|
# #notifyEndCommProc()
|
|
415
449
|
# evNotifyReceivedDisConnectEvent("受信スレッド: " + ex.Message, @ReceiveStatus)
|
|
@@ -422,7 +456,8 @@ class ClientTcpCommunication
|
|
|
422
456
|
#同期オブジェクトの解除
|
|
423
457
|
@ackStartCommAutoResetEvent.push(@QUEUE_RECEIVED)
|
|
424
458
|
@ackSendSpeechDataAutoResetEvent.push(@QUEUE_RECEIVED)
|
|
425
|
-
HzTrace.traceCommMessage("受信ワーカースレッド終了")
|
|
459
|
+
#HzTrace.traceCommMessage("受信ワーカースレッド終了")
|
|
460
|
+
HzTrace.traceCommMessage("Completed receiving worker thread.")
|
|
426
461
|
end
|
|
427
462
|
end #Thread
|
|
428
463
|
end #def
|
|
@@ -439,6 +474,7 @@ class ClientTcpCommunication
|
|
|
439
474
|
len = 0
|
|
440
475
|
@ReceiveStatus = 0
|
|
441
476
|
reqStartComm = MsgReqStartComm.new()
|
|
477
|
+
ackStartComm = MsgAckStartComm.new()
|
|
442
478
|
ret = false
|
|
443
479
|
|
|
444
480
|
begin
|
|
@@ -483,8 +519,8 @@ class ClientTcpCommunication
|
|
|
483
519
|
reqStartComm.passwd = @encryption.cipherEncryption(passwd, EncryptionType::AesCbcPkcs7, strEncKey)
|
|
484
520
|
#p reqStartComm.passwd
|
|
485
521
|
#Debug
|
|
486
|
-
decPasswd = @encryption.cipherDecryption(EncryptionType::AesCbcPkcs7, reqStartComm.passwd.pack("C*"), strEncKey)
|
|
487
|
-
HzTrace.traceCommMessage("複合後パスワード:#{decPasswd}")
|
|
522
|
+
#decPasswd = @encryption.cipherDecryption(EncryptionType::AesCbcPkcs7, reqStartComm.passwd.pack("C*"), strEncKey)
|
|
523
|
+
#HzTrace.traceCommMessage("複合後パスワード:#{decPasswd}")
|
|
488
524
|
else
|
|
489
525
|
reqStartComm.enc_flg = reqStartComm.ENC_FLG_OFF
|
|
490
526
|
reqStartComm.passwd = passwd.encode("UTF-8").unpack("C*")
|
|
@@ -503,11 +539,13 @@ class ClientTcpCommunication
|
|
|
503
539
|
@cltSocket.write(data.pack("C*"))
|
|
504
540
|
@cltSocket.flush
|
|
505
541
|
else
|
|
506
|
-
raise("送信データの生成エラー。\r\n通信処理を停止します。")
|
|
542
|
+
#raise("送信データの生成エラー。\r\n通信処理を停止します。")
|
|
543
|
+
raise("Creation error of sending data. and then the communicationn stop.")
|
|
507
544
|
end
|
|
508
545
|
@ackStartCommAutoResetEvent.clear
|
|
509
546
|
|
|
510
|
-
HzTrace.traceCommMessage("【CL】通信開始要求送信(0x%02x):Cer[%d] Enc[%d], Port[%d], Name[%s], Passwd[%s], Name Len[%d], Passwd Len[%d]" % \
|
|
547
|
+
#HzTrace.traceCommMessage("【CL】通信開始要求送信(0x%02x):Cer[%d] Enc[%d], Port[%d], Name[%s], Passwd[%s], Name Len[%d], Passwd Len[%d]" % \
|
|
548
|
+
HzTrace.traceCommMessage("[CL]Send, Communication Start Request(0x%02x):Cer[%d] Enc[%d], Port[%d], Name[%s], Passwd[%s], Name Len[%d], Passwd Len[%d]" % \
|
|
511
549
|
[reqStartComm.id, reqStartComm.cer_flg, reqStartComm.enc_flg, reqStartComm.port, reqStartComm.name != nil ? name : "", \
|
|
512
550
|
reqStartComm.passwd != nil ? passwd : "", reqStartComm.name_len, reqStartComm.passwd_len])
|
|
513
551
|
|
|
@@ -518,14 +556,18 @@ class ClientTcpCommunication
|
|
|
518
556
|
end
|
|
519
557
|
rescue Timeout::Error => ex
|
|
520
558
|
#応答待ちのタイムアウトが発生しました。通信処理を中断しました。
|
|
521
|
-
puts("【CL】通信開始応答受信(0x%02x):待機結果[%s]" % [reqStartComm.id, "Time Out"])
|
|
522
|
-
evNotifyMessageEvent("応答待ちのタイムアウトが発生しました。通信処理を中断します。", reqStartComm.id, HZ_ERROR_RECEIVE_TIMEOUT)
|
|
559
|
+
#puts("【CL】通信開始応答受信(0x%02x):待機結果[%s]" % [reqStartComm.id, "Time Out"])
|
|
560
|
+
#evNotifyMessageEvent("応答待ちのタイムアウトが発生しました。通信処理を中断します。", reqStartComm.id, HZ_ERROR_RECEIVE_TIMEOUT)
|
|
561
|
+
puts("[CL]Received, Responce of Communication Start Request(0x%02x):Waiting Result[%s]" % [ackStartComm.id, "Time Out"])
|
|
562
|
+
evNotifyMessageEvent("Timeout has occurred by waiting for the response. and then the communication stop.", ackStartComm.id, HZ_ERROR_RECEIVE_TIMEOUT)
|
|
523
563
|
return false
|
|
524
564
|
else
|
|
525
565
|
if(@ReceiveStatus != 0x00)
|
|
526
|
-
raise("通信中にエラーが発生しました。\r\n通信処理を中断します。")
|
|
566
|
+
#raise("通信中にエラーが発生しました。\r\n通信処理を中断します。")
|
|
567
|
+
raise("A error occurred on the communication. and then the communication stop.")
|
|
527
568
|
else
|
|
528
|
-
HzTrace.traceCommMessage("【CL】通信開始応答受信(0x%02x):待機結果[%s]" % [reqStartComm.id, "OK"])
|
|
569
|
+
#HzTrace.traceCommMessage("【CL】通信開始応答受信(0x%02x):待機結果[%s]" % [reqStartComm.id, "OK"])
|
|
570
|
+
HzTrace.traceCommMessage("【CL】[CL]Received, Responce of Communication Start Request(0x%02x):Waiting Result[%s]" % [ackStartComm.id, "OK"])
|
|
529
571
|
end
|
|
530
572
|
ensure
|
|
531
573
|
@ackStartCommAutoResetEvent.clear
|
|
@@ -534,7 +576,7 @@ class ClientTcpCommunication
|
|
|
534
576
|
ret = true
|
|
535
577
|
rescue => ex
|
|
536
578
|
evNotifyMessageEvent(ex, reqStartComm.id, HZ_ERROR_OTHER_REASON)
|
|
537
|
-
puts("
|
|
579
|
+
puts("Client: %s" % [ex])
|
|
538
580
|
if (@cltSocket != nil)
|
|
539
581
|
#if (@work_rcv.alive)
|
|
540
582
|
@cltSocket.close()
|
|
@@ -582,10 +624,12 @@ class ClientTcpCommunication
|
|
|
582
624
|
@cltSocket.write(data.pack("C*"))
|
|
583
625
|
@cltSocket.flush
|
|
584
626
|
else
|
|
585
|
-
raise("送信データの生成エラー。\r\n通信処理を停止します。")
|
|
627
|
+
#raise("送信データの生成エラー。\r\n通信処理を停止します。")
|
|
628
|
+
raise("Creation error of sending data. and then the communicationn stop.")
|
|
586
629
|
end
|
|
587
630
|
|
|
588
|
-
HzTrace.traceCommMessage("【CL】通信終了通知送信(0x%02x):End Code[0x%02x], Error Code[0x%02x]" % [notifyEndComm.id, notifyEndComm.end_code, notifyEndComm.err_code])
|
|
631
|
+
#HzTrace.traceCommMessage("【CL】通信終了通知送信(0x%02x):End Code[0x%02x], Error Code[0x%02x]" % [notifyEndComm.id, notifyEndComm.end_code, notifyEndComm.err_code])
|
|
632
|
+
HzTrace.traceCommMessage("[CL]Send, Communication End Notice(0x%02x):End Code[0x%02x], Error Code[0x%02x]" % [notifyEndComm.id, notifyEndComm.end_code, notifyEndComm.err_code])
|
|
589
633
|
|
|
590
634
|
#サーバーが受信することを考慮
|
|
591
635
|
sleep(3)
|
|
@@ -632,7 +676,8 @@ class ClientTcpCommunication
|
|
|
632
676
|
|
|
633
677
|
begin
|
|
634
678
|
if (@cltSocket == nil)
|
|
635
|
-
raise("未接続です。\r\n送信先へ接続して下さい。")
|
|
679
|
+
#raise("未接続です。\r\n送信先へ接続して下さい。")
|
|
680
|
+
raise("No connection. You must connect to the access point.")
|
|
636
681
|
end
|
|
637
682
|
|
|
638
683
|
|
|
@@ -669,11 +714,13 @@ class ClientTcpCommunication
|
|
|
669
714
|
@cltSocket.write(data.pack("C*"))
|
|
670
715
|
@cltSocket.flush
|
|
671
716
|
else
|
|
672
|
-
raise("送信データの生成エラー。\r\n通信処理を停止します。")
|
|
717
|
+
#raise("送信データの生成エラー。\r\n通信処理を停止します。")
|
|
718
|
+
raise("Creation error of sending data. and then the communicationn stop.")
|
|
673
719
|
end
|
|
674
720
|
@ackSendSpeechDataAutoResetEvent.clear
|
|
675
721
|
|
|
676
|
-
HzTrace.traceCommMessage("【CL】読み上げデータ送信(0x%02x):Enc[%d], Size[%d]" % [sendSpeechData.id, sendSpeechData.enc_flg, sendSpeechData.size])
|
|
722
|
+
#HzTrace.traceCommMessage("【CL】読み上げデータ送信(0x%02x):Enc[%d], Size[%d]" % [sendSpeechData.id, sendSpeechData.enc_flg, sendSpeechData.size])
|
|
723
|
+
HzTrace.traceCommMessage("[CL]Send, Send Speech Data(0x%02x):Enc[%d], Size[%d]" % [sendSpeechData.id, sendSpeechData.enc_flg, sendSpeechData.size])
|
|
677
724
|
|
|
678
725
|
|
|
679
726
|
#読み上げデータ送信応答待機(0x12)
|
|
@@ -684,14 +731,17 @@ class ClientTcpCommunication
|
|
|
684
731
|
rescue Timeout::Error => ex
|
|
685
732
|
#応答待ちのタイムアウトが発生しました。通信処理を中断しました。
|
|
686
733
|
timeStamp = nil
|
|
687
|
-
puts("【CL】読み上げデータ送信応答受信(0x%02x):待機結果[%s]" % [sendSpeechData.id, "Time Out"])
|
|
688
|
-
evNotifyMessageEvent("応答待ちのタイムアウトが発生しました。通信処理を中断します。", sendSpeechData.id, HZ_ERROR_RECEIVE_TIMEOUT)
|
|
734
|
+
#puts("【CL】読み上げデータ送信応答受信(0x%02x):待機結果[%s]" % [sendSpeechData.id, "Time Out"])
|
|
735
|
+
#evNotifyMessageEvent("応答待ちのタイムアウトが発生しました。通信処理を中断します。", sendSpeechData.id, HZ_ERROR_RECEIVE_TIMEOUT)
|
|
736
|
+
puts("[CL]Received, Responce of Send Speech Data(0x%02x):Waiting Result[%s]" % [ackSendSpeechData.id, "Time Out"])
|
|
737
|
+
evNotifyMessageEvent("Timeout has occurred by waiting for the response. and then the communication stop.", ackSendSpeechData.id, HZ_ERROR_RECEIVE_TIMEOUT)
|
|
689
738
|
else
|
|
690
739
|
if(@ReceiveStatus != 0x00)
|
|
691
740
|
timeStamp = nil
|
|
692
741
|
return nil
|
|
693
742
|
end
|
|
694
|
-
HzTrace.traceCommMessage("【CL】読み上げデータ送信応答受信(0x%02x):待機結果[%s]" % [sendSpeechData.id, "OK"])
|
|
743
|
+
#HzTrace.traceCommMessage("【CL】読み上げデータ送信応答受信(0x%02x):待機結果[%s]" % [sendSpeechData.id, "OK"])
|
|
744
|
+
HzTrace.traceCommMessage("[CL]Received, Responce of Send Speech Data(0x%02x):Waiting Result[%s]" % [ackSendSpeechData.id, "OK"])
|
|
695
745
|
ensure
|
|
696
746
|
@ackSendSpeechDataAutoResetEvent.clear
|
|
697
747
|
end
|
|
@@ -727,8 +777,10 @@ class ClientTcpCommunication
|
|
|
727
777
|
retStatus = reqStartCommProc()
|
|
728
778
|
end
|
|
729
779
|
if (!retStatus)
|
|
730
|
-
puts("【CL】通信開始応答受信(0x%02x):待機結果[%s]" % [reqStartComm.id, "Time Out"])
|
|
731
|
-
raise("通信開始要求メッセージ送信に失敗しました。\r\n通信処理を中断します。")
|
|
780
|
+
#puts("【CL】通信開始応答受信(0x%02x):待機結果[%s]" % [reqStartComm.id, "Time Out"])
|
|
781
|
+
#raise("通信開始要求メッセージ送信に失敗しました。\r\n通信処理を中断します。")
|
|
782
|
+
puts("[CL]Received, Responce of Communication Start Request(0x%02x):Waiting Result[%s]" % [reqStartComm.id, "Time Out"])
|
|
783
|
+
raise("Sending the message of Communication Strat Request has failed. and then the communication stop.")
|
|
732
784
|
end
|
|
733
785
|
|
|
734
786
|
#非同期メッセージ受信タスク起動
|
|
@@ -781,7 +833,8 @@ class ClientTcpCommunication
|
|
|
781
833
|
if (@listenTask != nil)
|
|
782
834
|
@listenTask.kill
|
|
783
835
|
@listenTask = nil
|
|
784
|
-
HzTrace.traceCommMessage("非同期メッセージ受信スレッドをキャンセルしました。")
|
|
836
|
+
#HzTrace.traceCommMessage("非同期メッセージ受信スレッドをキャンセルしました。")
|
|
837
|
+
HzTrace.traceCommMessage("The thread for receiving some asynchronous messsages was canceled.")
|
|
785
838
|
end
|
|
786
839
|
end
|
|
787
840
|
|
|
@@ -792,7 +845,8 @@ class ClientTcpCommunication
|
|
|
792
845
|
if (@tcpSvr != nil)
|
|
793
846
|
@tcpSvr.kill
|
|
794
847
|
@tcpSvr = nil
|
|
795
|
-
HzTrace.traceCommMessage("読み上げデータ送信処理をキャンセルしました。")
|
|
848
|
+
#HzTrace.traceCommMessage("読み上げデータ送信処理をキャンセルしました。")
|
|
849
|
+
HzTrace.traceCommMessage("The sending proccess for send of Speech Data was canceled.")
|
|
796
850
|
end
|
|
797
851
|
end
|
|
798
852
|
|
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: 0.0
|
|
4
|
+
version: 0.1.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-09-
|
|
11
|
+
date: 2016-09-21 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -52,7 +52,8 @@ dependencies:
|
|
|
52
52
|
- - "~>"
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
54
|
version: '3.0'
|
|
55
|
-
description: This gem is a SDK for Haruzira to text to remote speech.
|
|
55
|
+
description: This gem is a SDK for Haruzira to text to remote speech. I am currently
|
|
56
|
+
applying for Haruzira to Microsoft. coming soon.
|
|
56
57
|
email:
|
|
57
58
|
- git@symmetry-soft.com
|
|
58
59
|
executables: []
|
|
@@ -64,6 +65,7 @@ files:
|
|
|
64
65
|
- ".travis.yml"
|
|
65
66
|
- CODE_OF_CONDUCT.md
|
|
66
67
|
- Gemfile
|
|
68
|
+
- LICENSE.md
|
|
67
69
|
- README.md
|
|
68
70
|
- Rakefile
|
|
69
71
|
- bin/console
|
|
@@ -75,17 +77,17 @@ files:
|
|
|
75
77
|
- lib/haruzira_sdk/HzClientTcpCommunication.rb
|
|
76
78
|
- lib/haruzira_sdk/HzEncryption.rb
|
|
77
79
|
- lib/haruzira_sdk/HzTrace.rb
|
|
78
|
-
- lib/haruzira_sdk/
|
|
80
|
+
- lib/haruzira_sdk/MsgAckCancelSpeech.rb
|
|
79
81
|
- lib/haruzira_sdk/MsgAckSendSpeechData.rb
|
|
80
82
|
- lib/haruzira_sdk/MsgAckStartComm.rb
|
|
81
83
|
- lib/haruzira_sdk/MsgNotifyCompleteSpeech.rb
|
|
82
84
|
- lib/haruzira_sdk/MsgNotifyEndComm.rb
|
|
83
85
|
- lib/haruzira_sdk/MsgNotifyStopComm.rb
|
|
84
|
-
- lib/haruzira_sdk/
|
|
86
|
+
- lib/haruzira_sdk/MsgReqCancelSpeech.rb
|
|
85
87
|
- lib/haruzira_sdk/MsgReqStartComm.rb
|
|
86
88
|
- lib/haruzira_sdk/MsgSendSpeechData.rb
|
|
87
89
|
- lib/haruzira_sdk/version.rb
|
|
88
|
-
homepage:
|
|
90
|
+
homepage: https://bitbucket.org/SymmetrySoft/haruzira_sdk_ruby_sample
|
|
89
91
|
licenses: []
|
|
90
92
|
metadata: {}
|
|
91
93
|
post_install_message:
|
|
@@ -107,5 +109,5 @@ rubyforge_project:
|
|
|
107
109
|
rubygems_version: 2.6.6
|
|
108
110
|
signing_key:
|
|
109
111
|
specification_version: 4
|
|
110
|
-
summary: SDK for Haruzira UWP
|
|
112
|
+
summary: SDK for Haruzira UWP APP.
|
|
111
113
|
test_files: []
|