SIB0137.comms.3 start
193956
private void processDestinationListenerCallback (CommsByteBuffer buffer, Conversation conversation) {
     if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "processDestinationListenerCallback", new Object[]{buffer, conversation});

     final ClientConversationState convState = (ClientConversationState) conversation.getAttachment();
     final SICoreConnection connection = convState.getSICoreConnection();

     final short connectionObjectId                = buffer.getShort();
     final short destinationListenerId             = buffer.getShort();
     final SIDestinationAddress destinationAddress = buffer.getSIDestinationAddress(conversation.getHandshakeProperties().getFapLevel());
     final short destinationAvailabilityShort      = buffer.getShort();

     if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "connectionObjectId="+connectionObjectId);
     if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "destinationListenerId="+destinationListenerId);
     if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "destinationAddress="+destinationAddress);

     DestinationAvailability destinationAvailability = null;
     if (destinationAvailabilityShort != CommsConstants.NO_DEST_AVAIL) {
       destinationAvailability = DestinationAvailability.getDestinationAvailability(destinationAvailabilityShort);
     }
     if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "destinationAvailability="+destinationAvailability);

     // Look up the real DestinationListener in the local DestinationListenerCache

     final DestinationListenerCache destinationListenerCache = convState.getDestinationListenerCache();
     final DestinationListener destinationListener = destinationListenerCache.get(destinationListenerId);

     if (destinationListener != null) {
        //Call the listener on a seperate thread.
        ClientAsynchEventThreadPool.getInstance().dispatchDestinationListenerEvent(connection, destinationAddress, destinationAvailability, destinationListener);
     } else {
       if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "DestinationListener id="+destinationListenerId+" not found in DestinationListenerCache");
       if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, destinationListenerCache.toString());

       SIErrorException e = new SIErrorException(nls.getFormattedMessage("UNABLE_TO_FIND_DESTINATION_LISTENER_SICO8019", new Object[] {Short.valueOf(destinationListenerId)}, null));
       FFDCFilter.processException(e, CLASS_NAME + ".processDestinationListenerCallback", CommsConstants.PROXYRECEIVELISTENER_DESTLIST_CALLBACK_02, this);

       SibTr.error(tc, "UNABLE_TO_FIND_DESTINATION_LISTENER_SICO8019", e);
       throw e;
     }

     if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "processDestinationListenerCallback");
   }
622320
function start (router, pskIdToSecret, networkType) {
  if (thaliMobileStates.started === true) {
    return Promise.reject(new Error('Call Stop!'));
  }
  thaliMobileStates.started = true;
  thaliMobileStates.networkType =
    networkType || global.NETWORK_TYPE || thaliMobileStates.networkType;

  return getWifiOrNativeMethodByNetworkType('start',
    thaliMobileStates.networkType)(router, pskIdToSecret)
    .then(function (result) {
      if (result.wifiResult === null && result.nativeResult === null) {
        return result;
      }
      return Promise.reject(result);
    });
}
343449
def reinit(self):
        """"""
        sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        sock.connect((self.server, self.port))
        self._hello(sock)

        comms.send_message(sock, ("<Init>" + self._get_token() + "</Init>").encode())
        reply = comms.recv_message(sock)
        sock.close()
        ok, = struct.unpack('!I', reply)
        return ok != 0
