haruzira_sdk 1.3.0 → 2.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a894634a0ecfe2122b934b45bf617814aa54e347
4
- data.tar.gz: efc751150ba01135910a355c7f8c9944b83dc88e
3
+ metadata.gz: 4f8b4cb58621ea51d5794d2176b63da252df9f06
4
+ data.tar.gz: b2a4b193133278438074d40eef9ee33bd96611ad
5
5
  SHA512:
6
- metadata.gz: 841c71559215160c39dc93751f8c8fc65e172d870ad3678a267037139b2a24522f16037d8bf6d28bc89947ba0f412fbb6809a01ab490da8c06b687e438fb9808
7
- data.tar.gz: 42f5f901c0ff50c51ae5c508b46ed3abf0c21c9971cbdd1780284468933ebf6353c0e76ae5d32b9603b989ffabf241335b4c4b8ec31c802267f8e5239021b963
6
+ metadata.gz: 4dfe83ea4581b257e93b25eb39e47f3b58eefa65e386986c31539ff62999da27f0c568b542fa64e5b226e083fa69ed798f0df7eb79a66a1bd692bfe52c85933b
7
+ data.tar.gz: 7a45dc7de6547413cbfe5d078c99058066e0b9b0cf4159eccfafb86ae821fa9d92f60148238071ed34ae42605cbe483e370674c90488b1835560d3d9ef1c29ee
data/haruzira_sdk.gemspec CHANGED
@@ -13,7 +13,7 @@ Gem::Specification.new do |spec|
13
13
  spec.summary = %q{SDK for Haruzira UWP APP.}
14
14
  spec.description = <<-EOF
15
15
  This gem is a SDK for communication with the Haruzira(UWP APP).
16
- By the SDK uses, and send the text data, is possible make a speech by remote access.
16
+ By the SDK uses, and sends or receives the text data, is possible to communication with voice synthesis by remote access.
17
17
 
18
18
  The Haruzira has been published in the Winpows store.
19
19
  It has been localized in Japanese and English.
@@ -13,6 +13,8 @@
13
13
  MSG_NOTIFY_COMPLETE_SPEECH = 0x13
14
14
  MSG_REQ_CANCEL_SPEECH = 0x04
15
15
  MSG_ACK_CANCEL_SPEECH = 0x14
16
+ MSG_SEND_SPEECH_RECOGNITION_COMMAND = 0x15
17
+ MSG_ACK_SEND_SPEECH_RECOGNITION_COMMAND = 0x05
16
18
  MSG_CLIENT_OFFLINE = 0x99
17
19
  MSG_CLIENT_NONE_MESSAGE = 0xaa
18
20
  MSG_SEND_SPEECH_DATA_AUTO = 0x50 #Debug用
@@ -10,8 +10,11 @@ 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/MsgSendSpeechRecognitionCommand"
14
+ require "haruzira_sdk/MsgAckSendSpeechRecognitionCommand"
13
15
  #require "haruzira_sdk/MsgReqCancelSpeech"
14
16
  #require "haruzira_sdk/MsgAckCancelSpeech"
15
17
  require "haruzira_sdk/HzClientTcpCommunication"
16
18
  require "haruzira_sdk/HzEncryption"
19
+ require "haruzira_sdk/HzSpeechRecognitionCommandInfo"
17
20
 
@@ -42,10 +42,10 @@ class ClientTcpCommunication
42
42
  # </summary>
43
43
  def initialize()
44
44
  #region 変数・定数
45
- @DISCONNECT_REASON_END = 0x10; #通信終了通知送信時
45
+ @DISCONNECT_REASON_END = 0x10 #通信終了通知送信時
46
46
  @DISCONNECT_REASON_CANCEL = 0x11 #キャンセル発生時
47
47
  @DISCONNECT_REASON_SERVER_IREGULAR = 0x12 #サーバー側でイレギュラー障害発生
