Exemplo n.º 1
0
def _img_producer(queue, lock):
    """Produces the image stream, from the gRPC endpoint."""
    # Open a grpc channel
    channel = getEmulatorChannel()

    # Create a client
    stub = proto.emulator_controller_pb2_grpc.EmulatorControllerStub(channel)

    fmt = p.ImageFormat(format=p.ImageFormat.RGBA8888,
                        width=SAMPLE_WIDTH,
                        height=SAMPLE_HEIGHT,
                        display=0)
    i = 0
    for img in stub.streamScreenshot(fmt):
        lock.acquire()
        i = i + 1
        fmt = google.protobuf.text_format.MessageToString(img.format,
                                                          as_one_line=True)
        print("Enquing image {}:{}- {}".format(i, img.frameNumber, fmt))
        queue.append(img)
        lock.release()
Exemplo n.º 2
0
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# -*- coding: utf-8 -*-
from google.protobuf import empty_pb2

import sys
import proto.snapshot_service_pb2
import proto.snapshot_service_pb2_grpc
import proto.waterfall_pb2
import proto.waterfall_pb2_grpc
from channel_provider import getEmulatorChannel

# Open a grpc channel
channel = getEmulatorChannel()

_EMPTY_ = empty_pb2.Empty()

# Create a client
snap = proto.snapshot_service_pb2_grpc.SnapshotServiceStub(channel)

target = proto.snapshot_service_pb2.IceboxTarget(processName=sys.argv[1])
response = snap.trackProcess(target)
print(response)