23766
public void unlockSet(SIMessageHandle[] msgHandles)
      throws SIIncorrectCallException, SIMessageNotLockedException,
             SIConnectionDroppedException, SIConnectionLostException
   {
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "unlockSet", msgHandles);

      if (sessionId == 0)
      {
         // If the session Id = 0, then no one called setSessionId(). As such we are unable to flow
         // to the server as we do not know which session to instruct the server to use.
         SIErrorException e = new SIErrorException(
            nls.getFormattedMessage("SESSION_ID_HAS_NOT_BEEN_SET_SICO1043", null, null)
         );

         FFDCFilter.processException(e, CLASS_NAME + ".unlockSet",
                                     CommsConstants.CONVERSATIONHELPERIMPL_12, this);

         if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, e.getMessage(), e);

         throw e;
      }

      if (msgHandles == null)
      {
         // Null msg Id's are no good
         SIErrorException e = new SIErrorException(
            nls.getFormattedMessage("NULL_MESSAGE_IDS_PASSED_IN_SICO1044", null, null)
         );

         FFDCFilter.processException(e, CLASS_NAME + ".unlockSet",
                                     CommsConstants.CONVERSATIONHELPERIMPL_13, this);

         if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, e.getMessage(), e);

         throw e;
      }

      CommsByteBuffer request = getCommsByteBuffer();
      // Connection object id
      request.putShort(connectionObjectId);
      // Consumer session id
      request.putShort(sessionId);
      // Message handles
      request.putSIMessageHandles(msgHandles);
      
      //Flowing incrementLockCount field is only valid for faps 7, 8 and greater than 9.
      //In this case we should always flow a 1 (true) so we don't change existing behaviour.
      final int fapLevel = getConversation().getHandshakeProperties().getFapLevel();
      if(!(fapLevel < JFapChannelConstants.FAP_VERSION_7 || fapLevel == JFapChannelConstants.FAP_VERSION_9))
      {
         request.put((byte)1);
      }

      // Pass on call to server
      jfapSend(request,
               JFapChannelConstants.SEG_UNLOCK_SET_NOREPLY,
               JFapChannelConstants.PRIORITY_MEDIUM,
               true,
               ThrottlingPolicy.BLOCK_THREAD);

      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "unlockSet");
   }