48
- @DISCONNECT_REASON_CLIENT_IREGULAR = 0x13; #クライアント側でイレギュラー障害発生
48
+ @DISCONNECT_REASON_CLIENT_IREGULAR = 0x13 #クライアント側でイレギュラー障害発生
49
49
  @QUEUE_RECEIVED = "OK"
50
50
 
51
51
  @encryption = Encryption.new
@@ -71,23 +71,25 @@ class ClientTcpCommunication
71
71
  @ReqSendDataSpeechGender = HzSpeechGender::Neutral
72
72
  @ReqSendDataSpeechAge = 25
73
73
  @ReqSendDataSpeechRepeat = 0
74
+ @ReceivedDataDecryptionKey = ""
74
75
  @SendDataHexStr = ""
75
76
  @SendDataLength = 0
76
77
  @ReceiveStatus = 0x00
77
78
  @ReceiveAckTimeOut = RECEIVE_TIME_OUT
78
- @Version = "1.3.0.0" #SDKバージョン
79
+ @Version = "2.0.0.0" #SDKバージョン
79
80
 
80
81
  #メッセージ受信時イベント定義
81
- @EvNotifyCompeteSpeech = nil #読み上げ完了通知受信時イベント
82
- @EvNotifyMessageEvent = nil #Exception発生時イベント(切断以外)
83
- @EvNotifyReceivedDisConnectEvent = nil #切断発生時イベント(サーバー側からの切断など)
82
+ @EvNotifyCompeteSpeech = nil #読み上げ完了通知受信時イベント
83
+ @EvNotifyMessageEvent = nil #Exception発生時イベント(切断以外)
84
+ @EvNotifyReceivedDisConnectEvent = nil #切断発生時イベント(サーバー側からの切断など)
85
+ @EvNotifySendSpeechRecognitionCommand = nil #音声認識コマンド送信受信時イベント
84
86
  #endregion
85
87
  end
86
88
 
87
89
  #define accessor
88
90
  attr_accessor :ServerPortNo, :ServerIP, :ReceivePort, :ReqSendDataText, :ReqSendDataEncrypt, :ReqSendDataEncryptKey, :ReqSendDataAccountName, :ReqSendDataPasswd, \
89
91
  :ReqSendDataSpeechMode, :ReqSendDataSpeechLevel, :ReqSendDataSpeechLocaleId, :ReqSendDataSpeechGender, :ReqSendDataSpeechAge, :ReqSendDataSpeechRepeat, \
90
- :EvNotifyCompeteSpeech, :EvNotifyMessageEvent, :EvNotifyReceivedDisConnectEvent
92
+ :ReceivedDataDecryptionKey, :EvNotifyCompeteSpeech, :EvNotifyMessageEvent, :EvNotifyReceivedDisConnectEvent, :EvNotifySendSpeechRecognitionCommand
91
93
  attr_reader :SendDataHexStr, :SendDataLength, :ReceiveStatus, :Version
92
94
 
93
95
  # <summary>
@@ -152,11 +154,12 @@ class ClientTcpCommunication
152
154
  end
153
155
 
154
156
  #非同期メッセージ受信タスク起動
155
- if(@listenTask == nil)
156
- @listenTask = Thread.start do
157
- listenerTask()
158
- end
159
- end
157
+ startAsynchronousListener()
158
+ #if(@listenTask == nil)
159
+ # @listenTask = Thread.start do
160
+ # listenerTask()
161
+ # end
162
+ #end
160
163
 
161
164
  #読み上げデータ送信(0x03)
162
165
  if (@ReqSendDataAccountName != nil && @ReqSendDataEncryptKey != nil)
@@ -194,6 +197,26 @@ class ClientTcpCommunication
194
197
  end
195
198
  end
196
199
 
