<commit_before>//
//  RemoteCamSession.swift
//  Actors
//
//  Created by Dario on 10/7/15.
//  Copyright © 2015 dario. All rights reserved.
//

import Foundation
import Theater
import MultipeerConnectivity

public class RemoteCamSession : Actor, MCSessionDelegate {
    
    var session : MCSession
    
    public required init(context: ActorSystem, ref: ActorRef) {
        let peerID = MCPeerID(displayName: UIDevice.currentDevice().name)
        self.session = MCSession(peer: peerID)
        super.init(context: context, ref: ref)
        self.become(scanning)
        self.session.delegate = self
    }
    
    func camera(camViewController : UIViewController) -> Receive {
        return {[unowned self] (msg : Message) in
            switch(msg) {
                case let s as SendFrame:
                    //TODO: include Paracon to mantain stream connection or send it through the session
                break
                case is Disconnect:
                    self.unbecome()
                    self.this ! msg
                break
                default:
                    self.receive(msg)
                
            }
    }
    }
    
    lazy var monitor : Receive = {[unowned self] (msg : Message) in
        switch(msg) {
            case let s as OnFrame:
                //TODO: include Paracon to mantain stream connection or send it through the session
                break
            case is Disconnect:
                self.unbecome()
                self.this ! msg
                break
            default:
                self.receive(msg)
        }
    }
    
    lazy var connected : Receive = {[unowned self] (msg : Message) in
        switch(msg) {
            case let camera as BecomeCamera:
                self.become(self.camera)
                break
            case let monitor as BecomeMonitor:
                self.become(self.monitor)
                break
            case is Disconnect:
                self.unbecome()
                break<commit_msg>change just to get master to compile<commit_after>//
//  RemoteCamSession.swift
//  Actors
//
//  Created by Dario on 10/7/15.
//  Copyright © 2015 dario. All rights reserved.
//

import Foundation
import Theater
import MultipeerConnectivity

public class RemoteCamSession : Actor, MCSessionDelegate {
    
    var session : MCSession
    
    public required init(context: ActorSystem, ref: ActorRef) {
        let peerID = MCPeerID(displayName: UIDevice.currentDevice().name)
        self.session = MCSession(peer: peerID)
        super.init(context: context, ref: ref)
        self.become(scanning)
        self.session.delegate = self
    }
    
    func camera(camViewController : UIViewController) -> Receive {
        return {[unowned self] (msg : Message) in
            switch(msg) {
                case let s as SendFrame:
                    //TODO: include Paracon to mantain stream connection or send it through the session
                break
                case is Disconnect:
                    self.unbecome()
                    self.this ! msg
                break
                default:
                    self.receive(msg)
                
            }
    }
    }
    
    lazy var monitor : Receive = {[unowned self] (msg : Message) in
        switch(msg) {
            case let s as OnFrame:
                //TODO: include Paracon to mantain stream connection or send it through the session
                break
            case is Disconnect:
                self.unbecome()
                self.this ! msg
                break
            default:
                self.receive(msg)
        }
    }
    
    lazy var connected : Receive = {[unowned self] (msg : Message) in
        switch(msg) {
            case let camera as BecomeCamera:
                //self.become(self.camera)
                break
            case let monitor as BecomeMonitor:
                self.become(self.monitor)
                break
            case is Disconnect:
                self.unbecome()
                break
{'fraction_non_alphanumeric': 0.07151664611590629, 'fraction_numerical': 0.0044389642416769425, 'mean_word_length': 1.4157236450268016, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5143871', 'n_tokens_mistral': 1098, 'n_tokens_neox': 1021, 'n_words': 315}