Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions modules/mobile_session.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function mt.__index:ExpectPacket(frameMessage, binaryDataCompareFunc)
end

--- Expectation of request
-- @tparam number funcName Expected request name
-- @tparam ?string|number funcName Function name or function id
-- @tparam table ... Expectation parameters
-- @treturn Expectation Expectation for request
function mt.__index:ExpectRequest(funcName, ...)
Expand All @@ -64,7 +64,7 @@ function mt.__index:ExpectNotification(funcName, ...)
end

--- Expectation of encrypted request with specific funcName
-- @tparam number funcName Expected request name
-- @tparam ?string|number funcName Function name or function id
-- @tparam table ... Expectation parameters
-- @treturn Expectation Expectation for response
function mt.__index:ExpectEncryptedRequest(funcName, ...)
Expand Down Expand Up @@ -110,15 +110,15 @@ function mt.__index:StopStreaming(filename)
end

--- Send RPC
-- @tparam string func RPC name
-- @tparam ?string|number func RPC name or RPC id
-- @tparam table arguments Arguments for RPC function
-- @tparam string fileName Path to file with binary data
function mt.__index:SendRPC(func, arguments, fileName)
return self.mobile_session_impl:SendRPC(func, arguments, fileName)
end

--- Send RPC response
-- @tparam string func RPC name
-- @tparam ?string|number func RPC name or RPC id
-- @tparam string cor_id Correlation identifier
-- @tparam table arguments Arguments for RPC function
-- @tparam string fileName Path to file with binary data
Expand All @@ -135,15 +135,15 @@ function mt.__index:SendNotification(func, arguments, fileName)
end

--- Send encrypted RPC
-- @tparam string func RPC name
-- @tparam ?string|number func RPC name or RPC id
-- @tparam table arguments Arguments for RPC function
-- @tparam string fileName Path to file with binary data
function mt.__index:SendEncryptedRPC(func, arguments, fileName)
return self.mobile_session_impl:SendEncryptedRPC(func, arguments, fileName)
end

--- Send encrypted RPC response
-- @tparam string func RPC name
-- @tparam ?string|number func RPC name or RPC id
-- @tparam string cor_id Correlation identifier
-- @tparam table arguments Arguments for RPC function
-- @tparam string fileName Path to file with binary data
Expand Down
11 changes: 6 additions & 5 deletions modules/mobile_session_impl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ function mt.__index:ExpectAny()
end

--- Expectation of request
-- @tparam ?string|number funcName Function name or function id
-- @tparam table ... Expectation parameters
-- @treturn Expectation Expectation for request
function mt.__index:ExpectRequest(funcName, ...)
Expand All @@ -72,7 +73,7 @@ function mt.__index:ExpectNotification(funcName, ...)
end

--- Expectation of encrypted request with specific funcName
-- @tparam number funcName Expected request name
-- @tparam ?string|number funcName Function name or function id
-- @tparam table ... Expectation parameters
-- @treturn Expectation Expectation for response
function mt.__index:ExpectEncryptedRequest(funcName, ...)
Expand Down Expand Up @@ -139,15 +140,15 @@ function mt.__index:StopStreaming(filename)
end

--- Send RPC
-- @tparam string func RPC name
-- @tparam ?string|number func RPC name or RPC id
-- @tparam table arguments Arguments for RPC function
-- @tparam string fileName Path to file with binary data
function mt.__index:SendRPC(func, arguments, fileName)
return self.rpc_services:SendRPC(func, arguments, fileName, securityConstants.ENCRYPTION.OFF)
end

--- Send RPC response
-- @tparam string func RPC name
-- @tparam ?string|number func RPC name or RPC id
-- @tparam string cor_id Correlation identifier
-- @tparam table arguments Arguments for RPC response
-- @tparam string fileName Path to file with binary data
Expand All @@ -164,7 +165,7 @@ function mt.__index:SendNotification(func, arguments, fileName)
end