200
+ # <summary>
201
+ # 非同期メッセージ受信タスク起動
202
+ # </summary>
203
+ # <returns></returns>
204
+ def startAsynchronousListener()
205
+ begin
206
+ #非同期メッセージ受信タスク起動
207
+ if(@listenTask == nil)
208
+ @listenTask = Thread.start do
209
+ listenerTask()
210
+ end
211
+ end
212
+
213
+ rescue => ex
214
+ HzTrace.traceCommMessage("%s" % [ex])
215
+ ensure
216
+ end
217
+ end
218
+
219
+
197
220
  # <summary>
198
221
  # 非同期メッセージ受信スレッドの終了
199
222
  # </summary>
@@ -232,13 +255,19 @@ class ClientTcpCommunication
232
255
 
233
256
  def evNotifyReceivedDisConnectEvent(msg, status)
234
257
  if (@EvNotifyReceivedDisConnectEvent != nil)
235
- @EvNotifyReceivedDisConnectEvent.call(msg, status);
258
+ @EvNotifyReceivedDisConnectEvent.call(msg, status)
236
259
  end
237
260
  end
238
261
 
239
262
  def evNotifyCompeteSpeech(result, time_stamp)
240
263
  if (@EvNotifyCompeteSpeech != nil)
241
- @EvNotifyCompeteSpeech.call(result, time_stamp);
264
+ @EvNotifyCompeteSpeech.call(result, time_stamp)
265
+ end
266
+ end
267
+
268
+ def evNotifySendSpeechRecognitionCommand(cmdInfo)
269
+ if (@EvNotifySendSpeechRecognitionCommand != nil)
270
+ @EvNotifySendSpeechRecognitionCommand.call(cmdInfo)
242
271
  end
243
272
  end
244
273
  #endregion
@@ -264,6 +293,8 @@ class ClientTcpCommunication
264
293
  #notifyControlCommand = MsgNotifyControlCommand.new
265
294
  notifyStopComm = MsgNotifyStopComm.new
266
295
  notifyCompleteReading = MsgNotifyCompleteSpeech.new
296
+ sendSpeechRecognitionCommand = MsgSendSpeechRecognitionCommand.new
297
+ acksendSpeechRecognitionCommand = MsgAckSendSpeechRecognitionCommand.new
267
298
  rcvEndFlg = false
268
299
  @ReceiveStatus = notifyStopComm.REASON_CODE_NONE #切断発生時ステータス
269
300
 
@@ -347,6 +378,66 @@ class ClientTcpCommunication
347
378
  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])
348
379
  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)
349
380
  rcvEndFlg = true