78680
def main():
    
    parser = argparse.ArgumentParser(
        description='Read or change status of verisure devices')
    parser.add_argument(
        'username',
        help='MyPages username')
    parser.add_argument(
        'password',
        help='MyPages password')
    parser.add_argument(
        '-i', '--installation',
        help='Installation number',
        type=int,
        default=1)
    parser.add_argument(
        '-c', '--cookie',
        help='File to store cookie in',
        default='~/.verisure-cookie')

    commandsparser = parser.add_subparsers(
        help='commands',
        dest='command')

    # installations command
    commandsparser.add_parser(
        COMMAND_INSTALLATIONS,
        help='Get information about installations')

    # overview command
    overview_parser = commandsparser.add_parser(
        COMMAND_OVERVIEW,
        help='Read status of one or many device types')
    overview_parser.add_argument(
        'filter',
        nargs='*',
        help='Read status for device type')

    # armstate command
    commandsparser.add_parser(
        COMMAND_ARMSTATE,
        help='Get arm state')

    # Set command
    set_parser = commandsparser.add_parser(
        COMMAND_SET,
        help='Set status of a device')
    set_device = set_parser.add_subparsers(
        help='device',
        dest='device')

    # Set smartplug
    set_smartplug = set_device.add_parser(
        'smartplug',
        help='set smartplug value')
    set_smartplug.add_argument(
        'device_label',
        help='device label')
    set_smartplug.add_argument(
        'new_value',
        choices=[
            'on',
            'off'],
        help='new value')

    # Set alarm
    set_alarm = set_device.add_parser(
        'alarm',
        help='set alarm status')
    set_alarm.add_argument(
        'code',
        help='alarm code')
    set_alarm.add_argument(
        'new_status',
        choices=[
            'ARMED_HOME',
            'ARMED_AWAY',
            'DISARMED'],
        help='new status')

    # Set lock
    set_lock = set_device.add_parser(
        'lock',
        help='set lock status')
    set_lock.add_argument(
        'code',
        help='alarm code')
    set_lock.add_argument(
        'serial_number',
        help='serial number')
    set_lock.add_argument(
        'new_status',
        choices=[
            'lock',
            'unlock'],
        help='new status')

    # Get climate history
    history_climate = commandsparser.add_parser(
        COMMAND_CLIMATE,
        help='get climate history')
    history_climate.add_argument(
        'device_label',
        help='device label')

    # Event log command
    eventlog_parser = commandsparser.add_parser(
        COMMAND_EVENTLOG,
        help='Get event log')
    eventlog_parser.add_argument(
        '-p', '--pagesize',
        type=int,
        default=15,
        help='Number of elements on one page')
    eventlog_parser.add_argument(
        '-o', '--offset',
        type=int,
        default=0,
        help='Page offset')
    eventlog_parser.add_argument(
        '-f', '--filter',
        nargs='*',
        default=[],
        choices=[
            'ARM',
            'DISARM',
            'FIRE',
            'INTRUSION',
            'TECHNICAL',
            'SOS',
            'WARNING',
            'LOCK',
            'UNLOCK'],
        help='Filter event log')

    # Capture command
    capture_parser = commandsparser.add_parser(
        COMMAND_CAPTURE,
        help='Capture image')
    capture_parser.add_argument(
        'device_label',
        help='Device label')

    # Image series command
    commandsparser.add_parser(
        COMMAND_IMAGESERIES,
        help='Get image series')

    # Get image command
    getimage_parser = commandsparser.add_parser(
        COMMAND_GETIMAGE,
        help='Download image')
    getimage_parser.add_argument(
        'device_label',
        help='Device label')
    getimage_parser.add_argument(
        'image_id',
        help='image ID')
    getimage_parser.add_argument(
        'file_name',
        help='Output file name')

    # Vacation mode command
    commandsparser.add_parser(
        COMMAND_VACATIONMODE,
        help='Get vacation mode info')

    # Door window status command
    commandsparser.add_parser(
        COMMAND_DOOR_WINDOW,
        help='Get door/window status')

    # Test ethernet command
    commandsparser.add_parser(
        COMMAND_TEST_ETHERNET,
        help='Update ethernet status')

    args = parser.parse_args()
    session = verisure.Session(args.username, args.password, args.cookie)
    session.login()
    try:
        session.set_giid(session.installations[args.installation - 1]['giid'])
        if args.command == COMMAND_INSTALLATIONS:
            print_result(session.installations)
        if args.command == COMMAND_OVERVIEW:
            print_result(session.get_overview(), *args.filter)
        if args.command == COMMAND_ARMSTATE:
            print_result(session.get_arm_state())
        if args.command == COMMAND_SET:
            if args.device == 'smartplug':
                session.set_smartplug_state(
                    args.device_label,
                    args.new_value == 'on')
            if args.device == 'alarm':
                print_result(session.set_arm_state(
                    args.code,
                    args.new_status))
            if args.device == 'lock':
                print_result(session.set_lock_state(
                    args.code,
                    args.serial_number,
                    args.new_status))
        if args.command == COMMAND_CLIMATE:
            print_result(session.get_climate(args.device_label))
        if args.command == COMMAND_EVENTLOG:
            print_result(
                session.get_history(
                    args.filter,
                    pagesize=args.pagesize,
                    offset=args.offset))
        if args.command == COMMAND_CAPTURE:
            session.capture_image(args.device_label)
        if args.command == COMMAND_IMAGESERIES:
            print_result(session.get_camera_imageseries())
        if args.command == COMMAND_GETIMAGE:
            session.download_image(
                args.device_label,
                args.image_id,
                args.file_name)
        if args.command == COMMAND_VACATIONMODE:
            print_result(session.get_vacation_mode())
        if args.command == COMMAND_DOOR_WINDOW:
            print_result(session.get_door_window())
        if args.command == COMMAND_TEST_ETHERNET:
            session.test_ethernet()
    except verisure.session.ResponseError as ex:
        print(ex.text)
222547
def start(self):
        """"""
        if self._properties.get("startMs") is None:
            return None
        return _helpers._datetime_from_microseconds(
            int(self._properties.get("startMs")) * 1000.0
        )
200668
def system_greet(input_params={}, always_retry=True, **kwargs):
    
    return DXHTTPRequest('/system/greet', input_params, always_retry=always_retry, **kwargs)