--- Send encrypted RPC
-- @tparam string func RPC name
-- @tparam ?string|number func RPC name or RPC id
-- @tparam table arguments Arguments for RPC function
-- @tparam string fileName Path to file with binary data
function mt.__index:SendEncryptedRPC(func, arguments, fileName)
Expand All @@ -177,7 +178,7 @@ function mt.__index:SendEncryptedRPC(func, arguments, fileName)
end

--- Send encrypted RPC response
-- @tparam string func RPC name
-- @tparam ?string|number func RPC name or RPC id
-- @tparam string cor_id Correlation identifier
-- @tparam table arguments Arguments for RPC response
-- @tparam string fileName Path to file with binary data
Expand Down
15 changes: 8 additions & 7 deletions modules/services/rpc_service.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,19 @@ local mt = { __index = { } }

--- Basic function to create expectation for request from SDL and register it in expectation list
-- @tparam RPCService RPCService Instance of RPCService
-- @tparam string funcName Function name
-- @tparam ?string|number funcName Function name or function id
-- @tparam table ... Expectations parameters
-- @treturn Expectation Created expectation
local function baseExpectRequest(RPCService, funcName, ...)
local tbl_corr_id = {}
local args = table.pack(...)
local requestEvent = Event()
if type(funcName) ~= 'string' and type(funcName) ~= 'number' then
error("ExpectResponse: argument 1 (funcName) must be string")
error("ExpectResponse: argument 1 (funcName) must be string or number")
return nil
end
requestEvent.matches = function(_, data)
return ((type(funcName) == 'string' and data.rpcFunctionId == functionId[funcName])
return ((type(funcName) == 'string' and data.rpcFunctionId == functionId[funcName])
or (type(funcName) == 'number' and data.rpcFunctionId == funcName))
and data.sessionId == RPCService.session.sessionId.get()
and data.rpcType == constants.BINARY_RPC_TYPE.REQUEST
Expand Down Expand Up @@ -103,7 +103,7 @@ local function baseExpectResponse(RPCService, cor_id, ...)
if(#tbl_corr_id > 0) then
responseEvent.matches = function(_, data)
for _, v in pairs(tbl_corr_id) do
if data.rpcCorrelationId == v
if data.rpcCorrelationId == v
and data.sessionId == RPCService.session.sessionId.get()
and data.rpcType == constants.BINARY_RPC_TYPE.RESPONSE then
return true
Expand Down Expand Up @@ -238,7 +238,7 @@ local function setFunctionId(func)
end

--- Send RPC message
-- @tparam string func Mobile function name
-- @tparam ?string|number func Mobile function name or mobile function id
-- @tparam table arguments RPC parameters
-- @tparam string fileName RPC binary data
-- @tparam boolean encrypt If True RPC payload will be encrypted
Expand Down Expand Up @@ -276,7 +276,7 @@ function mt.__index:SendRPC(func, arguments, fileName, encrypt)
end

--- Send RPC response
-- @tparam string func Mobile function name
-- @tparam ?string|number func Mobile function name or mobile function id
-- @tparam number cor_id Correlation identifier
-- @tparam table arguments RPC parameters
-- @tparam string fileName RPC binary data
Expand Down Expand Up @@ -338,6 +338,7 @@ function mt.__index:SendNotification(func, arguments, fileName, encrypt)
end

--- Create expectation for request from SDL and register it in expectation list
-- @tparam ?string|number funcName Function name or function id
-- @tparam table ... Expectations parameters
-- @treturn Expectation Created expectation
function mt.__index:ExpectRequest(funcName, ...)
Expand Down Expand Up @@ -386,7 +387,7 @@ function mt.__index:ExpectNotification(funcName, ...)
end

--- Create expectation for encrypted request from SDL and register it in expectation list
-- @tparam string funcName Request name
-- @tparam ?string|number funcName Function name or function id
-- @tparam table ... Expectations parameters
-- @treturn Expectation Created expectation
function mt.__index:ExpectEncryptedRequest(funcName, ...)
Expand Down