381
+ when MSG_SEND_SPEECH_RECOGNITION_COMMAND
382
+ cmdCallBack = false
383
+ sendSpeechRecognitionCommand.size = rcvBuf[sendSpeechRecognitionCommand.INDEX_SIZE..(sendSpeechRecognitionCommand.INDEX_SIZE + 3)].pack("C*").unpack("N*")[0]
384
+ if (rcvLen != sendSpeechRecognitionCommand.head_len + sendSpeechRecognitionCommand.size)
385
+ #受信データサイズが不正
386
+ #_receiveStatus = DISCONNECT_REASON_SERVER_IREGULAR
387
+ HzTrace.traceCommMessage("Received invalid data. disconnected from access point. Message ID[0x%02x], Receive data size[%d]" % [sendSpeechRecognitionCommand.id, rcvLen])
388
+ acksendSpeechRecognitionCommand.ack_code = acksendSpeechRecognitionCommand.ACK_CODE_NG
389
+ acksendSpeechRecognitionCommand.err_code = acksendSpeechRecognitionCommand.ERR_CODE_RCV_DATA
390
+ evNotifyMessageEvent("Received invalid data. disconnected from access point. Message ID[0x%02x], Receive data size[%d]" % [sendSpeechRecognitionCommand.id, rcvLen], sendSpeechRecognitionCommand.id, HZ_ERROR_OTHER_REASON)
391
+ else
392
+ sendSpeechRecognitionCommand.enc_flg = rcvBuf[sendSpeechRecognitionCommand.INDEX_ENC_FLG]
393
+ sendSpeechRecognitionCommand.port = rcvBuf[sendSpeechRecognitionCommand.INDEX_PORT..(sendSpeechRecognitionCommand.INDEX_PORT + 1)].pack("C*").unpack("n*")[0]
394
+ sendSpeechRecognitionCommand.mode = rcvBuf[sendSpeechRecognitionCommand.INDEX_MODE]
395
+ sendSpeechRecognitionCommand.time_stamp = rcvBuf[sendSpeechRecognitionCommand.INDEX_TIME_STAMP..(sendSpeechRecognitionCommand.INDEX_TIME_STAMP + 7)]
396
+ sendSpeechRecognitionCommand.data = rcvBuf[(sendSpeechRecognitionCommand.INDEX_SIZE + 4)..(sendSpeechRecognitionCommand.INDEX_SIZE + 4 + sendSpeechRecognitionCommand.size - 1)]
397
+ command = ""
398
+ if (sendSpeechRecognitionCommand.enc_flg == sendSpeechRecognitionCommand.ENC_FLG_ON)
399
+ #暗号化データ復号
400
+ command = @encryption.cipherDecryption(EncryptionType::AesCbcPkcs7, sendSpeechRecognitionCommand.data.pack("C*"), @ReceivedDataDecryptionKey)
401
+ else
402
+ #平文の場合
403
+ command = sendSpeechRecognitionCommand.data.pack("C*")
404
+ end
405
+
406
+ HzTrace.traceCommMessage("Received 'Send Speech Recognition Command'(0x%02x) : Mode[%d], Port[%d], Timestamp[%s], Command[%s], Size[%d]" % [sendSpeechRecognitionCommand.id, sendSpeechRecognitionCommand.mode, sendSpeechRecognitionCommand.port,
407
+ sendSpeechRecognitionCommand.time_stamp.pack("C*"), command, sendSpeechRecognitionCommand.size])
408
+ if(command == "")
409
+ #複合化エラー
410
+ acksendSpeechRecognitionCommand.ack_code = acksendSpeechRecognitionCommand.ACK_CODE_NG
411
+ acksendSpeechRecognitionCommand.err_code = acksendSpeechRecognitionCommand.ERR_CODE_DECODE_ENC
412
+ evNotifyMessageEvent("Failed to decryption of the received data.", sendSpeechRecognitionCommand.id, HZ_ERROR_OTHER_REASON)
413
+ else
414
+ #平文または複合化成功
415
+ cmdCallBack = true
416
+ acksendSpeechRecognitionCommand.ack_code = acksendSpeechRecognitionCommand.ACK_CODE_OK
417
+ acksendSpeechRecognitionCommand.err_code = acksendSpeechRecognitionCommand.ERR_CODE_NONE
418
+ end
419
+ end
420
+ #応答を返す
421
+ acksendSpeechRecognitionCommand.time_stamp = sendSpeechRecognitionCommand.time_stamp
422
+ len, data = acksendSpeechRecognitionCommand.makeSendData()
423
+ if(len > 0)
424
+ svr_sock.write(data.pack("C*"))
425
+ svr_sock.flush
426
+ else
427
+ raise("Error occurred in data creation. It suspend a communication process.")
428
+ end
429
+
430
+ if(cmdCallBack)
431
+ #コールバック関数呼び出し
432
+ cmdInfo = SpeechRecognitionCommandInfo.new
433
+ cmdInfo.Mode = sendSpeechRecognitionCommand.mode
434
+ sv_famiry, sv_port, sv_host, sv_ip = svr_sock.peeraddr
435
+ cmdInfo.IpAddr = sv_ip
436
+ cmdInfo.Port = sendSpeechRecognitionCommand.port
437
+ cmdInfo.Command = command.force_encoding("UTF-8")
438
+ cmdInfo.Timestamp = sendSpeechRecognitionCommand.time_stamp.pack("C*")
439
+ evNotifySendSpeechRecognitionCommand(cmdInfo)
440
+ end
350
441
  else
351
442
  @ReceiveStatus = @DISCONNECT_REASON_SERVER_IREGULAR