57390
async function start ({latest, message, name, version}) {
	if (beenthere) {
		return;
	}

	beenthere = true;

	console.log( // eslint-disable-line no-console
		box({
			latest,
			message,
			name,
			version,
		})
	);

	const Confirm = require('prompt-confirm');
	const confirmed = await new Confirm(
		`install ${name.yellow} version ${latest.yellow} globally?`
	).run();

	if (!confirmed) {
		process.exit(); // eslint-disable-line no-process-exit
	}

	await require('../install-latest')(name);
	process.exit(); // eslint-disable-line no-process-exit
}
1261678
def sim(self, args):
        
        if not self._started:
            raise ApplicationNotStarted("BACnet stack not running - use startApp()")

        # with self.this_application._lock: if use lock...won't be able to call read...
        args = args.split()
        addr, obj_type, obj_inst, prop_id, value = args[:5]

        if self.read("{} {} {} outOfService".format(addr, obj_type, obj_inst)):
            self.write(
                "{} {} {} {} {}".format(addr, obj_type, obj_inst, prop_id, value)
            )
        else:
            try:
                self.write(
                    "{} {} {} outOfService True".format(addr, obj_type, obj_inst)
                )
            except NoResponseFromController:
                pass

            try:
                if self.read("{} {} {} outOfService".format(addr, obj_type, obj_inst)):
                    self.write(
                        "{} {} {} {} {}".format(
                            addr, obj_type, obj_inst, prop_id, value
                        )
                    )
                else:
                    raise OutOfServiceNotSet()
            except NoResponseFromController:
                pass
351464
public void start() throws Exception {

		// Is the DM part of the distribution?
		boolean found = false;
		for( Bundle b : this.bundleContext.getBundles()) {
			if( "net.roboconf.dm".equals( b.getSymbolicName())) {
				found = true;
				break;
			}
		}

		// If we are on an agent, we have nothing to do.
		// Otherwise, we must register a servlet.
		if( found ) {
			this.logger.fine( "iPojo registers a servlet for HTTP messaging." );

			Hashtable<String,String> initParams = new Hashtable<String,String> ();
			initParams.put( "servlet-name", "Roboconf DM (HTTP messaging)" );

			DmWebSocketServlet messagingServlet = new DmWebSocketServlet( this );
			this.httpService.registerServlet( HttpConstants.DM_SOCKET_PATH, messagingServlet, initParams, null );

		} else {
			this.logger.warning( "Roboconf's DM bundle was not found. No servlet will be registered." );
		}
	}
240760
public void sendStart(boolean restart) throws SIConnectionDroppedException, SIConnectionLostException        //471642
   {
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "sendStart","restart="+restart);
      if (sessionId == 0)
      {
         // If the session Id = 0, then no one called setSessionId(). As such we are unable to flow
         // to the server as we do not know which session to instruct the server to use.
         SIErrorException e = new SIErrorException(
            nls.getFormattedMessage("SESSION_ID_HAS_NOT_BEEN_SET_SICO1043", null, null)
         );

         FFDCFilter.processException(e, CLASS_NAME + ".sendStart",
                                     CommsConstants.CONVERSATIONHELPERIMPL_03, this);

         if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, e.getMessage(), e);

         throw e;
      }

      CommsByteBuffer request = getCommsByteBuffer();
      // Connection object id
      request.putShort((short) connectionObjectId);
      // Consumer session id
      request.putShort(sessionId);

      final HandshakeProperties handshakeProps = conversation.getHandshakeProperties();
      final short fapVersion = handshakeProps.getFapLevel();

      // If a restart was requested and the conversation FAP version is >= 9 then send a restart segmentId so that
      // the other end knows that it should check the consumer session state is not stopped before processing the
      // request. When a stoppable async consumer callback is in use it is possible for message processor to stop
      // the consumer session in the server but for the notification not to reach the client until after the client
      // has requested the next batch of messages. By using a restart segmentId the client can tell the comms server
      // end to check the session state before processing the request. If it turns out that message processor has
      // stopped the consumer session then the start request is ignored.
      jfapSend(request,                                                                                         //471642
               (restart && fapVersion >= JFapChannelConstants.FAP_VERSION_9) ? JFapChannelConstants.SEG_RESTART_SESS : JFapChannelConstants.SEG_START_SESS,
               JFapChannelConstants.PRIORITY_MEDIUM,
               true,
               ThrottlingPolicy.BLOCK_THREAD);

      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "sendStart");
   }
