This is a sample IRC bot program, written using the new IP stack API. All it does is join an IRC channel, wait for some commands, and react to them: !hello will greet whoever sent the command !random will generate a pseudo-random number and send it back !led_toggle will toggle an LED in the board [1] !led_on will turn the LED on regardless of its current state !led_off will turn the LED off !rejoin will part the current channel and join again !disconnect will quit from the IRC server As far as the IRC protocol goes, it doesn't do much more than this, but it should be straightforward to add support for other things (such as notices, CTCP, DCC, etc) if someone is inclined to do so. However, that's way beyond the scope of this sample, which is to show how to use the network API to write a TCP client. Some things are still missing as an example of how to use the APIs, namely DNS resolution, automatically setting up the network with DHCP, maybe saving settings on EEPROM. These are good candidates to be added in the future. [1] The LED code has been shamelessly stolen from the CoAP sample code. Change-Id: I7152e97c0726f3559db545579ae8ae8d07bf04cd Signed-off-by: Leandro Pereira <leandro.pereira@intel.com> Signed-off-by: Michael Scott <michael.scott@linaro.org>
25 lines
768 B
Makefile
25 lines
768 B
Makefile
# Makefile - IRC client sample
|
|
|
|
#
|
|
# Copyright (c) 2017 Intel Corporation
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# 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.
|
|
#
|
|
|
|
BOARD ?= qemu_x86
|
|
CONF_FILE ?= prj_$(BOARD).conf
|
|
|
|
include $(ZEPHYR_BASE)/Makefile.inc
|
|
|
|
include $(ZEPHYR_BASE)/samples/net/common/Makefile.ipstack
|