352
443
  #raise("不正なデータを受信しました。Message ID[0x%02x], 受信サイズ[%d]", rcvBuf[0], rcvLen)
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/ruby
2
+ # -*- coding: utf-8 -*-
3
+ require "haruzira_sdk/HaruziraMessage"
4
+
5
+ # <summary>
6
+ # コマンドモード
7
+ # </summary>
8
+ module HzVoiceCommandMode
9
+ Normal = 0x00 #通常
10
+ end
11
+
12
+ # <summary>
13
+ # 音声入力コマンド情報クラス
14
+ # </summary>
15
+ class SpeechRecognitionCommandInfo
16
+ def initialize()
17
+ @Mode = HzVoiceCommandMode::Normal
18
+ @IpAddr = nil
19
+ @Port = 46100
20
+ @Command = nil
21
+ @Timestamp = nil
22
+ end
23
+
24
+ #アクセサ定義
25
+ attr_accessor :Mode, :IpAddr, :Port, :Command, :Timestamp
26
+
27
+ end
@@ -0,0 +1,76 @@
1
+ #!/usr/bin/ruby
2
+ # -*- coding: utf-8 -*-
3
+ require "haruzira_sdk/HaruziraMessage"
4
+
5
+ # <summary>
6
+ # 音声認識コマンド送信応答メッセージ(0x05)
7
+ # </summary>
8
+ class MsgAckSendSpeechRecognitionCommand
9
+ def initialize()
10
+ #region 変数・定数定義
11
+ #メンバーIndex offset定義
12
+ @INDEX_ID = 0 #メッセージID
13
+ @INDEX_ACK_CODE = 1 #応答コード
14
+ @INDEX_ERR_CODE = 2 #エラーコード(異常時)
15
+ @INDEX_PADDING = 3 #アライメント
16
+ @INDEX_TIME_STAMP = 4 #タイムスタンプ(00:00:00)
17
+
18
+
19
+ # <summary>
20
+ # 送信メンバデータ値定義
21
+ # </summary>
22
+ #応答コード
23
+ @ACK_CODE_OK = 0x00 #正常
24
+ @ACK_CODE_NG = 0x01 #異常
25
+ #エラーコード(異常時)
26
+ @ERR_CODE_NONE = 0x00 #エラーなし
27
+ @ERR_CODE_RCV_DATA = 0x01 #受信データエラー
28
+ @ERR_CODE_CREATE_ACK_DATA = 0x02 #応答データ生成エラー
29
+ @ERR_CODE_DECODE_ENC = 0x03 #暗号化データ復号エラー
30
+ @ERR_CODE_UNKNOWN_IP = 0x04 #IPアドレスが不正
31
+ @ERR_CODE_ENCRIPTION_DISABLE = 0x05 #暗号化無効(パスワード認証が無効)
32
+ @ERR_CODE_BUFFER_FULL = 0x06 #バッファーフル
33
+ @ERR_CODE_OTHER_REASONS = 0x10 #その他原因によるエラー
34
+
35
+ @id = MSG_ACK_SEND_SPEECH_RECOGNITION_COMMAND #メッセージID
36
+ @ack_code = 0x00 #応答コード
37
+ @err_code = 0x00 #エラーコード(異常時)
38
+ @padding = 0x00 #アライメント
39
+ @time_stamp = Array.new(8, 0x00) #タイムスタンプ(00:00:00)
40
+ @total_len = 12 #送信フィールド合計サイズ
41
+ #endregion
42
+ end
43
+
44
+ #アクセサ定義(メンバーIndex offset)
45
+ attr_reader :INDEX_ID, :INDEX_ACK_CODE, :INDEX_ERR_CODE, :INDEX_PADDING, :INDEX_TIME_STAMP
46
+
47
+ #アクセサ定義(送信メンバデータ値)
48
+ attr_reader :ACK_CODE_OK, :ACK_CODE_NG, \
49
+ :ERR_CODE_NONE, :ERR_CODE_RCV_DATA, :ERR_CODE_CREATE_ACK_DATA, :ERR_CODE_DECODE_ENC, :ERR_CODE_UNKNOWN_IP, \
50
+ :ERR_CODE_ENCRIPTION_DISABLE, :ERR_CODE_BUFFER_FULL, :ERR_CODE_OTHER_REASONS
51
+
52
+ #アクセサ定義
53
+ attr_accessor :ack_code, :err_code, :padding, :time_stamp
54
+ attr_reader :id, :total_len
55
+
56
+
57
+
58
+ # <summary>
59
+ # 送信データ生成
60
+ # </summary>
61
+ # <param name="sd">生成データ</param>
62
+ # <returns>生成データサイズ</returns>
63
+ def makeSendData()
64
+ mdata = nil
65
+
66
+ begin
67
+ mdata = [@id] + [@ack_code] + [@err_code] + [@padding] + @time_stamp
68
+
69
+ rescue Exception => ex
70
+ p ex
71
+ @total_len = 0
72
+ ensure
73
+ return @total_len, mdata
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,85 @@
1
+ #!/usr/bin/ruby
2
+ # -*- coding: utf-8 -*-
3
+ require "haruzira_sdk/HaruziraMessage"
4
+
5
+ # <summary>
6
+ # 音声認識コマンド送信メッセージ(0x15)
7
+ # </summary>
8
+ class MsgSendSpeechRecognitionCommand
9
+ def initialize()
10
+ #region 変数・定数定義
11
+ #メンバーIndex offset定義
12
+ @INDEX_ID = 0 #メッセージID
13
+ @INDEX_ENC_FLG = 1 #暗号化フラグ
14
+ @INDEX_LANG_CODE = 2 #ロケールID(言語コード)
15
+ @INDEX_TIME_STAMP = 4 #タイムスタンプ(00:00:00)
16
+ @INDEX_MODE = 12 #コマンドモード
17
+ @INDEX_PORT = 13 #ポート番号
18
+ @INDEX_RESERVE = 15 #予備
19
+ @INDEX_SIZE = 20 #読み上げデータサイズ
20
+
21
+
22
+ # <summary>
23
+ # 送信メンバデータ値定義
24
+ # </summary>
25
+ #暗号化フラグ
26
+ @ENC_FLG_OFF = 0x00 #暗号化無
27
+ @ENC_FLG_ON = 0x01 #暗号化有
28
+ #言語コード
29
+ @LANG_CODE = 0x00 #ロケールID(言語コード)
30
+
31
+
32
+ @id = MSG_SEND_SPEECH_RECOGNITION_COMMAND #メッセージID
33
+ @enc_flg = 0x00 #暗号化フラグ
34
+ @lang_code = 0x00 #ロケールID(言語コード)
35
+ @time_stamp = Array.new(8, 0x00) #タイムスタンプ(00:00:00)
36
+ @mode = 0x00 #コマンドモード
37
+ @port = 46000 #ポート番号
38
+ @reserve = Array.new(5, 0x00) #予備
39
+ @size = 0x00 #コマンドデータサイズ
40
+ @data = nil #コマンドデータ(可変)
41
+ @head_len = (1 * 2) + (2 + 1 * 9) + (2) + (1 * 5) + (4) #ヘッダーサイズ(読み上げデータを除いたサイズ)
42
+ @total_len = 0 #送信フィールド合計サイズ
43
+ #endregion
44
+ end
45
+
46
+ #アクセサ定義(メンバーIndex offset)
47
+ attr_reader :INDEX_ID, :INDEX_ENC_FLG, :INDEX_LANG_CODE, :INDEX_TIME_STAMP, :INDEX_MODE, \
48
+ :INDEX_PORT, :INDEX_RESERVE, :INDEX_SIZE
49
+
50
+ #アクセサ定義(送信メンバデータ値)
51
+ attr_reader :ENC_FLG_OFF, :ENC_FLG_ON, :LANG_CODE
52
+
53
+ #アクセサ定義
54
+ attr_accessor :enc_flg, :lang_code, :time_stamp, :mode, :port, :reserve, :size, :data
55
+ attr_reader :id, :head_len, :total_len
56
+
57
+
58
+
59
+ # <summary>
60
+ # 送信データ生成
61
+ # </summary>
62
+ # <param name="sd">生成データ</param>
63
+ # <returns>生成データサイズ</returns>
64
+ def makeSendData()
65
+ @total_len = @head_len + @size
66
+ mdata = nil
67
+
68
+ begin
69
+ #ネットワークバイトオーダー後に、Byte配列に変換
70
+ bLangCode = [@lang_code].pack("n*").unpack("C*")
71
+ bPort = [@port].pack("n*").unpack("C*")
72
+ bSize = [@size].pack("N*").unpack("C*")
73
+
74
+ mdata = [@id] + [@enc_flg] + bLangCode + \
75
+ @time_stamp + [@mode] + bPort + @reserve + bSize + @data
76
+
77
+ rescue Exception => ex
78
+ p ex
79
+ @total_len = 0
80
+ ensure
81
+ return @total_len, mdata
82
+ end
83
+ end
84
+
85
+ end
@@ -1,3 +1,3 @@
1
1
  module HaruziraSdk
