Class: MsgSendSpeechRecognitionCommand
- Inherits:
-
Object
- Object
- MsgSendSpeechRecognitionCommand
- Defined in:
- lib/haruzira_sdk/MsgSendSpeechRecognitionCommand.rb
Overview
<summary> 音声認識コマンド送信メッセージ(0x15) </summary>
Instance Attribute Summary collapse
-
#data ⇒ Object
アクセサ定義.
-
#enc_flg ⇒ Object
アクセサ定義.
-
#ENC_FLG_OFF ⇒ Object
readonly
アクセサ定義(送信メンバデータ値).
-
#ENC_FLG_ON ⇒ Object
readonly
アクセサ定義(送信メンバデータ値).
-
#head_len ⇒ Object
readonly
Returns the value of attribute head_len.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#INDEX_ENC_FLG ⇒ Object
readonly
アクセサ定義(メンバーIndex offset).
-
#INDEX_ID ⇒ Object
readonly
アクセサ定義(メンバーIndex offset).
-
#INDEX_LANG_CODE ⇒ Object
readonly
アクセサ定義(メンバーIndex offset).
-
#INDEX_MODE ⇒ Object
readonly
アクセサ定義(メンバーIndex offset).
-
#INDEX_PORT ⇒ Object
readonly
アクセサ定義(メンバーIndex offset).
-
#INDEX_RESERVE ⇒ Object
readonly
アクセサ定義(メンバーIndex offset).
-
#INDEX_SIZE ⇒ Object
readonly
アクセサ定義(メンバーIndex offset).
-
#INDEX_TIME_STAMP ⇒ Object
readonly
アクセサ定義(メンバーIndex offset).
-
#lang_code ⇒ Object
アクセサ定義.
-
#LANG_CODE ⇒ Object
readonly
アクセサ定義(送信メンバデータ値).
-
#mode ⇒ Object
アクセサ定義.
-
#port ⇒ Object
アクセサ定義.
-
#reserve ⇒ Object
アクセサ定義.
-
#size ⇒ Object
アクセサ定義.
-
#time_stamp ⇒ Object
アクセサ定義.
-
#total_len ⇒ Object
readonly
Returns the value of attribute total_len.
Instance Method Summary collapse
-
#initialize ⇒ MsgSendSpeechRecognitionCommand
constructor
A new instance of MsgSendSpeechRecognitionCommand.
-
#makeSendData ⇒ Object
<summary> 送信データ生成 </summary> <param name=“sd”>生成データ</param> <returns>生成データサイズ</returns>.
Constructor Details
#initialize ⇒ MsgSendSpeechRecognitionCommand
Returns a new instance of MsgSendSpeechRecognitionCommand.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/haruzira_sdk/MsgSendSpeechRecognitionCommand.rb', line 9 def initialize() #region 変数・定数定義 #メンバーIndex offset定義 @INDEX_ID = 0 #メッセージID @INDEX_ENC_FLG = 1 #暗号化フラグ @INDEX_LANG_CODE = 2 #ロケールID(言語コード) @INDEX_TIME_STAMP = 4 #タイムスタンプ(00:00:00) @INDEX_MODE = 12 #コマンドモード @INDEX_PORT = 13 #ポート番号 @INDEX_RESERVE = 15 #予備 @INDEX_SIZE = 20 #読み上げデータサイズ # <summary> # 送信メンバデータ値定義 # </summary> #暗号化フラグ @ENC_FLG_OFF = 0x00 #暗号化無 @ENC_FLG_ON = 0x01 #暗号化有 #言語コード @LANG_CODE = 0x00 #ロケールID(言語コード) @id = MSG_SEND_SPEECH_RECOGNITION_COMMAND #メッセージID @enc_flg = 0x00 #暗号化フラグ @lang_code = 0x00 #ロケールID(言語コード) @time_stamp = Array.new(8, 0x00) #タイムスタンプ(00:00:00) @mode = 0x00 #コマンドモード @port = 46000 #ポート番号 @reserve = Array.new(5, 0x00) #予備 @size = 0x00 #コマンドデータサイズ @data = nil #コマンドデータ(可変) @head_len = (1 * 2) + (2 + 1 * 9) + (2) + (1 * 5) + (4) #ヘッダーサイズ(読み上げデータを除いたサイズ) @total_len = 0 #送信フィールド合計サイズ #endregion end |
Instance Attribute Details
#data ⇒ Object
アクセサ定義
54 55 56 |
# File 'lib/haruzira_sdk/MsgSendSpeechRecognitionCommand.rb', line 54 def data @data end |
#enc_flg ⇒ Object
アクセサ定義
54 55 56 |
# File 'lib/haruzira_sdk/MsgSendSpeechRecognitionCommand.rb', line 54 def enc_flg @enc_flg end |
#ENC_FLG_OFF ⇒ Object (readonly)
アクセサ定義(送信メンバデータ値)
51 52 53 |
# File 'lib/haruzira_sdk/MsgSendSpeechRecognitionCommand.rb', line 51 def ENC_FLG_OFF @ENC_FLG_OFF end |
#ENC_FLG_ON ⇒ Object (readonly)
アクセサ定義(送信メンバデータ値)
51 52 53 |
# File 'lib/haruzira_sdk/MsgSendSpeechRecognitionCommand.rb', line 51 def ENC_FLG_ON @ENC_FLG_ON end |
#head_len ⇒ Object (readonly)
Returns the value of attribute head_len.
55 56 57 |
# File 'lib/haruzira_sdk/MsgSendSpeechRecognitionCommand.rb', line 55 def head_len @head_len end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
55 56 57 |
# File 'lib/haruzira_sdk/MsgSendSpeechRecognitionCommand.rb', line 55 def id @id end |
#INDEX_ENC_FLG ⇒ Object (readonly)
アクセサ定義(メンバーIndex offset)
47 48 49 |
# File 'lib/haruzira_sdk/MsgSendSpeechRecognitionCommand.rb', line 47 def INDEX_ENC_FLG @INDEX_ENC_FLG end |
#INDEX_ID ⇒ Object (readonly)
アクセサ定義(メンバーIndex offset)
47 48 49 |
# File 'lib/haruzira_sdk/MsgSendSpeechRecognitionCommand.rb', line 47 def INDEX_ID @INDEX_ID end |
#INDEX_LANG_CODE ⇒ Object (readonly)
アクセサ定義(メンバーIndex offset)
47 48 49 |
# File 'lib/haruzira_sdk/MsgSendSpeechRecognitionCommand.rb', line 47 def INDEX_LANG_CODE @INDEX_LANG_CODE end |
#INDEX_MODE ⇒ Object (readonly)
アクセサ定義(メンバーIndex offset)
47 48 49 |
# File 'lib/haruzira_sdk/MsgSendSpeechRecognitionCommand.rb', line 47 def INDEX_MODE @INDEX_MODE end |
#INDEX_PORT ⇒ Object (readonly)
アクセサ定義(メンバーIndex offset)
47 48 49 |
# File 'lib/haruzira_sdk/MsgSendSpeechRecognitionCommand.rb', line 47 def INDEX_PORT @INDEX_PORT end |
#INDEX_RESERVE ⇒ Object (readonly)
アクセサ定義(メンバーIndex offset)
47 48 49 |
# File 'lib/haruzira_sdk/MsgSendSpeechRecognitionCommand.rb', line 47 def INDEX_RESERVE @INDEX_RESERVE end |
#INDEX_SIZE ⇒ Object (readonly)
アクセサ定義(メンバーIndex offset)
47 48 49 |
# File 'lib/haruzira_sdk/MsgSendSpeechRecognitionCommand.rb', line 47 def INDEX_SIZE @INDEX_SIZE end |
#INDEX_TIME_STAMP ⇒ Object (readonly)
アクセサ定義(メンバーIndex offset)
47 48 49 |
# File 'lib/haruzira_sdk/MsgSendSpeechRecognitionCommand.rb', line 47 def INDEX_TIME_STAMP @INDEX_TIME_STAMP end |
#lang_code ⇒ Object
アクセサ定義
54 55 56 |
# File 'lib/haruzira_sdk/MsgSendSpeechRecognitionCommand.rb', line 54 def lang_code @lang_code end |
#LANG_CODE ⇒ Object (readonly)
アクセサ定義(送信メンバデータ値)
51 52 53 |
# File 'lib/haruzira_sdk/MsgSendSpeechRecognitionCommand.rb', line 51 def LANG_CODE @LANG_CODE end |
#mode ⇒ Object
アクセサ定義
54 55 56 |
# File 'lib/haruzira_sdk/MsgSendSpeechRecognitionCommand.rb', line 54 def mode @mode end |
#port ⇒ Object
アクセサ定義
54 55 56 |
# File 'lib/haruzira_sdk/MsgSendSpeechRecognitionCommand.rb', line 54 def port @port end |
#reserve ⇒ Object
アクセサ定義
54 55 56 |
# File 'lib/haruzira_sdk/MsgSendSpeechRecognitionCommand.rb', line 54 def reserve @reserve end |
#size ⇒ Object
アクセサ定義
54 55 56 |
# File 'lib/haruzira_sdk/MsgSendSpeechRecognitionCommand.rb', line 54 def size @size end |
#time_stamp ⇒ Object
アクセサ定義
54 55 56 |
# File 'lib/haruzira_sdk/MsgSendSpeechRecognitionCommand.rb', line 54 def time_stamp @time_stamp end |
#total_len ⇒ Object (readonly)
Returns the value of attribute total_len.
55 56 57 |
# File 'lib/haruzira_sdk/MsgSendSpeechRecognitionCommand.rb', line 55 def total_len @total_len end |
Instance Method Details
#makeSendData ⇒ Object
<summary> 送信データ生成</summary> <param name=“sd”>生成データ</param> <returns>生成データサイズ</returns>
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/haruzira_sdk/MsgSendSpeechRecognitionCommand.rb', line 64 def makeSendData() @total_len = @head_len + @size mdata = nil begin #ネットワークバイトオーダー後に、Byte配列に変換 bLangCode = [@lang_code].pack("n*").unpack("C*") bPort = [@port].pack("n*").unpack("C*") bSize = [@size].pack("N*").unpack("C*") mdata = [@id] + [@enc_flg] + bLangCode + \ @time_stamp + [@mode] + bPort + @reserve + bSize + @data rescue Exception => ex p ex @total_len = 0 ensure return @total_len, mdata end end |