960175
def _modem_sm(self):
        """"""
        import datetime

        read_timeout = READ_IDLE_TIMEOUT
        while self.ser:
            try:
                resp = self.read(read_timeout)
            except (serial.SerialException, SystemExit, TypeError):
                _LOGGER.debug('Unable to read from port %s', self.port)
                break

            if self.state != self.STATE_IDLE and len(resp) == 0:
                read_timeout = READ_IDLE_TIMEOUT
                self.set_state(self.STATE_IDLE)
                self.incomingcallnotificationfunc(self.state)
                continue

            resp = resp.decode()
            resp = resp.strip('\r\n')
            if self.cmd_response == '':
                self.cmd_responselines.append(resp)
            _LOGGER.debug('mdm: %s', resp)

            if resp in ['OK', 'ERROR']:
                self.cmd_response = resp
                continue

            if resp in ['RING']:
                if self.state == self.STATE_IDLE:
                    self.cid_name = ''
                    self.cid_number = ''
                    self.cid_time = datetime.datetime.now()

                self.set_state(self.STATE_RING)
                self.incomingcallnotificationfunc(self.state)
                read_timeout = READ_RING_TIMOUT
                continue

            if len(resp) <= 4 or resp.find('=') == -1:
                continue

            read_timeout = READ_RING_TIMOUT
            cid_field, cid_data = resp.split('=')
            cid_field = cid_field.strip()
            cid_data = cid_data.strip()
            if cid_field in ['DATE']:
                self.cid_time = datetime.datetime.now()
                continue

            if cid_field in ['NMBR']:
                self.cid_number = cid_data
                continue

            if cid_field in ['NAME']:
                self.cid_name = cid_data
                self.set_state(self.STATE_CALLERID)
                self.incomingcallnotificationfunc(self.state)
                _LOGGER.debug('CID: %s %s %s',
                              self.cid_time.strftime("%I:%M %p"),
                              self.cid_name,
                              self.cid_number)
                try:
                    self.write(self.cmd_callerid)
                except serial.SerialException:
                    _LOGGER.error('Unable to write to port %s', self.port)
                    break

            continue

        self.set_state(self.STATE_FAILED)
        _LOGGER.debug('Exiting modem state machine')
        return
153933
def start(self):
        '''
        
        '''
        # Start up the ioloop
        log.trace('IPCMessagePublisher: binding to socket: %s', self.socket_path)
        if isinstance(self.socket_path, int):
            self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
            self.sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
            if self.opts.get('ipc_so_sndbuf'):
                self.sock.setsockopt(socket.SOL_SOCKET, socket.SO_SNDBUF, self.opts['ipc_so_sndbuf'])
            if self.opts.get('ipc_so_rcvbuf'):
                self.sock.setsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF, self.opts['ipc_so_rcvbuf'])
            self.sock.setblocking(0)
            self.sock.bind(('127.0.0.1', self.socket_path))
            # Based on default used in tornado.netutil.bind_sockets()
            self.sock.listen(self.opts['ipc_so_backlog'])
        else:
            # sndbuf/rcvbuf does not apply to unix sockets
            self.sock = tornado.netutil.bind_unix_socket(self.socket_path, backlog=self.opts['ipc_so_backlog'])

        with salt.utils.asynchronous.current_ioloop(self.io_loop):
            tornado.netutil.add_accept_handler(
                self.sock,
                self.handle_connection,
            )
        self._started = True
346982
def start(self, block=True):
        """"""
        if self._state == INIT:
            if not any(self.on_message.receivers_for(blinker.ANY)):
                raise RuntimeError('no receivers connected to on_message')

            self.logger.debug('starting %s...', self.name)
            self._state = RUNNING
            self.query_nsqd()

            if self.lookupds:
                self.query_lookupd()
                self._killables.add(self._workers.spawn(self._poll_lookupd))

            self._killables.add(self._workers.spawn(self._poll_ready))

        else:
            self.logger.warn('%s already started', self.name)

        if block:
            self.join()
415068
def start(self):
        """"""
        if not self._started:
            self.sig_started.emit(self)
            self._started = True
1366903
function (successCallback, errorCallback) {
		winble.logger.logApiEntry("startScan");
		winble.deviceManager.startScan(successCallback, errorCallback);
		winble.logger.logApiExit("startScan");
	}
628351
def _connect(self):
        """"""
        try:
            if sys.version_info[:2] >= (2,6):
                self._conn = telnetlib.Telnet(self._amihost, self._amiport, 
                                              connTimeout)
            else:
                self._conn = telnetlib.Telnet(self._amihost, self._amiport)
        except:
            raise Exception(
                "Connection to Asterisk Manager Interface on "
                "host %s and port %s failed."
                % (self._amihost, self._amiport)
                )