2
- VERSION = "1.3.0"
2
+ VERSION = "2.0.0"
3
3
  end
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.3.0
4
+ version: 2.0.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-11-30 00:00:00.000000000 Z
11
+ date: 2017-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -53,9 +53,9 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3.0'
55
55
  description: " This gem is a SDK for communication with the Haruzira(UWP APP).\n
56
- \ By the SDK uses, and send the text data, is possible make a speech by remote access.\n
57
- \ \n The Haruzira has been published in the Winpows store.\n It has been localized
58
- in Japanese and English.\n URL:https://www.microsoft.com/store/apps/9nblggh516j3\n
56
+ \ By the SDK uses, and sends or receives the text data, is possible to communication
57
+ with voice synthesis by remote access.\n \n The Haruzira has been published in
58
+ the Winpows store.\n It has been localized in Japanese and English.\n URL:https://www.microsoft.com/store/apps/9nblggh516j3\n
59
59
  \ \n And also the SDK user's manual has been published on the web site.\n URL:http://haruzirasdke.wpblog.jp/\n"
60
60
  email:
61
61
  - git@symmetry-soft.com
@@ -80,9 +80,11 @@ files:
80
80
  - lib/haruzira_sdk/HaruziraRequire.rb
81
81
  - lib/haruzira_sdk/HzClientTcpCommunication.rb
82
82
  - lib/haruzira_sdk/HzEncryption.rb
83
+ - lib/haruzira_sdk/HzSpeechRecognitionCommandInfo.rb
83
84
  - lib/haruzira_sdk/HzTrace.rb
84
85
  - lib/haruzira_sdk/MsgAckCancelSpeech.rb
85
86
  - lib/haruzira_sdk/MsgAckSendSpeechData.rb
87
+ - lib/haruzira_sdk/MsgAckSendSpeechRecognitionCommand.rb
86
88
  - lib/haruzira_sdk/MsgAckStartComm.rb
87
89
  - lib/haruzira_sdk/MsgNotifyCompleteSpeech.rb
88
90
  - lib/haruzira_sdk/MsgNotifyEndComm.rb
@@ -90,6 +92,7 @@ files:
90
92
  - lib/haruzira_sdk/MsgReqCancelSpeech.rb
91
93
  - lib/haruzira_sdk/MsgReqStartComm.rb
92
94
  - lib/haruzira_sdk/MsgSendSpeechData.rb
95
+ - lib/haruzira_sdk/MsgSendSpeechRecognitionCommand.rb
93
96
  - lib/haruzira_sdk/version.rb
94
97
  homepage: http://haruzirasdke.wpblog.jp/
95
98
  licenses: